# On-premise installation

> Deploy the Testsigma containers from the compose file, configure a custom domain, verify the installation, and troubleshoot access.

Installation runs from a `docker-compose.yml` file Testsigma builds for your configuration. It defines a MySQL server, a global HTTPD load balancer, a Faktory worker, and a UI service per application component. See [On-premise prerequisites](https://testsigma.com/docs/v2/on-prem/prerequisites/) for what the host needs before you start.

## Deploy the containers

1. Install **Docker** and **Docker Compose** on the host.

2. Open a terminal in the directory holding the `docker-compose.yml` file Testsigma gave you.

3. Run `docker-compose up`.

The containers start in the background and keep running after you close the terminal.

To stop and remove them, along with the networks the file created, run `docker-compose down`.

## What the compose file defines

Every image follows the pattern `testsigmainc/onprem:--trial-`.

| Container | What it is |
|---|---|
| `testsigma_mysql` | The MySQL server, with a volume mounted so data persists |
| `testsigma_worker` | The Faktory worker service |
| `testsigma_load_balancer` | The global HTTPD server, with a mounted volume and environment variables for the components it serves |
| `testsigma_id_server_ui` | The Identity Server UI |
| `testsigma_app_server_ui` | The WebApp Server UI, pre-configured for hosting web applications and capturing screenshots |
| `testsigma_mobile_inspection_ui` | The Groot Server UI, which carries an environment variable for a driver action host |
| `testsigma_addon_server_ui` | The Kibbutz UI |
| `testsigma_visual_testing_server` | Visual testing, pre-configured for capturing and comparing screenshots during execution |

The compose file also runs the backend servers each UI talks to: `testsigma_id_server`, `testsigma_app_server`, `testsigma_addon_server`, and `testsigma_audit_server`, along with `testsigma_audit_ui`. Their ports are in [On-premise prerequisites](https://testsigma.com/docs/v2/on-prem/prerequisites/#ports).

Every service joins a custom network named `testsigma-network`, and each has its own health check, with intervals, timeouts, and retries that vary by service.

You can run your own MySQL server instead of the container, and map it in the compose file.

### Default load balancer environment variables

```text
TS_APP_SERVER_PROTOCOL: https
TS_APP_SERVER_HOST: testsigma-app-server
TS_APP_SERVER_PORT: 8080
TS_APP_SERVER_UI_PROTOCOL: http
TS_APP_SERVER_UI_HOST: testsigma-app-server-ui
TS_APP_SERVER_UI_PORT: 80
TS_ID_SERVER_PROTOCOL: https
TS_ID_SERVER_HOST: testsigma-id-server
TS_ID_SERVER_PORT: 8084
TS_ID_SERVER_UI_PROTOCOL: http
TS_ID_SERVER_UI_HOST: testsigma-id-server-ui
TS_ID_SERVER_UI_PORT: 80
TS_MOBILE_INSPECTION_UI_PROTOCOL: http
TS_MOBILE_INSPECTION_UI_HOST: testsigma-mobile-inspection-ui
TS_MOBILE_INSPECTION_UI_PORT: 80
TS_ADDON_SERVER_PROTOCOL: https
TS_ADDON_SERVER_HOST: testsigma-addon-server
TS_ADDON_SERVER_PORT: 8082
TS_ADDON_SERVER_UI_PROTOCOL: http
TS_ADDON_SERVER_UI_HOST: testsigma-addon-server-ui
TS_ADDON_SERVER_UI_PORT: 80
```

## Access the application

Testsigma sends a list of URLs with the compose files, in the form `-testsigmaprivate.com`, `-addon.testsigmaprivate.com`, and `-visualtesting.testsigmaprivate.com`.

Add the mapping to the host machine's `hosts` file. Then reach the application at your server's IP address and the port the compose file exposes for the web service. Where that port is 80, the address is `http://:80`.

## Configure a custom domain

Have the URL details and `.crt` certificates ready before you start. See [On-premise prerequisites](https://testsigma.com/docs/v2/on-prem/prerequisites/#domain-name).

1. Request the Docker image with your domain names from Testsigma, through GitHub Actions.

2. Store the public key and private key files on the host machine.

3. Specify both as volumes on the `testsigma_load_balancer` container in the compose file.

4. Run `docker-compose up`. The `server.crt` and `server.key` files inside the container are replaced by the ones from the host.

```yaml
version: '3.9'
services:
  testsigma_load_balancer:
    container_name: testsigma-load-balancer
    image: testsigmainc/onprem:load-balancer-<CustomDomain>-trial-v120
    ports:
      - "443:443"
    networks:
      - testsigma-network
    volumes:
      - ./data/ts_load_balancer_data:/opt/app/ts_load_balancer_data
      - /path/to/new/server.crt:/usr/local/apache2/ssl/server.crt
      - /path/to/new/server.key:/usr/local/apache2/ssl/server.key
```

Replace `/path/to/new/server.crt` and `/path/to/new/server.key` with the paths on your host machine.

## Verify the installation

Once the containers are up, confirm each of these:

1. The recorder captures actions during testing.
2. Auto Healing is enabled and recovers from errors as expected.
3. The import add-on is integrated and functioning.
4. Users can log in with the default password and reach the system.
5. Users can reset that password and log in with the new one.
6. The agent is active and communicating with the testing environment.
7. A test case executes and returns results.
8. The SMTP setup for email is configured.
9. Screenshots appear in execution reports.
10. No emails arrive from Testsigma cloud, which means the property is not set to cloud.

## After an upgrade

1. Stop the old agent and confirm it is no longer active.

2. Hard refresh the application with **Ctrl+Shift+R** to clear cached data.

3. Download the latest agent from the application.

4. Extract the download and start the updated agent.

5. Check the agent's status and version number.

## Troubleshooting

### The application is not accessible

The host mapping is missing. Open `/etc/hosts` on the server and add a ` ` pair for each service:

```text
192.168.0.1 dev.testsigmaprivate.com
192.168.0.1 dev-id.testsigmaprivate.com
192.168.0.1 dev-addon.testsigmaprivate.com
192.168.0.1 dev-visualtesting.testsigmaprivate.com
192.168.0.1 dev-audit.testsigmaprivate.com
192.168.0.1 dev-mobilerecorder.testsigmaprivate.com
```

### The server refused to connect

Connect to the server machine, go to the Testsigma installation folder, and run `docker ps -a`. Every container should read Up.

Where one reads Exited, read its logs to find the reason, then restart it with `docker compose up -d`. If the problem persists, contact support@testsigma.com.

### Read a container's logs

Run `docker logs -f testsigma-app-server`, substituting the container you want. Press **Ctrl + C** to leave the log view.

To send logs to Testsigma, copy them out of the container first, then pull them off the server and email them to support@testsigma.com:

```bash
docker cp testsigma-app-server:/opt/logs <destination_location>/
```

### A domain does not resolve

Find the IP address behind the domain with `dig`, or with `nslookup`:

```bash
dig app-testsigma.de.yourcompany.com
```

Then check the connection to that address on port 443:

```bash
nc -vz 18.215.41.231 443
```

If the connection succeeds but the application still does not load, check the HTTP response, passing the domain as the `Host` header so the load balancer routes the request:

```bash
curl -H "Host: http://app.testsigma.com" http://52.1.167.174:80/
```
