game-village-politics-backend/docker-compose.yml

92 lines
3.2 KiB
YAML
Raw Permalink Normal View History

services:
# nginx + php-fpm from the base image, plus the WS server and the game:events
# worker as supervisor programs (docker/supervisor/). The repo is bind-mounted.
app:
image: 'blaxsoftware/laravel:laravel13-php8.4'
# Hostnames must be unique on the shared `web` network.
hostname: 'village-app'
env_file: .env
environment:
ENABLE_QUEUE: 'false'
ENABLE_SCHEDULER: 'false'
ENABLE_LARAVEL_PERMS: '1'
volumes:
- '.:/var/www/html'
- './docker/supervisor:/etc/supervisor/custom.d:ro'
depends_on:
- mysql
- redis
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
labels:
traefik.enable: "true"
traefik.docker.network: "web"
# nginx on the host terminates TLS with the *.blax.at wildcard cert and
# forwards plain HTTP (and WS upgrades) to traefik's `web` entrypoint.
traefik.http.routers.village-server.rule: "Host(`server-village.blax.at`) || Host(`server-village.localhost.at`)"
traefik.http.routers.village-server.entrypoints: "web"
traefik.http.routers.village-server.service: "village-server-http"
traefik.http.services.village-server-http.loadbalancer.server.port: "80"
traefik.http.routers.village-ws.rule: "Host(`ws-server-village.blax.at`) || Host(`ws-server-village.localhost.at`)"
traefik.http.routers.village-ws.entrypoints: "web"
traefik.http.routers.village-ws.service: "village-ws"
traefik.http.services.village-ws.loadbalancer.server.port: "6001"
mysql:
image: 'mysql:8.4'
# DB_HOST in .env must match.
hostname: 'mysql-village'
command: --max-connections=100
volumes:
- './docker-data/mysql:/var/lib/mysql'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_ROOT_HOST: '%'
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
expose:
- '3306'
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
interval: 5s
retries: 20
timeout: 5s
redis:
image: 'redis:alpine'
# Cache and the WS server's socket→user map only: bounded, evicting, no persistence
# (the same guard learn-atc bakes in, since this host is shared).
command:
- redis-server
- --maxmemory
- 64mb
- --maxmemory-policy
- allkeys-lru
- --save
- ""
- --appendonly
- "no"
hostname: 'redis-village'
restart: unless-stopped
expose:
- '6379'
healthcheck:
test: ["CMD", "redis-cli", "ping"]
retries: 3
timeout: 5s
networks:
default:
name: web
external: true
driver: bridge