Compose-Stack-Stabilisierungen + Gitea-Registry-Image

- App-Image wird jetzt aus Gitea-Container-Registry gepullt
  (git.kgva.ch/karim/rapport-app:main) — kein lokaler Build mehr noetig.
  build:-Section bleibt fuer Dev-Workflow.
- DB-Port nur noch auf 127.0.0.1 gebunden — kein direkter LAN-Zugriff
  zur Postgres mehr (Kong-Proxy ist der einzige Weg).
- DB-Healthcheck: start_period 30s + 20 retries — Migrations + Schema-Init
  brauchen beim Erst-Start laenger als 50s.
- Realtime: DB_AFTER_CONNECT_QUERY zeigt jetzt auf 'realtime' (ohne Underscore).
- App-Image-HEALTHCHECK: wget http://127.0.0.1/ statt localhost (IPv6-Fall).
- Init-Setup: zz-rapport-post-init.sh statt 00-init.sh, plus
  rapport-migrations als separater Mount unter /rapport-migrations.
This commit is contained in:
2026-05-24 16:09:26 +02:00
parent 981ca81f64
commit fb54f22e0c
6 changed files with 72 additions and 78 deletions
+26 -7
View File
@@ -24,15 +24,24 @@ services:
JWT_EXP: 3600
volumes:
- postgres-data:/var/lib/postgresql/data
- ./volumes/db/init/migrations:/docker-entrypoint-initdb.d/migrations:ro
- ./volumes/db/init/00-init.sh:/docker-entrypoint-initdb.d/00-init.sh:ro
# Rapport-Migrations gehen in einen separaten Pfad — NICHT in
# /docker-entrypoint-initdb.d, weil das die supabase-internen Migrations
# des Images überschreiben würde.
- ./volumes/db/init/rapport-migrations:/rapport-migrations:ro
# Post-Init läuft alphabetisch nach migrate.sh des Images. Achtung:
# ASCII-Reihenfolge ist 0-9 < A-Z < a-z, daher "99-…" käme VOR "migrate.sh".
# Mit "zz-…" landen wir sicher zuletzt.
- ./volumes/db/init/zz-rapport-post-init.sh:/docker-entrypoint-initdb.d/zz-rapport-post-init.sh:ro
ports:
- "${DB_PORT:-5432}:5432"
# Bewusst nur auf 127.0.0.1 — Postgres wird ueber Kong / interne
# Container-Kommunikation erreicht, kein direkter LAN-Zugriff.
- "127.0.0.1:${DB_PORT:-5432}:5432"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
test: ["CMD", "pg_isready", "-U", "supabase_admin", "-d", "postgres"]
interval: 5s
timeout: 5s
retries: 10
retries: 20
start_period: 30s
# ════════════════════════════════════════════════════════════════════════
# GoTrue — Auth (Email-Login, Passwort-Reset, Magic-Links)
@@ -96,6 +105,10 @@ services:
depends_on:
db:
condition: service_healthy
ulimits:
nofile:
soft: 10000
hard: 10000
environment:
PORT: 4000
DB_HOST: db
@@ -103,13 +116,16 @@ services:
DB_USER: supabase_admin
DB_PASSWORD: ${POSTGRES_PASSWORD}
DB_NAME: postgres
DB_AFTER_CONNECT_QUERY: 'SET search_path TO _realtime'
DB_AFTER_CONNECT_QUERY: 'SET search_path TO realtime'
DB_ENC_KEY: supabaserealtime
API_JWT_SECRET: ${JWT_SECRET}
SECRET_KEY_BASE: ${JWT_SECRET}
ERL_AFLAGS: -proto_dist inet_tcp
ENABLE_TAILSCALE: "false"
DNS_NODES: "''"
RLIMIT_NOFILE: 10000
APP_NAME: realtime
SEED_SELF_HOST: "true"
command: >
sh -c "/app/bin/migrate && /app/bin/realtime eval 'Realtime.Release.seeds(Realtime.Repo)' && /app/bin/server"
@@ -167,6 +183,10 @@ services:
# Rapport Frontend — die React-App hinter nginx
# ════════════════════════════════════════════════════════════════════════
app:
# Default: aus Gitea-Registry pullen (`docker compose pull` reicht).
# Wer das Image selber bauen will (Dev): RAPPORT_APP_IMAGE in .env auf
# `rapport-app:main` setzen, dann `docker compose --profile build build app`.
image: ${RAPPORT_APP_IMAGE:-git.kgva.ch/karim/rapport-app}:${RAPPORT_APP_TAG:-main}
build:
context: .
dockerfile: Dockerfile.app
@@ -174,7 +194,6 @@ services:
RAPPORT_APP_TAG: ${RAPPORT_APP_TAG:-main}
SUPABASE_URL: ${API_EXTERNAL_URL}
SUPABASE_ANON_KEY: ${ANON_KEY}
image: rapport-app:${RAPPORT_APP_TAG:-latest}
container_name: rapport-server-app
restart: unless-stopped
ports: