Files
security-command.org/deploy/compose.yml
T

115 lines
3.3 KiB
YAML

name: security-command
services:
spawner:
image: ${SPAWNER_IMAGE:?run deploy.sh}
restart: unless-stopped
# 10100 is the group shared with the backend for the spawner socket.
user: "10001:10100"
group_add:
- "${SANDBOX_GROUP_ID:?run deploy.sh}"
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
network_mode: none
mem_limit: 128m
pids_limit: 64
environment:
SANDBOX_IMAGE: ${SANDBOX_IMAGE:?run deploy.sh}
CONTENT_DIR: ${CONTENT_DIR:?set CONTENT_DIR in .env}
STATUS_DIR: ${STATUS_DIR:?run deploy.sh}
volumes:
- /run/docker-sandbox/docker.sock:/run/docker-sandbox/docker.sock
- ./runtime/spawner:/run/spawner
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"
backend:
image: ${BACKEND_IMAGE:?run deploy.sh}
restart: unless-stopped
user: "10002:10002"
group_add:
- "10100"
read_only: true
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
mem_limit: 256m
pids_limit: 128
depends_on: [spawner]
ports:
- "127.0.0.1:${BACKEND_PORT:-8380}:8080"
- "127.0.0.1:${METRICS_PORT:-9380}:9090"
environment:
SPAWNER_SOCKET: /run/spawner/spawner.sock
STATUS_DIR: /run/status
CONTENT_DIR: /content
JOBS_FILE: /config/jobs.toml
TRIGGER_DIR: /run/jobs/triggers
SITE_URL: ${SITE_URL:-https://security-command.org}
LEGAL_PAGES: ${LEGAL_PAGES-impressum/imprint:impressum.md,datenschutz/privacy:datenschutz.md}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-https://security-command.org}
MAX_SESSIONS: ${MAX_SESSIONS:-12}
MAX_QUEUE: ${MAX_QUEUE:-20}
POW_DIFFICULTY: ${POW_DIFFICULTY:-20}
volumes:
- ./runtime/spawner:/run/spawner
- ./runtime/status:/run/status
- ${CONTENT_DIR}:/content:ro
- ./config:/config:ro
- ./runtime/jobs/triggers:/run/jobs/triggers:ro
# Healthy means the backend serves and reaches the spawner.
healthcheck:
test: ["CMD", "wget", "-q", "-O", "/dev/null", "http://127.0.0.1:8080/healthz"]
interval: 30s
timeout: 5s
retries: 3
start_period: 30s
start_interval: 2s
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"
jobs:
image: ${JOBS_IMAGE:?run deploy.sh}
restart: unless-stopped
# Jobs run as the owner of the content directory, so they can write into it.
user: "${JOBS_USER:?run deploy.sh}"
init: true
read_only: true
tmpfs:
- /tmp:size=64m
cap_drop: [ALL]
security_opt: [no-new-privileges:true]
mem_limit: 256m
pids_limit: 128
environment:
JOBS_FILE: /config/jobs.toml
SCRIPTS_DIR: /jobs
CONTENT_DIR: /content
HOST_DIR: /host/srv
TRIGGER_DIR: /run/jobs/triggers
CONTROL_SOCKET: /run/jobs/control.sock
volumes:
- ${CONTENT_DIR}:/content
- ./config:/config
- ./jobs:/jobs:ro
- ${JOBS_HOST_DIR:-/srv}:/host/srv:ro
- ./runtime/jobs:/run/jobs
healthcheck:
test: ["CMD", "jobctl", "list"]
interval: 60s
timeout: 5s
retries: 3
start_period: 30s
start_interval: 2s
logging:
driver: json-file
options:
max-size: 10m
max-file: "3"