Adds a puzzle-relay service (docker-compose.yml) running the same image as php but executing app:puzzle-relay instead of php-fpm, kept off the host network - only nginx can reach it. nginx proxies wss://dmtools.fvandenberg.nl/puzzle-ws/ through to it (docker/nginx/default.conf), with the public URL set via a new .env.prod. setup.sh/restart.sh now rebuild, restart, and clean up the new container alongside the existing ones. Still needs "Websockets Support" enabled on the NPM proxy host for this domain, or the upgrade headers never reach the container. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
90 lines
2.4 KiB
YAML
90 lines
2.4 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
|
|
env_file:
|
|
- path: .env
|
|
- path: .env.local
|
|
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
|
|
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:
|