This repository contains sources to build images for the Nitrate Test Case Management System.
In contrast to the official images provided by the Nitrate authors this repository uses a different approach:
-
All images are based on Alpine linux
-
Installation takes place using pure python pip
-
A special WSGI Middleware (WhiteNoise) is used to serve the static files
-
The Python Social Auth Backend is installed to provide a federated login.
-
The images are separated into four image parts (rather than 2 on the original item):
-
Worker: The celery worker
-
Web: The django app
-
Migrate: The database migration for applying updates
-
Setup: Create the initial database and application
-
It uses postgres by default.
-
Copy or download the docker-compose.yml from this repository.
-
Create the files
.env
,db.env
,production.env
andsetup.env
-
Create the
config.py
file.
The files should look like this:
NITRATE_VERSION=4.12
POSTGRES_VERSION=14
PYTHON_VERSION=3.10
ALPINE_VERSION=3.16
This will configure docker-compose to replace the variables in the compose file.
This file will contain the configuration for the database and will be passed to the database configuration.
include:db.env.sample[]
This will configure the worker and the web server and passed to the corresponding containers.
include:production.env.sample[]
The django configuration file.
It should contain the configuration for django, Nitrate and Python social auth.
The sample file should provide a good hint how the file can be structured:
include:config.py.sample[lines=20..-1]
After all the files are in place, run the following commands:
$ docker-compose pull (1)
...
$ docker-compose up -d (2)
...
$ docker-compose --profile setup up -d (3)
...
$ docker-compose down --remove-orphans (4)
-
Pull the images
-
Start the database container in background
-
Start the initial setup
-
Stop the composed containers
After the setup, the service can be started.
$ docker-compose --profile production up -d
...
This will start rabbitmq, celery workers django, etc. The server should now be available and operating.
The migration can take place, if a new application version is available. Update the .env
file accordingly. Check the release notes for any special operations. Create a backup of the database.
$ docker-compose down --remove-orphans. (1)
...
$ docker-compose pull
...
$ docker-compose --profile migration up -d (2)
...
$ docker-compose down --remove-orphans
...
$ docker-compose --profile production up -d
...
$ docker image prune (3)
-
will shutdown the containers.
-
The migration can take place using the migrate container
-
After the migration remove the old images