Files
Bela/docker-compose.yml
TMCandClaude Opus 5.5 2ab639cf12
Release / build (push) Successful in 4m41s
Docker: make a mounted /data folder writable whoever owns it
A host folder mounted on /data (owned by root, or by uid 1000) was not
writable for the server's uid 10001, so the rooms were not saved
("Permission denied"). The image now starts as root only to hand $DATA_DIR
to the bela user, then runs the server as bela via setpriv
(docker-entrypoint.sh). Started with another user (compose `user:`), it runs
as that user directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 08:53:25 +01:00

45 lines
1.6 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"
# 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: