Fix db host-port collision: separate DB_HOST_PORT from the internal port

DB_PORT was doing double duty - the container-internal port baked into
DATABASE_URL (must be 3306) and the host-published port in
docker-compose.yml. Setting it to 3306 for the URL made compose try to
publish host :3306, which collides with another stack's MySQL.

DATABASE_URL now hardcodes database:3306 (always correct inside the
compose network); the host publish uses ${DB_HOST_PORT:-3310}.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-09-06 21:07:51 +02:00
co-authored by Claude Sonnet 5
parent ade11494be
commit 25b68cb1df
4 changed files with 13 additions and 12 deletions
+2 -2
View File
@@ -16,12 +16,12 @@ set -euo pipefail
# ./docker/setup.sh --down # stop and remove containers
#
# NGINX_PORT=8086 ./docker/setup.sh # if 8085 is already taken on this host
# (or set NGINX_PORT / DB_PORT once in .env.local and every run picks it up)
# (or set NGINX_PORT / DB_HOST_PORT once in .env.local and every run picks it up)
ROOT_DIR=$(cd "$(dirname "$0")"/.. && pwd)
PROJECT=dmtools
for var in NGINX_PORT DB_PORT; do
for var in NGINX_PORT DB_HOST_PORT; do
if [ -z "${!var:-}" ] && grep -q "^${var}=" "$ROOT_DIR/.env.local" 2>/dev/null; then
export "$var=$(grep "^${var}=" "$ROOT_DIR/.env.local" | tail -1 | cut -d= -f2-)"
fi