From e9f5d4ced587fa8a81c726df15192b1903c4c965 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 26 Jun 2026 17:02:11 +0000 Subject: [PATCH] Connecte Postgres via le nom de conteneur unique (pleinr-postgres) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Le nom générique "postgres" entrait en collision avec d'autres conteneurs "postgres" présents sur le réseau proxy partagé (nginx_default), d'où les ECONNREFUSED vers de mauvaises IP. On utilise désormais pleinr-postgres, unique et présent uniquement sur le réseau interne. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01XwfhYHzC9hQWPDnQ2p53GL --- .env.example | 7 ++++--- docker-compose.yml | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 7c93a85..3ed7ead 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,10 @@ # ---- Database (external Postgres) ---- -# When running the app via docker-compose, host is the compose service name -# "postgres" on the internal port 5432 (NOT the published host port). +# With docker-compose the app reaches Postgres via the UNIQUE container name +# "pleinr-postgres" on the internal port 5432 (avoids collisions with other +# "postgres" containers on a shared proxy network; NOT the published host port). # For local dev outside Docker against the dockerised Postgres, use # localhost on the published host port: postgres://pleinr:pleinr@localhost:54329/pleinr -DATABASE_URL=postgres://pleinr:pleinr@postgres:5432/pleinr +DATABASE_URL=postgres://pleinr:pleinr@pleinr-postgres:5432/pleinr # Individual vars consumed by the postgres container in docker-compose.yml POSTGRES_USER=pleinr diff --git a/docker-compose.yml b/docker-compose.yml index ca87cc1..40d7434 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,10 @@ services: postgres: condition: service_healthy environment: - DATABASE_URL: postgres://${POSTGRES_USER:-pleinr}:${POSTGRES_PASSWORD:-pleinr}@postgres:5432/${POSTGRES_DB:-pleinr} + # Use the UNIQUE container name (not the generic "postgres" alias) to avoid + # name collisions with other "postgres" containers on the shared proxy + # network. pleinr-postgres only exists on our internal network. + DATABASE_URL: postgres://${POSTGRES_USER:-pleinr}:${POSTGRES_PASSWORD:-pleinr}@pleinr-postgres:5432/${POSTGRES_DB:-pleinr} # Optional: if left empty, the container generates and persists one # automatically (see docker-entrypoint.sh + the app-data volume). AUTH_SECRET: ${AUTH_SECRET:-}