From 2bd68f0cbce62624ec79350835436afcdfad7471 Mon Sep 17 00:00:00 2001 From: ertopogo Date: Thu, 19 Feb 2026 14:58:03 +0100 Subject: fix: remove Caddy from compose, expose port 3000 (Caddy on araucaria) --- .env.example | 5 +++-- Caddyfile | 23 +++++++++++++++++++---- DEPLOY.md | 19 +++++++++++-------- docker-compose.yml | 21 ++------------------- 4 files changed, 35 insertions(+), 33 deletions(-) diff --git a/.env.example b/.env.example index d55995e..98d91a1 100644 --- a/.env.example +++ b/.env.example @@ -5,7 +5,8 @@ DATABASE_URI=postgresql://user:password@host:5432/dertopogo PAYLOAD_SECRET=your-payload-secret-minimum-32-chars-here # === Next.js === -NEXT_PUBLIC_SITE_URL=https://your-domain.com +# Domaine public (internet) +NEXT_PUBLIC_SITE_URL=https://dt.arauco.online # === Keycloak OIDC (npagnun) === KEYCLOAK_ISSUER=https://npagnun.your-domain.com/realms/your-realm @@ -14,4 +15,4 @@ KEYCLOAK_CLIENT_SECRET=your-keycloak-client-secret # === Auth.js === AUTH_SECRET=your-auth-secret-minimum-32-chars-here -AUTH_URL=https://your-domain.com +AUTH_URL=https://dt.arauco.online diff --git a/Caddyfile b/Caddyfile index 5962313..7ac5e5d 100644 --- a/Caddyfile +++ b/Caddyfile @@ -1,7 +1,5 @@ -# Remplacer par votre domaine réel -# En dev local, utiliser: localhost:443 - -your-domain.com { +# === Acces internet (TLS auto via Let's Encrypt) === +dt.arauco.online { reverse_proxy app:3000 header { @@ -22,3 +20,20 @@ your-domain.com { } } } + +# === Acces reseau local (TLS auto-signe interne) === +dt.huitral.ruka.lan { + tls internal + + reverse_proxy app:3000 + + header { + X-Content-Type-Options "nosniff" + X-Frame-Options "DENY" + Referrer-Policy "strict-origin-when-cross-origin" + Permissions-Policy "camera=(), microphone=(), geolocation=()" + -Server + } + + encode gzip zstd +} diff --git a/DEPLOY.md b/DEPLOY.md index df08479..68b4de3 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -91,12 +91,12 @@ Valeurs a renseigner dans `.env.local` : |---|---|---| | `DATABASE_URI` | Connexion PostgreSQL | `postgresql://user:pass@pg-host:5432/dertopogo` | | `PAYLOAD_SECRET` | Secret Payload CMS (min 32 chars) | Generer avec `openssl rand -hex 32` | -| `NEXT_PUBLIC_SITE_URL` | URL publique du site | `https://votre-domaine.com` | +| `NEXT_PUBLIC_SITE_URL` | URL publique du site | `https://dt.arauco.online` | | `KEYCLOAK_ISSUER` | URL du realm Keycloak (npagnun) | `https://npagnun.domain.com/realms/votre-realm` | | `KEYCLOAK_CLIENT_ID` | Client ID OIDC | `dertopogo` | | `KEYCLOAK_CLIENT_SECRET` | Client Secret OIDC | Depuis la console Keycloak | | `AUTH_SECRET` | Secret Auth.js (min 32 chars) | Generer avec `openssl rand -hex 32` | -| `AUTH_URL` | URL du site (identique a SITE_URL) | `https://votre-domaine.com` | +| `AUTH_URL` | URL du site (identique a SITE_URL) | `https://dt.arauco.online` | Pour generer les secrets : @@ -114,7 +114,9 @@ openssl rand -hex 32 nano Caddyfile ``` -Remplacer `your-domain.com` par le vrai nom de domaine. Caddy gerera automatiquement le certificat TLS via Let's Encrypt. +Le Caddyfile est pre-configure avec deux domaines : +- `dt.arauco.online` : acces internet, TLS auto via Let's Encrypt +- `dt.huitral.ruka.lan` : acces reseau local, TLS auto-signe interne par Caddy ### 3d. Construire et lancer @@ -134,8 +136,9 @@ docker compose logs app # Verifier les logs de Caddy docker compose logs caddy -# Tester l'acces HTTP (depuis huitral) -curl -I https://votre-domaine.com +# Tester l'acces (depuis huitral) +curl -I https://dt.arauco.online +curl -Ik https://dt.huitral.ruka.lan # -k pour accepter le certificat auto-signe ``` Verifications attendues : @@ -328,9 +331,9 @@ Pour connecter le site a votre Keycloak existant, creer un client OIDC dans votr | Client ID | `dertopogo` | | Client Protocol | openid-connect | | Client authentication | On (confidential) | -| Valid Redirect URIs | `https://votre-domaine.com/api/auth/callback/keycloak` | -| Valid Post Logout Redirect URIs | `https://votre-domaine.com` | -| Web Origins | `https://votre-domaine.com` | +| Valid Redirect URIs | `https://dt.arauco.online/api/auth/callback/keycloak` | +| Valid Post Logout Redirect URIs | `https://dt.arauco.online` | +| Web Origins | `https://dt.arauco.online` | 5. Onglet "Credentials" : copier le Client Secret dans `.env.local` (`KEYCLOAK_CLIENT_SECRET`) 6. Onglet "Client scopes" > ajouter `roles` au scope par defaut pour inclure les roles dans le token diff --git a/docker-compose.yml b/docker-compose.yml index 4c035dc..bb29a1b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,32 +1,15 @@ services: - caddy: - image: caddy:2-alpine - restart: unless-stopped - ports: - - "80:80" - - "443:443" - - "443:443/udp" - volumes: - - ./Caddyfile:/etc/caddy/Caddyfile:ro - - caddy_data:/data - - caddy_config:/config - depends_on: - app: - condition: service_started - app: build: context: . dockerfile: Dockerfile restart: unless-stopped - expose: - - "3000" + ports: + - "3000:3000" env_file: - .env.local volumes: - app_media:/app/media volumes: - caddy_data: - caddy_config: app_media: -- cgit v1.2.3