Deploy Uptrace with Ansible
Ansible is an open source IT automation tool used for configuration management, application deployment, infrastructure provisioning, and orchestration. It allows you to automate repetitive tasks, deploy software, and manage systems in a consistent, reliable way.
This guide with help you install Uptrace on your bare metal servers along with all required dependencies. Before proceeding, please make sure you have Ansible installed on your system.
Getting started
Uptrace maintains a set of playbooks to deploy Uptrace with all required dependencies such as ClickHouse, PostgreSQL, and Redis.
To get Ansible playbooks, clone the repository:
git clone https://github.com/uptrace/ansible.git
cd ansible
Inventory
An Ansible inventory is a file that defines the list of hosts (servers or nodes) that Ansible will manage and execute tasks on.
The repository comes with a sample YAML inventory which you should copy and fill with your hosts:
cp inventory.yml.sample inventory.yml
Configuration
The configuration is stored in several locations:
group_vars/all.yml
is the mian config that contains database passwords and some basic Uptrace configuration.roles/uptrace/templates/config.yml
contains the rest of Uptrace config.- Each roles also contains various templates, for example, ClickHouse config can be found at
roles/clickhouse-server/templates/config.xml
.
You need to copy the main config and then update the copy as needed:
cp group_vars/all.yml.sample group_vars/all.yml
ClickHouse
Make sure you've updated all ch_*
variables in group_vars/all.yml
and then run:
ansible-playbook -i inventory.yml ch_server.yml
PostgreSQL
Make sure you've updated all pg_*
variables in group_vars/all.yml
and then run:
ansible-playbook -i inventory.yml pg.yml
Redis
To deploy Redis:
ansible-playbook -i inventory.yml redis.yml
Uptrace
To deploy Uptrace:
ansible-playbook -i inventory.yml uptrace.yml
If all is good, you can ssh into the server to view the greeting from Uptrace:
sudo journalctl -u uptrace -f
Use Uptrace documentation to review and update the configuration at roles/uptrace/templates/config.yml
.
Let's Encrypt
Let's Encrypt uses the HTTP challenge to verify domain ownership. Therefore, you must ensure that your domain can be resolved using public DNS servers:
nslookup my.domain.com
Then update your group_vars/all.yml
file:
# Let's Encrypt will issue a certificate for this domain.
site_url: https://my.domain.com/
# Enable Let's Encrypt.
certmagic_enabled: true
# Use Let's Encrypt staging environment.
# Disable after testing that Let's Encrypt is working.
certmagic_staging_ca: true
# Listen on HTTPS port.
listen_http_addr: ':443'
Mailhog
Optionally, you can deploy Mailhog to view emails sent by Uptrace:
ansible-playbook -i inventory.yml mailhog.yml
You should be able to view emails at http://localhost:8025.
Scaling
You can scale Uptrace by adding another host to your inventory.yml
file:
uptrace:
hosts:
10.10.1.1: { primary: true }
10.10.1.2:
And re-deploying Uptrace:
ansible-playbook -i inventory.yml uptrace.yml