Files
dmtools/docker-compose.yml
FrankandClaude Sonnet 5 de908d547f Fix .env.prod never reaching the puzzle relay containers
docker-compose's env_file loads .env directly into each container's
real environment - and Symfony's Dotenv never lets a .env.$APP_ENV
file override a variable the platform already set. Since .env.prod
was never in the env_file list, PUZZLE_RELAY_PUBLIC_URL kept resolving
to the dev default (ws://127.0.0.1:8091) in production instead of the
wss://dmtools.fvandenberg.nl/puzzle-ws/ override. Load .env.prod here
too, after .env/.env.local, so its values actually win.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 13:43:04 +02:00

99 lines
2.9 KiB
YAML

# dmtools stack - servers only (testing + live). Not used locally.
#
# Reached through Nginx Proxy Manager, which terminates TLS for
# dmtools.fvandenberg.nl and forwards to the `nginx` container by name.
# NPM is not on a shared proxy network here - it is connected to each
# stack's own default network by hand. After the first `up`, run once:
#
# docker network connect dmtools_default nginx_app_1
#
# (NPM keeps that connection across restarts; only needed again after a
# `docker compose down` removes the network.)
#
# Published host ports are bound to loopback for local curl / DB-client
# access on the server itself.
#
# Bring up with docker/setup.sh (pins the compose project name to `dmtools`).
services:
php:
build:
context: .
dockerfile: docker/php/Dockerfile
container_name: dmtools-php
# Real container env vars always beat Symfony's own .env.$APP_ENV cascade
# (that's the point of Dotenv - it never overrides a var the platform
# already set) - so .env.prod has to be loaded here too, or its values
# (e.g. PUZZLE_RELAY_PUBLIC_URL) never reach the app; the plain .env
# default silently wins instead. Order matters: later files win.
env_file:
- path: .env
- path: .env.local
required: false
- path: .env.prod
required: false
volumes:
- .:/var/www/html:cached
- php_var:/var/www/html/var
depends_on:
database:
condition: service_healthy
restart: unless-stopped
puzzle-relay:
build:
context: .
dockerfile: docker/php/Dockerfile
container_name: dmtools-puzzle-relay
command: ["php", "bin/console", "app:puzzle-relay"]
env_file:
- path: .env
- path: .env.local
required: false
- path: .env.prod
required: false
volumes:
- .:/var/www/html:cached
- php_var:/var/www/html/var
restart: unless-stopped
nginx:
image: nginx:1.30-alpine
container_name: dmtools-nginx
ports:
- "127.0.0.1:${NGINX_PORT:-8085}:80"
volumes:
- .:/var/www/html:ro
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php
- puzzle-relay
restart: unless-stopped
database:
image: mariadb:12.3
container_name: dmtools-db
environment:
MARIADB_DATABASE: ${DB_NAME:-dmtools}
MARIADB_USER: ${DB_USER:-dmtools}
MARIADB_PASSWORD: ${DB_PASSWORD:-ChangeMe}
MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-ChangeMeRoot}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
ports:
- "127.0.0.1:${DB_HOST_PORT:-3310}:3306"
volumes:
- database_data:/var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
restart: unless-stopped
volumes:
database_data:
php_var: