gurock / testrail-docker

Official repo for TestRail docker support.
Apache License 2.0
54 stars 35 forks source link

TestRail - let's put it in docker containers

What's in this repository?

This repo contains Dockerfiles and compose files to spawn TestRail in docker containers. The compose files rely on public available TestRail images available here.

Requirements

Quick start with script

TestRail should be accessible via: http://localhost:8000

Finish the installation through the web UI (use the values printed by installer at the end)

Running Testrail using docker-compose

The compose file is configured via environment variables -- it's suggested to use a .env file. More about such an .env file is available here.

TestRail should be accessible via: http://localhost:8000

Re-enter the values you specified in the .env file when the TestRail installer asks for the database settings. To remove the instance, press Ctrl+C and then run docker-compose down.


Running TestRail with an external DB

If you'd like to just run TestRail and use a DB hosted on another server, in the cloud, starting TestRail is simple. In this case, only docker is needed (not 'docker-compose', as mentioned above).

docker run -d --name testrail -p 8000:80 -v $PWD/_opt:/opt/testrail -v $PWD/_config:/var/www/testrail/config testrail/apache:latest

How to use the compose files

The .env file

It's suggested to create a local .env file, to specify user or machine specific variables (more see here). 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.

Optional variables are:

Pre-populated databases and TestRails 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.

The Compose Files

General usage:

docker-compose up
docker-compose down

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

Additional useful options:

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

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