This repo contains a backend for the Autotester project that runs in Docker.
Tests are run within docker containers in the /
Install the required python packages using pip
python3 -m pip install -r requirements.txt
The backend can be configured by starting up the worker containers with the following environment variables set:
- REDIS_URL
- Url of the redis database. This should be the same url set for the autotest API or else the two cannot communicate
- REGISTRY_URL
- optional URL of a docker registry used to store images created by this backend. If not set, images will be stored locally only.
- see the registry documentation for more details
- VOLUME_DRIVER
- optional volume driver type used when creating volumes. Default=local.
- see the volume documentation for more details
- VOLUME_DRIVER_OPTS
- optional json string containing volume driver options.
- see the driver_opts example for more details on how to structure the json string.
- see the bind mount documentation for more details
These environment variable values can be set in the services.backend-*.environment
list in docker-compose.yml
The number of worker containers can be adjusted by changing the replicas
value in docker-compose.yml
. The larger the
replicas
value, the more tests can be run simultaneously. Make sure to not set this value so high that it overtaxes
the resources of your machine.
docker compose up -d backend-dev
docker compose up -d backend-prod
This backend requires that the docker socket file be mounted to the worker containers so that they can access the docker engine to create other docker artifacts used to run tests.
If you search the internet you will find many websites discussing why mounting the docker socket to a container is a security risk. In the context of this project, it allows the worker containers to run processes as root on the host machine.
If this is not something you are comfortable with, we recommend running docker in rootless mode in order to mitigate some of the risks involved.