deploy: prod uses container-FQDN for DATABASE_URL / REDIS_URL
The shared \`intranet\` Docker network has many other containers aliased as \`db\` and \`redis\` (mastodon-db, mailman redis, etc.). Docker's embedded DNS resolved those before our own services, sending the app's MySQL connection to the wrong IP and crashing it in a restart loop. Switched both DATABASE_URL and REDIS_URL in the prod overlay to use the project-prefixed container names (readmarkets-db-1, readmarkets-redis-1), which are globally unique on the Docker daemon. Applied to both app and scheduler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a50c5091c4
commit
3932ef4048
1 changed files with 18 additions and 0 deletions
|
|
@ -19,6 +19,24 @@ services:
|
|||
networks:
|
||||
- default
|
||||
- intranet
|
||||
# The shared `intranet` network has many other containers aliased as
|
||||
# `db` and `redis`; Docker's embedded DNS would pick one of those
|
||||
# before ours. Use the project-prefixed container names instead —
|
||||
# those are globally unique on the daemon.
|
||||
environment:
|
||||
DATABASE_URL: mysql+aiomysql://${MARIADB_USER:-cassandra}:${MARIADB_PASSWORD:-changeme}@readmarkets-db-1:3306/${MARIADB_DATABASE:-cassandra}
|
||||
REDIS_URL: redis://readmarkets-redis-1:6379/0
|
||||
|
||||
scheduler:
|
||||
# Scheduler isn't fronted by NPM, so it doesn't need intranet — but
|
||||
# it does share the same DNS-collision problem on `default` (it only
|
||||
# joins `default`, where our `db` alias would normally win… except
|
||||
# the scheduler too is multi-network if you ever decide to expose
|
||||
# its health endpoint via NPM). Future-proofing: use the explicit
|
||||
# container names here too.
|
||||
environment:
|
||||
DATABASE_URL: mysql+aiomysql://${MARIADB_USER:-cassandra}:${MARIADB_PASSWORD:-changeme}@readmarkets-db-1:3306/${MARIADB_DATABASE:-cassandra}
|
||||
REDIS_URL: redis://readmarkets-redis-1:6379/0
|
||||
|
||||
networks:
|
||||
intranet:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue