Release / build (push) Successful in 4m45s
A redeploy no longer ends the games in progress. The server writes the open rooms (players, tokens, host, and each game as its seed and moves) to $DATA_DIR/rooms.json every few seconds when something changed and once more on shutdown (SIGTERM via Ktor's shutdown hook), and loads them before it accepts connections. Clients reconnect with their saved token and get the same table back; bots wait 30 s for them after a restart. Saves older than 10 minutes are ignored, and a game the new rules cannot replay leaves the room in the lobby. The image sets DATA_DIR=/data (owned by the bela user) and the compose file mounts the bela-data named volume on it. Also fixes a flaky test: the guest ignored its first table, so the game waited forever whenever the random dealer made the guest call first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.4 KiB
YAML
43 lines
1.4 KiB
YAML
# 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"
|
|
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:
|