Skip to content

Docker Deployment

The backend deployment uses Docker Compose with 6 services. This is the recommended way to run the full stack.

# Simplified view of docker-compose.yml
services:
redis: # Celery broker + result backend
postgresql: # Primary database
yaptide_flask: # Flask API server
yaptide_simulation_worker: # Celery simulation worker
yaptide_helper_worker: # Celery helper worker
nginx: # Reverse proxy with TLS
ServiceImagePortRole
redisredis:8-alpine6379 (internal)Celery message broker and result backend
postgresqlpostgres:16-alpine5432 (internal)Primary database, persisted via named volume
yaptide_flaskDockerfile-flask6000 (internal)Flask API server
yaptide_simulation_workerDockerfile-simulation-workerRuns simulator binaries via Celery
yaptide_helper_workerDockerfile-helper-workerBatch job submission and cleanup via Celery
nginxDockerfile-nginx5000, 8443Reverse proxy with TLS termination
PortProtocolService
5000HTTPNginx → Flask API
8443HTTPSNginx → Flask API (TLS)
Terminal window
cd yaptide
docker compose up --build -d

Wait for all services to be healthy:

Terminal window
docker compose ps

Create a user:

Terminal window
docker compose exec yaptide_flask python -m yaptide.admin.db_manage add-user \
--username admin --password admin123
Terminal window
docker compose up --build -d

Faster healthcheck intervals for quicker startup feedback:

Terminal window
docker compose -f docker-compose.yml -f docker-compose.fast.yml up --build -d

Requires Docker Engine v25+ for the fast healthcheck start_interval option.

Adds a pgAdmin instance on port 9999:

Terminal window
docker compose -f docker-compose.yml -f docker-compose-develop.yml up --build -d

Access pgAdmin at http://localhost:9999 with:

  • Email: admin@admin.com
  • Password: admin

Connect to PostgreSQL using:

  • Host: postgresql
  • Port: 5432
  • Database: yaptide
  • Username/Password: from POSTGRES_USER/POSTGRES_PASSWORD env vars

Set these in a .env file in the yaptide/ root or pass them via Docker:

VariableDefaultDescription
POSTGRES_DByaptideDatabase name
POSTGRES_USERyaptideDatabase username
POSTGRES_PASSWORDyaptideDatabase password
VariableDefaultDescription
FLASK_SQLALCHEMY_DATABASE_URI(derived)Full PostgreSQL connection string
CELERY_BROKER_URLredis://redis:6379/0Redis broker URL
CELERY_RESULT_BACKENDredis://redis:6379/0Redis result backend
BACKEND_INTERNAL_URLhttp://yaptide_flask:6000Internal URL for worker → Flask
BACKEND_EXTERNAL_URLhttps://localhost:8443Public-facing URL
MAX_CORES(all)CPU limit for simulation worker
LOG_LEVEL_ROOTINFOLogging verbosity
VariableDescription
KEYCLOAK_BASE_URLKeycloak server URL
KEYCLOAK_REALMKeycloak realm
CERT_AUTH_URLPLGrid cert-auth service URL
VariableDescription
S3_ENDPOINTS3-compatible endpoint
S3_ACCESS_KEYS3 access key
S3_SECRET_KEYS3 secret key
S3_ENCRYPTION_PASSWORDBinary encryption password
S3_ENCRYPTION_SALTBinary encryption salt
S3_SHIELDHIT_BUCKET / S3_SHIELDHIT_KEYSHIELD-HIT12A binary location
S3_FLUKA_BUCKET / S3_FLUKA_KEYFLUKA binary location
S3_TOPAS_BUCKET / S3_TOPAS_KEYTOPAS binary location

Nginx is configured with self-signed TLS certificates for development. The Dockerfile-nginx generates certificates at build time.

nginx.conf excerpt:
listen 8443 ssl;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;

For production, replace the self-signed certificates with real ones:

  • Mount certificates via Docker volumes
  • Or use a reverse proxy like Traefik or Caddy in front of Nginx

The PostgreSQL data is stored in a named Docker volume (postgres_data). This survives docker compose down but is removed with docker compose down -v.

To completely reset the database: docker compose down -v && docker compose up --build -d

Pre-built images are published to GitHub Container Registry (GHCR).

  • On push to main: images are tagged with the Git SHA and latest
  • On tag push (v*): images are tagged with the version number
Terminal window
docker pull ghcr.io/yaptide/yaptide-flask:latest
docker pull ghcr.io/yaptide/yaptide-simulation-worker:latest
docker pull ghcr.io/yaptide/yaptide-helper-worker:latest
docker pull ghcr.io/yaptide/yaptide-nginx:latest
  • latest and versioned tags: kept indefinitely
  • SHA-tagged images: cleaned up after 30 days
  • Untagged images: cleaned up weekly