diff --git a/.env.example b/.env.example index 56b6c87..7ea2143 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,8 @@ # ---- Database (external Postgres) ---- -# When running the app via docker-compose, host is the compose service name "postgres". -# For local dev outside Docker, use localhost. +# When running the app via docker-compose, host is the compose service name +# "postgres" on the internal port 5432 (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 # Individual vars consumed by the postgres container in docker-compose.yml @@ -11,8 +13,9 @@ POSTGRES_DB=pleinr # ---- Auth.js (NextAuth v5) ---- # Generate with: openssl rand -base64 32 AUTH_SECRET=change-me-to-a-long-random-string -# Public URL of the app (used by Auth.js for callbacks) -AUTH_URL=http://localhost:3000 +# Public URL of the app (used by Auth.js for callbacks). +# With docker-compose the app is published on host port 8413 by default. +AUTH_URL=http://localhost:8413 # ---- First admin user (created by the seed script) ---- SEED_ADMIN_EMAIL=admin@plein-r.fr diff --git a/README.md b/README.md index 82d42cb..f7f465c 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,15 @@ docker compose up --build Au démarrage, le conteneur applique les migrations puis (si `SEED_ON_START=true`) charge des données de démonstration. Ensuite : -- Site public : http://localhost:3000 -- Espace adhérent / admin : http://localhost:3000/backend +- Site public : http://localhost:8413 +- Espace adhérent / admin : http://localhost:8413/backend - Connexion admin par défaut : `admin@plein-r.fr` / `changeme123` +> **Ports (volontairement peu courants pour éviter les conflits)** : l'app est +> publiée sur l'hôte en **8413** (→ 3000 dans le conteneur) et Postgres en +> **54329** (→ 5432). Modifiez la partie gauche des `ports:` dans +> `docker-compose.yml` si besoin. En dev local (`npm run dev`), l'app reste sur 3000. + > **Postgres déjà existant ?** Supprimez le service `postgres` de `docker-compose.yml` > et pointez `DATABASE_URL` vers votre instance. diff --git a/docker-compose.yml b/docker-compose.yml index c8f75d2..aa01bfe 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,8 @@ services: volumes: - pgdata:/var/lib/postgresql/data ports: - - "5432:5432" + # Host port rarely used (container stays on 5432). Change the left side if needed. + - "54329:5432" healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-pleinr} -d ${POSTGRES_DB:-pleinr}"] interval: 5s @@ -33,13 +34,14 @@ services: environment: DATABASE_URL: postgres://${POSTGRES_USER:-pleinr}:${POSTGRES_PASSWORD:-pleinr}@postgres:5432/${POSTGRES_DB:-pleinr} AUTH_SECRET: ${AUTH_SECRET:?set AUTH_SECRET in your .env} - AUTH_URL: ${AUTH_URL:-http://localhost:3000} + AUTH_URL: ${AUTH_URL:-http://localhost:8413} SEED_ON_START: ${SEED_ON_START:-true} SEED_ADMIN_EMAIL: ${SEED_ADMIN_EMAIL:-admin@plein-r.fr} SEED_ADMIN_PASSWORD: ${SEED_ADMIN_PASSWORD:-changeme123} SEED_ADMIN_NAME: ${SEED_ADMIN_NAME:-Administrateur Plein R} ports: - - "3000:3000" + # Host port rarely used (container stays on 3000). App reachable at http://HOST:8413 + - "8413:3000" volumes: pgdata: