Self Hosting
Customers on our Enterprise Plan have the option to deploy an instance of the Touca server on their own infrastructure. The instructions in this section are intended for DevOps engineers and system administrators who may want to perform this deployment.
Our Enterprise Plan includes dedicated support and professional services for deploying and upgrading self-hosted instances of the Touca server. Please feel free to contact us if you had any question or needed any help during this process.

Prerequisites

We provide a dedicated access token to our enterprise customers. You will need this token to download any stable release of the on-premise version of the Touca server.
We recommend that you deploy Touca on a machine with at least 2 GB of memory.
There is no restriction for the choice of Unix distribution. However, the instructions that follow are written for and tested on Ubuntu 18.04 LTS distribution.

Prepare your server

Overview
Initial Server Setup
Install Docker
Install docker-compose
Install AWS CLI
Self-hosting Touca involves downloading Touca Docker images from our AWS Container Registry and running them via docker-compose on your machine.
The tabs in this section provide instructions for installing these required tools on your machine. You can skip this section, if you already have Docker, docker-compose, and AWS CLI installed.
This section provides general best practices for setting up a virtual machine. They are not specific to self-hosting Touca and are presented for completeness.

Create a New User

1
sudo adduser touca
2
sudo usermod -aG sudo touca
Copied!

Add Public Key Authentication

1
rsync --archive --chown=touca:touca ~/.ssh /home/touca
Copied!

Disable Password Authentication

1
sudo vim /etc/ssh/sshd_config
Copied!
And set PasswordAuthentication to no. Finally, reload SSH daemon for your changes to take effect.
1
sudo systemctl reload sshd
Copied!

Setup Basic Firewall

Use the UFW firewall to make sure only connections to certain services are allowed:
1
sudo ufw allow OpenSSH
2
sudo ufw enable
3
sudo ufw status
Copied!
If configured correctly, you should see an output similar to the following:
1
Status: active
2
3
To Action From
4
-- ------ ----
5
OpenSSH ALLOW Anywhere
6
OpenSSH (v6) ALLOW Anywhere (v6)
Copied!
Update the apt package index:
1
sudo apt-get update
Copied!
Install packages to allow apt to use a repository over HTTPS:
1
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
Copied!
Add Docker’s official GPG key:
1
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Copied!
Setup the stable docker repository.
1
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Copied!
Update the apt package index:
1
sudo apt-get update
Copied!
Install the latest version of Docker Engine - Community and containerd:
1
sudo apt-get install docker-ce docker-ce-cli containerd.io
Copied!
Since we do not want to preface every docker command with sudo, create a Unix group called docker.
1
sudo groupadd docker
Copied!
Add current user to the newly created docker user group.
1
sudo usermod -aG docker $USER
Copied!
Now log out and log back in again and check if you can successfully run docker without using sudo.
1
docker run hello-world
Copied!
Download docker-compose executable from artifacts of their latest GitHub release:
1
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Copied!
Fix permissions of the downloaded binary:
1
sudo chmod +x /usr/local/bin/docker-compose
Copied!
Download and install official AWS command line tools.
1
cd ~
2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
3
unzip awscliv2.zip
4
sudo ./install
Copied!
Once you verify that AWS CLI is installed, you can remove the downloaded archive.
1
aws --version
2
rm awscliv2.zip
Copied!

Obtain Docker Images

Assuming you have installed Docker, docker-compose, and AWS CLI on your machine, we can start with obtaining Touca docker images from Touca container registry on AWS. The commands in this section reference the following parameters that should be replaced with credentials that we provide to you upon your purchase.
    TOUCA_AWS_ACCESS_KEY_ID
    TOUCA_AWS_SECRET_ACCESS_KEY
    TOUCA_AWS_REGION
    TOUCA_AWS_REPO

Authenticate to AWS Container Registry

Run the following command to create an AWS profile.
1
aws configure
Copied!
This command opens an interactive prompt to let you provide credentials for Access Key, Secret, Region, and Output Format.
1
<TOUCA_AWS_ACCESS_KEY_ID>
2
<TOUCA_AWS_SECRET_ACCESS_KEY>
3
<TOUCA_AWS_REGION>
4
json
Copied!
Now that your profile is set up, run the following to authenticate to the AWS Container Registry.
1
mkdir ~/touca
2
aws ecr get-login-password --region <TOUCA_AWS_REGION>
Copied!
The expected output of this command is a long text. We do not need to store it anywhere.
Now that things are set up with AWS, we can login to the container registry via Docker.
1
aws ecr get-login-password --region <TOUCA_AWS_REGION> | docker login --username AWS --password-stdin <TOUCA_AWS_REPO>
Copied!
Now we can pull our images from the new registry.
1
docker pull <TOUCA_AWS_REPO>/touca-api:1.3
2
docker pull <TOUCA_AWS_REPO>/touca-app:1.3
3
docker pull <TOUCA_AWS_REPO>/touca-cmp:1.3
Copied!

Deploy Docker Containers

Download Touca deployment scripts from Touca admin dashboard, move it to the production machine and install it in the appropriate path.
2
mkdir touca; cd touca;
3
scp devops.tar.gz [email protected]:~/
4
tar -zxf ../devops.tar.gz
5
rm ../devops.tar.gz
Copied!
Before running the docker containers, create the local directories (volumes) to which they bind.
1
mkdir -p local/logs/backend local/logs/comparator
2
sudo chown 8002:touca local/logs/backend local/logs/comparator
3
mkdir -p local/data/minio local/data/mongo local/data/redis
Copied!
Modify values of the following environment variables in devops/docker-compose.prod.yaml file. Do not wrap the values in single or double quotations.
    AUTH_JWT_SECRET, AUTH_COOKIE_SECRET
    We recommend a randomly generated string of 32 characters length.
    MAIL_TRANSPORT_HOST, MAIL_TRANSPORT_USER, MAIL_TRANSPORT_PASS
    Set these values based on your mail server configurations.
    WEBAPP_ROOT
    Root URL of the Touca server. Can be of the form https://touca.your-company.com or http://172.129.29.29.
Now run devops/deploy.sh to deploy Touca via docker-compose.
1
~/touca/devops/deploy.sh -r <TOUCA_AWS_REPO> -u AWS
Copied!
Monitor standard output of docker containers to check that everything is running as expected:
1
docker-compose -f ~/touca/devops/docker-compose.prod.yml --project-directory ~/touca logs --follow
Copied!
At this time, you should be able to verify that Touca is up and running by navigating to your machine address on a browser.
Did we miss out a required step? We'd love to hear about your experience. Share your thoughts with [email protected].
Last modified 1mo ago