refactor: standardize environment variable naming and add PING_SERVICE_URL configuration

Aligned environment variable naming across backend and infrastructure files for improved consistency (e.g., `SPRING_CLOUD_CONSUL` and `SPRING_SECURITY_OAUTH2_RESOURCESERVER`). Introduced `PING_SERVICE_URL` to support dynamic Ping-Service routing. Updated Docker Compose health checks, profiles, and memory settings for scalability and stability.
This commit is contained in:
2026-02-13 15:00:12 +01:00
parent cafb3935cb
commit 6c50f22773
9 changed files with 124 additions and 84 deletions
+20 -43
View File
@@ -9,8 +9,8 @@ services:
postgres:
image: "${POSTGRES_IMAGE:-postgres:16-alpine}"
container_name: "${PROJECT_NAME:-meldestelle}-postgres"
# OPTIMIERUNG: Automatischer Neustart bei System-Reboot
restart: unless-stopped
profiles: [ "infra", "all" ]
ports:
- "${POSTGRES_PORT:-5432:5432}"
environment:
@@ -21,8 +21,6 @@ services:
- "postgres-data:/var/lib/postgresql/data"
- "./config/docker/postgres:/docker-entrypoint-initdb.d:Z"
- "./config/docker/postgres/postgresql.conf:/etc/postgresql/postgresql.conf:Z"
profiles: [ "infra", "all" ]
# OPTIMIERUNG: Dynamische Speicherzuweisung via .env Overrides
command:
- "postgres"
- "-c"
@@ -33,43 +31,38 @@ services:
- "effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE:-768MB}"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
# OPTIMIERUNG: Höheres Intervall (10s), um Zora im Normalbetrieb zu entlasten
interval: "10s"
timeout: "5s"
retries: "5"
start_period: "5s"
start_period: "10s"
networks:
meldestelle-network:
aliases:
- "postgres"
# --- CACHE: Valkey (formerly Redis) ---
# --- CACHE: Valkey ---
valkey:
# Valkey 9.0 (User Request)
image: "${VALKEY_IMAGE:-valkey/valkey:9-alpine}"
container_name: "${PROJECT_NAME:-meldestelle}-valkey"
restart: unless-stopped
profiles: [ "infra", "all" ]
ports:
- "${VALKEY_PORT:-6379:6379}"
volumes:
- "valkey-data:/data"
# Wir nutzen weiterhin die valkey.conf, da Valkey kompatibel ist
- "./config/docker/valkey/valkey.conf:/etc/valkey/valkey.conf:Z"
profiles: [ "infra", "all" ]
# Anpassung der Binaries auf valkey-server und valkey-cli
# command: [ "sh", "-lc", "exec valkey-server /etc/valkey/valkey.conf --protected-mode no ${VALKEY_PASSWORD:+--requirepass $VALKEY_PASSWORD}" ]
command:
- "sh"
- "-lc"
- |
exec valkey-server /etc/valkey/valkey.conf \
--protected-mode no \
--maxmemory ${VALKEY_MAXMEMORY:-256mb} \
--maxmemory ${VALKEY_MAX_MEMORY:-256MB} \
--maxmemory-policy ${VALKEY_POLICY:-allkeys-lru} \
${VALKEY_PASSWORD:+--requirepass $VALKEY_PASSWORD}
healthcheck:
test: [ "CMD-SHELL", "[ -z \"$VALKEY_PASSWORD\" ] && valkey-cli ping | grep PONG || valkey-cli -a \"$VALKEY_PASSWORD\" ping | grep PONG" ]
interval: "5s"
interval: "10s"
timeout: "5s"
retries: "3"
networks:
@@ -77,53 +70,51 @@ services:
aliases:
- "valkey"
# --- IAM: Keycloak (DEBUG MODE) ---
# --- IAM: Keycloak (Zora-Optimiert) ---
keycloak:
# Wir nutzen jetzt dein optimiertes Image statt des Standard-Images
build:
context: .
dockerfile: config/docker/keycloak/Dockerfile
args:
KEYCLOAK_IMAGE_TAG: "${KEYCLOAK_IMAGE_TAG:-26.4}"
image: "${DOCKER_REGISTRY:-git.mo-code.at/Mocode-Software}/keycloak:${KEYCLOAK_IMAGE_TAG:-26.4}"
image: "${DOCKER_REGISTRY:-git.mo-code.at/grandmo}/keycloak:${KEYCLOAK_IMAGE_TAG:-26.4}"
container_name: "${PROJECT_NAME:-meldestelle}-keycloak"
restart: unless-stopped # Wichtig für Zora!
restart: unless-stopped
profiles: [ "infra", "all" ]
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: "${KC_ADMIN_USERNAME:-kc-admin}"
KC_BOOTSTRAP_ADMIN_PASSWORD: "${KC_ADMIN_PASSWORD:-kc-password}"
KC_DB: "${KC_DB:-postgres}"
KC_DB_SCHEMA: "${KC_DB_SCHEMA:-keycloak}"
# SSoT: DB-URL dynamisch halten
KC_DB_URL: "jdbc:postgresql://postgres:5432/${POSTGRES_DB:-meldestelle}"
KC_DB_USERNAME: "${POSTGRES_USER:-meldestelle}"
KC_DB_PASSWORD: "${POSTGRES_PASSWORD:-meldestelle}"
KC_DB_URL: "jdbc:postgresql://postgres:5432/${POSTGRES_DB:-pg-meldestelle-db}"
KC_DB_USERNAME: "${POSTGRES_USER:-pg-user}"
KC_DB_PASSWORD: "${POSTGRES_PASSWORD:-pg-password}"
KC_HOSTNAME: "${KC_HOSTNAME:-localhost}"
KC_HTTP_ENABLED: "true"
KC_PROXY_HEADERS: "xforwarded"
KC_HEALTH_ENABLED: "true"
KC_METRICS_ENABLED: "true"
# OPTIMIERUNG: Java Heap Einstellungen
JAVA_OPTS_APPEND: "-Xms${KC_HEAP_MIN:-512m} -Xmx${KC_HEAP_MAX:-1024m}"
# Integration der Power-Flags
JAVA_OPTS_APPEND: "-Xms${KC_HEAP_MIN:-512M} -Xmx${KC_HEAP_MAX:-1024M} ${JVM_OPTS_ARM64}"
ports:
- "${KC_PORT:-8180:8080}"
- "${KC_DEBUG_PORT:-9000:9000}"
depends_on:
postgres:
condition: "service_healthy"
volumes:
- "./config/docker/keycloak:/opt/keycloak/data/import:Z"
# DYNAMISCH: start-dev für Dev, start für Zora
command: "${KC_COMMAND:-start-dev --import-realm}"
networks:
meldestelle-network:
aliases:
- "keycloak"
profiles: [ "infra", "all" ]
# --- SERVICE DISCOVERY: Consul ---
consul:
image: "${CONSUL_IMAGE:-hashicorp/consul:1.22.1}"
container_name: "${PROJECT_NAME:-meldestelle}-consul"
restart: unless-stopped
profiles: [ "infra", "all" ]
ports:
- "${CONSUL_PORT:-8500:8500}"
- "${CONSUL_UDP_PORT:-8600:8600/udp}"
@@ -135,31 +126,17 @@ services:
meldestelle-network:
aliases:
- "consul"
profiles: [ "infra", "all" ]
# --- TRACING: Zipkin ---
zipkin:
image: "${ZIPKIN_IMAGE:-openzipkin/zipkin:3}"
container_name: "${PROJECT_NAME:-meldestelle}-zipkin"
restart: unless-stopped # Geändert für Zora
restart: unless-stopped
profiles: [ "infra", "all" ]
environment:
# OPTIMIERUNG: Speicherbegrenzung für Zora (Zipkin ist Java)
JAVA_OPTS: "-Xms${ZIPKIN_HEAP:-256m} -Xmx${ZIPKIN_HEAP:-512m}"
JAVA_OPTS: "-Xms${ZIPKIN_MIN_HEAP:-256M} -Xmx${ZIPKIN_MAX_HEAP:-512M} ${JVM_OPTS_ARM64}"
ports:
- "${ZIPKIN_PORT:-9411:9411}"
profiles: [ "infra", "all" ] # Geändert auf 'ops', um es optionaler zu machen
networks:
meldestelle-network:
# --- EMAIL TESTING: Mailpit ---
mailpit:
image: "${MAILPIT_IMAGE:-axllent/mailpit:v1.29}"
container_name: "${PROJECT_NAME:-meldestelle}-mailpit"
restart: unless-stopped # Geändert für Zora
ports:
- "${MAILPIT_WEB_PORT:-8025:8025}" # Web UI
- "${MAILPIT_SMTP_PORT:-1025:1025}" # SMTP Port
profiles: [ "dev-tools", "all" ] # Auf 'dev-tools' verschoben
networks:
meldestelle-network: