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:
@@ -34,18 +34,19 @@ DEFAULT_URI=https://dmtools.fvandenberg.nl
|
||||
###> doctrine/doctrine-bundle ###
|
||||
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
|
||||
#
|
||||
# In Docker (servers) the host is the `database` service and these parts come
|
||||
# from docker-compose.yml / .env.local. On the dev box, point DATABASE_URL at
|
||||
# your local MariaDB in .env.local, e.g.:
|
||||
# DATABASE_URL="mysql://root:@127.0.0.1:3306/dmtools?serverVersion=10.10.2-MariaDB&charset=utf8mb4"
|
||||
DB_HOST=database
|
||||
DB_PORT=3306
|
||||
# In Docker (servers) php talks to the `database` service on its own port
|
||||
# 3306 - always. The host-published port (for a DB client on the server) is
|
||||
# a separate thing: docker-compose.yml uses ${DB_HOST_PORT:-3310}, override
|
||||
# it in .env.local if 3310 is taken.
|
||||
#
|
||||
# On the dev box, point DATABASE_URL at your local MariaDB in .env.local:
|
||||
# DATABASE_URL="mysql://root:@127.0.0.1:3307/dmtools?serverVersion=10.10.2-MariaDB&charset=utf8mb4"
|
||||
DB_NAME=dmtools
|
||||
DB_USER=dmtools
|
||||
DB_PASSWORD=ChangeMe
|
||||
DB_ROOT_PASSWORD=ChangeMeRoot
|
||||
DB_SERVER_VERSION=mariadb-12.3.2
|
||||
DATABASE_URL="mysql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}?serverVersion=${DB_SERVER_VERSION}&charset=utf8mb4"
|
||||
DATABASE_URL="mysql://${DB_USER}:${DB_PASSWORD}@database:3306/${DB_NAME}?serverVersion=${DB_SERVER_VERSION}&charset=utf8mb4"
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
###> symfony/messenger ###
|
||||
|
||||
Reference in New Issue
Block a user