Installation on Docker: Compose files

Environment variables

It’s suggested to create a local .env file, to specify user- or machine-specific variables (for more information, see the Docker env files documentation). The syntax is simple: e.g. ‘HTTP_PORT=8000’

Environment variables can also be set directly in the shell with the same syntax and then using docker-compose.

  • DB_PORT
  • HTTP_PORT
  • HTTPS_PORT
  • DB_URL (e.g. http://internal.yourcompany.com/5.7.sql)

Pre-populated databases and TestRail’s config.php

Via the DB_URL variable, it’s also possible to provide a SQL-dump to be downloaded by the container, so TestRail is already pre-configured. For proper functionality, the config.php file needs to be provided. Simply copy it into the _config folder. Ensure that the values in the config.php file match the database settings for user and password, which are specified in the compose file for the db.

Using Compose files

General usage

docker-compose up
docker-compose down

The argument up starts the container; while down stops everything. The docker-compose CLI reference can be found here.

Additional useful options:

Option Description
-v (remove named volumes)  This is important to remove temporary volumes after shutdown and is recommended to be used. If the volumes should not be purged, don’t use this parameter. However, be aware that this might still cause some side effects.
-f (file) Can be used to specify a different compose file (by default docker-compose.yml is used)
-p (project) Required if multiple TestRail instances should be started. Otherwise, docker-compose will interact with an already running container.

The name of the folder docker-compose is started in (in this case, ‘internal-docker’) is used as a project name and is prepended to all spawned containers.

Recommendation: Use docker-compose down -v, as it removes named and anonymous volumes!

General remarks on the compose files

  • All compose files rely on additional volumes:
  • testrail_root contains the installation and gets mounted to /var/www/testrail
  • testrail_opt contains uploaded files etc. and gets mounted to /opt/testrail
  • testrail_db contains the database and gets mounted to /var/lib/mysql.
  • testrail_config contains the config.php file, which configures TestRail and is mounted to /var/www/testrail/config

Containers are connected though a testrail bridged network. Start-order is important – php needs to be first, followed by webserver and DB.

Was this article helpful?
0 out of 5 found this helpful