# Bela — single-container deployment at bela.mariosem.es. # One image serves the web app and runs the game server (online rooms over WebSocket /ws). External # ingress/TLS is handled outside this compose: route https://bela.mariosem.es to this port and allow # WebSocket upgrades on /ws. # # Restarts and new releases do not end games: the server saves the open rooms to /data (the bela-data # volume) while it runs and when it stops, and loads them on start; players reconnect to their seats # within a few seconds. Without the volume, a restart ends the games in progress. # # Deploy: `docker compose pull && docker compose up -d` (the image is built and published to the Gitea # registry by .gitea/workflows/release.yml). To build locally instead: # `docker build -t git.mariosem.es/msemes/bela:latest .`. services: bela: image: git.mariosem.es/msemes/bela:latest restart: unless-stopped init: true mem_limit: 512m cpus: 1.0 logging: driver: json-file options: max-size: "10m" max-file: "3" # Time to save the rooms on `docker compose down` or a redeploy (it takes well under a second). stop_grace_period: 15s environment: PORT: "8080" # Or a host folder (e.g. ./data:/data), owned by anyone: the container hands it to its bela user # (uid 10001) on start. With `user: "1000:1000"` set here, the folder must be writable for that user. volumes: - bela-data:/data ports: - "${PORT:-8080}:8080" healthcheck: test: ["CMD", "curl", "-fsS", "http://localhost:8080/health"] interval: 30s timeout: 5s retries: 5 start_period: 20s volumes: bela-data: