docker: make the stack multi-instance so a test.escapepage.com copy can run alongside prod
compose.yaml / compose.override.yaml:
- container_name is now ${STACK_NAME:-escapepage}-* (STACK_NAME is a plain var,
not COMPOSE_PROJECT_NAME, so prod keeps its escapepage-* names with no config change)
- every published host port is ${*_PORT:-<current default>}, so prod is unchanged
and a second stack can bind its own (localhost-only) ports
- nginx joins the external nginx_default network so Nginx Proxy Manager can
forward to <stack>-nginx by name
restart.sh:
- scoped to STACK_NAME / COMPOSE_PROJECT_NAME read from docker/.env, so running it
from the test checkout can't touch the prod stack
- host-wide `docker system prune` / `docker builder prune` moved behind --prune-all
Adds docker/.env.test.example and doc/test-environment.md (separate checkout,
env layers, NPM proxy host + Access List IP allowlist, Mercure on test).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
+26
-15
@@ -1,5 +1,14 @@
|
||||
version: '3.7'
|
||||
|
||||
# This stack can run more than once on the same host (e.g. production + a
|
||||
# test.escapepage.com staging copy). Everything that must be unique per instance
|
||||
# comes from docker/.env:
|
||||
# STACK_NAME -> container name prefix (default: escapepage)
|
||||
# COMPOSE_PROJECT_NAME -> compose project / network namespace
|
||||
# NGINX_HTTP_PORT etc. -> published host ports
|
||||
# With no docker/.env overrides it behaves exactly as before: containers
|
||||
# escapepage-*, ports 8080/8443/3306/8090/8025.
|
||||
|
||||
services:
|
||||
php:
|
||||
build:
|
||||
@@ -8,7 +17,7 @@ services:
|
||||
args:
|
||||
USER_ID: ${USER_ID}
|
||||
GROUP_ID: ${GROUP_ID}
|
||||
container_name: escapepage-php
|
||||
container_name: ${STACK_NAME:-escapepage}-php
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
@@ -40,7 +49,7 @@ services:
|
||||
args:
|
||||
USER_ID: ${USER_ID}
|
||||
GROUP_ID: ${GROUP_ID}
|
||||
container_name: escapepage-php-worker
|
||||
container_name: ${STACK_NAME:-escapepage}-php-worker
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
@@ -73,7 +82,7 @@ services:
|
||||
args:
|
||||
USER_ID: ${USER_ID}
|
||||
GROUP_ID: ${GROUP_ID}
|
||||
container_name: escapepage-php-cron
|
||||
container_name: ${STACK_NAME:-escapepage}-php-cron
|
||||
volumes:
|
||||
- ../:/var/www/html:delegated
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
@@ -101,10 +110,10 @@ services:
|
||||
|
||||
nginx:
|
||||
image: nginx:1.29.4-alpine
|
||||
container_name: escapepage-nginx
|
||||
container_name: ${STACK_NAME:-escapepage}-nginx
|
||||
ports:
|
||||
- "8080:80"
|
||||
- "8443:443"
|
||||
- "${NGINX_HTTP_PORT:-8080}:80"
|
||||
- "${NGINX_HTTPS_PORT:-8443}:443"
|
||||
volumes:
|
||||
- ../:/var/www/html:ro
|
||||
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||
@@ -112,16 +121,18 @@ services:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
depends_on:
|
||||
- php
|
||||
# networks:
|
||||
# backend:
|
||||
# ipv4_address: 172.23.0.12
|
||||
# Joined to the Nginx Proxy Manager network so NPM can forward straight to
|
||||
# "<project>-nginx" without going back out to a published host port.
|
||||
networks:
|
||||
- default
|
||||
- nginx_proxy
|
||||
restart: unless-stopped
|
||||
|
||||
mailer:
|
||||
image: axllent/mailpit:latest
|
||||
container_name: escapepage-mailer
|
||||
container_name: ${STACK_NAME:-escapepage}-mailer
|
||||
ports:
|
||||
- "8025:8025"
|
||||
- "${MAILPIT_UI_PORT:-8025}:8025"
|
||||
volumes:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
networks:
|
||||
@@ -131,7 +142,7 @@ services:
|
||||
|
||||
mercure:
|
||||
image: dunglas/mercure:v0.21
|
||||
container_name: escapepage-mercure
|
||||
container_name: ${STACK_NAME:-escapepage}-mercure
|
||||
environment:
|
||||
SERVER_NAME: "http://:80"
|
||||
MERCURE_PUBLISHER_JWT_KEY: ${MERCURE_JWT_SECRET}
|
||||
@@ -143,7 +154,7 @@ services:
|
||||
publish_origins ${MERCURE_CORS_ALLOWED_ORIGINS}
|
||||
anonymous
|
||||
ports:
|
||||
- "8090:80"
|
||||
- "${MERCURE_HTTP_PORT:-8090}:80"
|
||||
volumes:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
networks:
|
||||
@@ -154,7 +165,7 @@ services:
|
||||
###> doctrine/doctrine-bundle ###
|
||||
database:
|
||||
image: mysql:8.0
|
||||
container_name: escapepage-db
|
||||
container_name: ${STACK_NAME:-escapepage}-db
|
||||
environment:
|
||||
MYSQL_DATABASE: ${DB_NAME}
|
||||
MYSQL_USER: ${DB_USER}
|
||||
@@ -173,7 +184,7 @@ services:
|
||||
- /etc/hosts:/etc/hosts:ro
|
||||
# Uncomment the two lines below if you need to access MySQL from your host (workbench, etc.)
|
||||
ports:
|
||||
- "3306:3306"
|
||||
- "${DB_HOST_PORT:-3306}:3306"
|
||||
# networks:
|
||||
# backend:
|
||||
# ipv4_address: 172.23.0.15
|
||||
|
||||
Reference in New Issue
Block a user