Skip to main content

Environment Variables

Touca server supports a variety of environment variables that help you change your deployment setup and modify the server behavior. 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.

AUTH_COOKIE_SECRETSecret to use when issuing web cookiescookiesecret
AUTH_JWT_SECRETSecret to use when generating JWT tokensjwtsecret
MINIO_PASSMinIO Password or AWS Secret Key if using S3toucapass
MINIO_USERMinIO Username or AWS Access Key ID if using S3toucauser
MONGO_URIMongo Connection String URI

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"
image: touca/touca:2.0.0
ENV_FILE: prod
- 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.

MINIO_HOSTtouca_minioAddress to MinIO server. Connects to S3 when set to
MINIO_PORT9000Port that MinIO instance is running on
MINIO_REGIONus-east-2Region for S3 Bucket when using AWS
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.

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 have been deprecated in favor of MONGO_URI. They are ignored if MONGO_URI is set.

MONGO_BASEMongoDB database name to use for Toucatouca
MONGO_HOSTAddress to MongoDB instancetouca_mongo
MONGO_PORTPort that MongoDB instance is running on27017
MONGO_PASSPassword to connect to MongoDB instancetoucapass
MONGO_USERUsername to connect to MongoDB instancetoucauser

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.

MAIL_TRANSPORT_PORTPort that SMTP/POP3 server is running on587