Skip to main content

Environment Variables

If you are self-hosting Touca, you may be using our Docker compose file, directly or indirectly through our install.sh script. This simple setup is tailored for use by individuals and small engineering teams. It sets up an instance of the Touca server connected to its service dependencies like MinIO, MongoDB, and Redis. The server supports a variety of environment variables that help you change this deployment setup and make it more production-ready. This document lists all the supported environment variables for your reference.

Common variables

The following environment variables are secrets used by the Touca server to connect to its services. While they all have a default value, we recommend that you set them to a different value when setting up a production instance.

VariableDefaultPurpose
AUTH_COOKIE_SECRETcookiesecretSecret to use when issuing web cookies
AUTH_JWT_SECRETjwtsecretSecret to use when generating JWT tokens
MINIO_PASStoucapassMinIO Password or AWS Secret Key if using S3
MINIO_USERtoucauserMinIO Username or AWS Access Key ID if using S3
MONGO_PASStoucapassPassword to connect to MongoDB instance
MONGO_USERtoucauserUsername to connect to MongoDB instance

To reconfigure the Touca server with different values for these environment variables, you can stop any running containers, modify the docker-compose file, and restart them. Here is a sample configuration for passing AUTH_JWT_SECRET to touca_touca:

version: "3"
services:
touca_touca:
image: touca/touca:1.8.0
environment:
ENV_FILE: prod
AUTH_JWT_SECRET: <SET YOUR SECRET HERE>
depends_on:
- touca_minio
- touca_mongo
- touca_redis
restart: always

Connecting to other services

In the most common deployment scenarios, the above environment variables are all that you need to set to make Touca working as you expect. But there are more configuration parameters that you can set via environment variables, depending on your deployment setup.

VariableDefaultPurpose
MINIO_HOSTtouca_minioAddress to MinIO server. Connects to S3 when set to s3.amazonaws.com
MINIO_PORT9000Port that MinIO instance is running on
MINIO_REGIONus-east-2Region for S3 Bucket when using AWS
MONGO_BASEtoucaMongoDB database name to use for Touca
MONGO_HOSTtouca_mongoAddress to MongoDB instance
MONGO_PORT27017Port that MongoDB instance is running on
REDIS_BASEtoucaName of the base to use when connecting to the Redis instance
REDIS_HOSTtouca_redisAddress to Redis instance
REDIS_PORT6379Port that Redis instance is running on
WEBAPP_ROOThttp://localhostAddress to Touca web UI used for building URLs to submitted test results

Other supported variables

Touca server also supports the following environment variables. It is very rare that you'd need to set them to a value different than their default value.

VariableDefault
EXPRESS_PORT8080Port that Touca server should be running on
EXPRESS_ROOT/apiURL prefix of Touca server API
SAMPLES_DIRsamplesDirectory where sample test results are stored
SAMPLES_ENABLED"true"Whether to create a sample Tutorial team for each user account
CACHE_DURATION_LONG30 minutesDuration to cache API endpoint responses that barely change
CACHE_DURATION_SHORT1 minuteDuration to cache API endpoint responses temporarily
REDIS_TLS_CERT_FILEPath to TLS Certificate file to use when connecting to the Redis instance
MONGO_TLS_CERT_FILEPath to TLS Certificate file to use when connecting to the Mongo instance
MAIL_TEMPLATE_DIR/opt/touca/api/dist/templatesDirectory where email template files are stored
LOG_DIRDirectory where log files should be stored
NODE_ENVproductionNode runtime mode
LOG_LEVELinfoLevel of detail to use when logging server events
SERVICE_ANALYTICS_CHECK_INTERVAL30 secondsDuration in seconds after which the analytics service should re-run
SERVICE_AUTOSEAL_CHECK_INTERVAL1 minuteDuration in seconds after which the auto-seal service should re-run
SERVICE_AUTOSEAL_DEFAULT_DURATION10 minutesDuration in seconds after the test results for a given version is submitted until they are sealed
SERVICE_REPORTING_CHECK_INTERVAL5 minutesDuration in seconds after which the reporting service should re-run
SERVICE_RETENTION_CHECK_INTERVAL30 minutesDuration in seconds after which the data retention service should re-run
SERVICE_RETENTION_DEFAULT_DURATION2 yearsDuration in seconds after which the submitted test results for a given version are removed from the server
SERVICE_RETENTION_DEFAULT_RESULT_LIFETIME30 daysDuration in seconds to wait before removing a given comparison results
SERVICE_TELEMETRY_CHECK_INTERVAL30 minutesDuration in seconds after which the telemetry service should re-run
SERVICE_TELEMETRY_DEFAULT_DURATION1 dayDuration in seconds to wait after a submitted telemetry report until another report is submitted
WEBAPP_DIST_DIRECTORY/opt/touca/app/distPath to Touca Web App static files

Deprecated variables

These environment variables for SMPT/POP3 server have been deprecated and may be removed in future versions of the Touca server. We recommend that you switch to using the Mail Transport tab of the Server Settings page for setting up the mail server.

VariablePurposeDefault
MAIL_TRANSPORT_HOSTAddress to SMTP/POP3 server
MAIL_TRANSPORT_PORTPort that SMTP/POP3 server is running on587
MAIL_TRANSPORT_USERUsername to SMTP/POP3 instance
MAIL_TRANSPORT_PASSPassword to SMTP/POP3 instance