tests/docker-compose.yml
# docker-compose configuration to build a local development installation of the websecmap platform.
version: "3"
services:
# message broker to distribute tasks
broker:
image: redis
stop_signal: KILL # tests run in ephemeral container, no need to wait for clean shutdown
logging: {driver: none}
# Not configuring persistent storage for broker. Restarting will cause all unfinished
# tasks to be forgotten, instead of lingering around.
ports:
- 6379
# stateful storage
database:
# latest mysql (8.x) causes errors, pin until these can be investigated
# error: "Authentication plugin 'caching_sha2_password' cannot be loaded
image: mysql:5
stop_signal: KILL # tests run in ephemeral container, no need to wait for clean shutdown
logging: {driver: none}
environment:
MYSQL_ALLOW_EMPTY_PASSWORD:
MYSQL_ROOT_PASSWORD: "${DB_ROOT_PASSWORD:-secret}"
MYSQL_DATABASE: "${DB_NAME:-failmap}"
MYSQL_USER: "${DB_USER:-failmap}"
MYSQL_PASSWORD: "${DB_PASSWORD:-failmap}"
ports:
- 3306
command:
# make sure a sane character set and collation are used
- --character-set-server=utf8
- --collation-server=utf8_general_ci
# Configure database to persist accross restarts of the development environment.
volumes:
# overwrite memory hungry default config for docker mysql
- ./etc/mysql-minimal-memory.cnf:/etc/mysql/conf.d/mysql.cnf
# task executer
worker:
image: "${IMAGE:-websecmap/websecmap:latest}"
stop_signal: KILL # tests run in ephemeral container, no need to wait for clean shutdown
links:
- broker
- database:mysql
# celery dislikes running as root
user: nobody
environment:
BROKER: redis://broker:6379/0
DJANGO_DATABASE: production
# let celery be a little more informative regarding console messages
TERM: xterm-color
command: [ "celery", "worker", "-l", "info", "--pool", "eventlet"]
# web interfaces
admin:
image: "${IMAGE:-websecmap/websecmap:latest}"
stop_signal: KILL # tests run in ephemeral container, no need to wait for clean shutdown
links:
- broker
- database:mysql
environment:
BROKER: redis://broker:6379/0
ALLOWED_HOSTS: "${ALLOWED_HOSTS:-localhost,127.0.0.1,::1}"
DJANGO_DATABASE: production
# django decides what to log based on type of console
TERM: xterm-color
ports:
- "8000"
volumes:
- ../websecmap:/source/websecmap
command: production --migrate --loaddata development_user
frontend:
image: "${IMAGE:-websecmap/websecmap:latest}"
stop_signal: KILL # tests run in ephemeral container, no need to wait for clean shutdown
links:
- broker
- database:mysql
environment:
ALLOWED_HOSTS: "${ALLOWED_HOSTS:-localhost,127.0.0.1,::1}"
DJANGO_DATABASE: production
UWSGI_PYTHON_AUTORELOAD: "no"
# django decides what to log based on type of console
TERM: xterm-color
SERVICE_NAME: websecmap-frontend
APPLICATION_MODE: frontend
ports:
- "8000"
command: production