refactor(infra): Restrukturierung Config-Ordner & Einführung von Docker-Profilen

Umfangreiches Refactoring der Projektkonfiguration zur klaren Trennung von Build-, Runtime- und Applikations-Logik.

Änderungen im Detail:
- Struktur: Neuorganisation des `config/` Verzeichnisses in logische Bereiche:
  - `config/docker`: Reine Infrastruktur-Configs (Postgres, Redis, Nginx, Monitoring).
  - `config/quality`: Statische Code-Analyse (Detekt, Lint).
  - `config/app`: Gemeinsame Spring-Boot-Konfigurationen.
- Docker Compose:
  - Einführung von Profilen (`infra`, `backend`, `ops`, `gui`, `tools`) für gezieltes Starten von Teilbereichen.
  - Anpassung aller Volume-Pfade auf die neue Struktur.
- Spring Boot Config:
  - Zentralisierung gemeinsamer Einstellungen (Datasource, Redis, JPA) in `config/app/base-application.yml`.
  - Parametrisierung der Hosts für nahtlosen Wechsel zwischen Docker und Localhost.
  - Bereinigung der service-spezifischen `application.yaml` Dateien (z.B. Ping-Service).
- Cleanup: Entfernen redundanter "Ghost-Files" (`versions.toml`, `central.toml`, `config/.env`), um eine echte Single Source of Truth (SSoT) zu gewährleisten.
This commit is contained in:
Stefan Mogeritsch 2025-12-10 15:25:10 +01:00
parent 8221a7b915
commit f402fbaf19
45 changed files with 171 additions and 729 deletions

View File

@ -14,7 +14,6 @@ ARG JAVA_VERSION
ARG BUILD_DATE
ARG VERSION
# Infrastructure-specific arguments (docker/build-args/infrastructure.env)
# Note: No runtime profiles as build ARGs
# ===================================================================

View File

@ -1,3 +0,0 @@
# Placeholder HOCON configuration for compatibility with legacy test scripts
# The actual configuration is provided in application.yml.
# This file ensures scripts that check for application.conf do not fail.

View File

@ -14,18 +14,21 @@ ARG JAVA_VERSION
ARG BUILD_DATE
ARG VERSION
# Service-specific arguments (docker/build-args/services.env)
# Note: No runtime profiles as build ARGs
# Build stage: compile the ping-service JAR inside Docker
FROM gradle:${GRADLE_VERSION}-jdk${JAVA_VERSION}-alpine AS builder
# Re-declare build arguments for this stage
ARG VERSION
ARG BUILD_DATE
# Add metadata labels
LABEL stage=builder \
service=ping-service \
maintainer="Meldestelle Development Team" \
version="${VERSION}" \
build.date="${BUILD_DATE}"
LABEL stage=builder
LABEL service=ping-service
LABEL maintainer="Meldestelle Development Team"
LABEL version="${VERSION}"
LABEL build.date="${BUILD_DATE}"
WORKDIR /workspace

View File

@ -1,18 +1,46 @@
# Port, auf dem das Ping-Service läuft
server:
port: ${PING_SERVICE_PORT:8082}
spring:
application:
name: ping-service
profiles:
active: ${SPRING_PROFILES_ACTIVE:dev}
# datasource:
# url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/pg-meldestelle-db}
# username: ${SPRING_DATASOURCE_USERNAME:pg-user}
# password: ${SPRING_DATASOURCE_PASSWORD:pg-password}
# driver-class-name: org.postgresql.Driver
# # --- REDIS KONFIGURATION (NEU) ---
# data:
# redis:
# host: ${SPRING_DATA_REDIS_HOST:localhost}
# port: ${SPRING_DATA_REDIS_PORT:6379}
# password: ${SPRING_DATA_REDIS_PASSWORD:redis-password} # Leer lassen als Default
# # Optional: Timeouts für Stabilität
# connect-timeout: 5s
# timeout: 2s
# jpa:
# database-platform: org.hibernate.dialect.PostgreSQLDialect
# hibernate:
# ddl-auto: update
# open-in-view: false
cloud:
consul:
host: ${CONSUL_HOST:localhost}
port: ${CONSUL_PORT:8500}
enabled: ${CONSUL_ENABLED:true}
discovery:
enabled: true
register: true
enabled: ${CONSUL_ENABLED:true}
register: ${CONSUL_ENABLED:true}
health-check-path: /actuator/health
health-check-interval: 10s
server:
port: ${SERVER_PORT:${PING_SERVICE_PORT:8082}}
instance-id: ${spring.application.name}-${server.port}-${random.uuid}
management:
endpoints:
@ -22,6 +50,7 @@ management:
endpoint:
health:
show-details: always
show-components: always
probes:
enabled: true
tracing:

View File

@ -1,63 +0,0 @@
# ==========================================
# Meldestelle - Docker Compose Environment
# Single Source of Truth (SSoT)
# ==========================================
# Profil: DEVELOPMENT (Lokal)
# --- PROJEKT EINSTELLUNGEN ---
PROJECT_NAME=meldestelle
PROJEKT_EMAIL=meldestelle@mo-code.at
# Restart Policy: 'no' für Dev (Fehler sehen), 'always' für Prod
RESTART_POLICY=no
# --- POSTGRESQL (Datenbank) ---
POSTGRES_USER=pg-user
POSTGRES_PASSWORD=pg-password
POSTGRES_PORT=5432:5432
# Standard-Datenbankname für lokale Entwicklung (sollte mit docker-compose übereinstimmen)
POSTGRES_DB=pg-meldestelle-db
# --- REDIS (Cache) ---
# Optional: Redis Passwort setzen. Leer lassen = kein Passwort.
# Wenn gesetzt, muss der Healthcheck in docker-compose das berücksichtigen.
REDIS_PORT=6379:6379
REDIS_PASSWORD=
# --- KEYCLOAK (Identity Provider) ---
KC_ADMIN_USER=kc-admin
KC_ADMIN_PASSWORD=kc-password
KC_HOSTNAME=localhost
KC_PORT=8180:8080
# --- PGADMIN (DB GUI) ---
PGADMIN_EMAIL=meldestelle@mo-code.at
PGADMIN_PASSWORD=strong-password
PGADMIN_PORT=8888:80
# --- PROMETHEUS (Metriken) ---
PROMETHEUS_PORT=9090:9090
# --- GRAFANA (Monitoring GUI) ---
GF_ADMIN_USER=gf-admin
GF_ADMIN_PASSWORD=gf-password
GF_PORT=3000:3000
# --- SERVICE DISCOVERY (Consul) ---
CONSUL_PORT=8500:8500
CONSUL_UDP_PORT=8600:8600
# --- API GATEWAY ---
GATEWAY_SERVER_PORT=8081:8081
GATEWAY_DEBUG_PORT=5005:5005
# --- MICROSERVICES ---
PING_PORT=8082:8082
PING_DEBUG_PORT=5006:5006
# --- WEB CLIENTS ---
# Web-App (Nginx inside container listens on 80)
WEB_APP_PORT=4000:4000
# Desktop-App (VNC + noVNC)
DESKTOP_APP_VNC_PORT=5901:5901
DESKTOP_APP_NOVNC_PORT=6080:6080

View File

@ -0,0 +1,89 @@
spring:
application:
name: meldestelle
# --- ZENTRALE DATENBANK KONFIGURATION ---
datasource:
url: ${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/pg-meldestelle-db}
username: ${SPRING_DATASOURCE_USERNAME:pg-user}
password: ${SPRING_DATASOURCE_PASSWORD:pg-password}
driver-class-name: org.postgresql.Driver
# --- JPA / HIBERNATE DEFAULTS ---
jpa:
database-platform: org.hibernate.dialect.PostgreSQLDialect
hibernate:
ddl-auto: update
open-in-view: false
# --- REDIS KONFIGURATION (NEU) ---
data:
redis:
host: ${SPRING_DATA_REDIS_HOST:localhost}
port: ${SPRING_DATA_REDIS_PORT:6379}
password: ${SPRING_DATA_REDIS_PASSWORD:redis-password} # Leer lassen als Default
# Optional: Timeouts für Stabilität
connect-timeout: 5s
timeout: 2s
cloud:
consul:
host: ${CONSUL_HOST:localhost}
port: ${CONSUL_PORT:8500}
enabled: ${CONSUL_ENABLED:true}
discovery:
enabled: ${CONSUL_ENABLED:true}
register: ${CONSUL_ENABLED:true}
health-check-path: /actuator/health
health-check-interval: 10s
instance-id: ${spring.application.name}-${server.port}-${random.uuid}
# # Redis configuration for cache
# redis:
# host: ${SPRING_DATA_REDIS_HOST:localhost}
# port: ${SPRING_DATA_REDIS_PORT:6379}
# password: ${SPRING_DATA_REDIS_PASSWORD:redis-password}
# database: 0
# connection-timeout: 5s
# read-timeout: 2s
# use-pooling: true
# max-pool-size: 8
# min-pool-size: 2
# connection-check-interval: 10000 # 10 seconds
# local-cache-cleanup-interval: 60000 # 1 minute
# sync-interval: 300000 # 5 minutes
#
# # Redis configuration for event store
# event-store:
# host: ${SPRING_DATA_REDIS_HOST:localhost}
# port: ${SPRING_DATA_REDIS_PORT:6379}
# password: ${SPRING_DATA_REDIS_PASSWORD:redis-password}
# database: 1 # Use a different database for event store
# connection-timeout: 5s
# read-timeout: 2s
# use-pooling: true
# max-pool-size: 8
# min-pool-size: 2
# consumer-group: event-processors
# consumer-name:
# "${spring.application.name}-${random.uuid}"
# stream-prefix:
# "event-stream:"
# all-events-stream:
# "all-events"
# claim-idle-timeout: 60000 # 1 minute
# poll-timeout: 100 # 100 milliseconds
# poll-interval: 100 # 100 milliseconds
# max-batch-size: 100
# create-consumer-group-if-not-exists: true
# Logging configuration
logging:
level:
root: INFO
at.mocode: DEBUG
org.springframework.data.redis: INFO
## Server configuration
#server:
# port: 8080

View File

@ -1,53 +0,0 @@
spring:
application:
name: meldestelle
# Redis configuration for cache
redis:
host: localhost
port: 6379
password: # Leave empty for no password
database: 0
connection-timeout: 2000
read-timeout: 2000
use-pooling: true
max-pool-size: 8
min-pool-size: 2
connection-check-interval: 10000 # 10 seconds
local-cache-cleanup-interval: 60000 # 1 minute
sync-interval: 300000 # 5 minutes
# Redis configuration for event store
event-store:
host: localhost
port: 6379
password: # Leave empty for no password
database: 1 # Use a different database for event store
connection-timeout: 2000
read-timeout: 2000
use-pooling: true
max-pool-size: 8
min-pool-size: 2
consumer-group: event-processors
consumer-name:
"${spring.application.name}-${random.uuid}"
stream-prefix:
"event-stream:"
all-events-stream:
"all-events"
claim-idle-timeout: 60000 # 1 minute
poll-timeout: 100 # 100 milliseconds
poll-interval: 100 # 100 milliseconds
max-batch-size: 100
create-consumer-group-if-not-exists: true
# Logging configuration
logging:
level:
root: INFO
at.mocode: DEBUG
org.springframework.data.redis: INFO
# Server configuration
server:
port: 8080

View File

@ -1,381 +0,0 @@
# ===================================================================
# Central Configuration - Single Source of Truth
# Master file for all project configuration values
# ===================================================================
# Version: 1.0.0
# Last updated: 2025-09-15
# Author: Meldestelle Development Team
#
# This file serves as the SINGLE SOURCE OF TRUTH for all configuration
# values in the Meldestelle project, eliminating redundancy across
# 38+ files and ensuring consistency.
[metadata]
project-name = "Meldestelle"
version = "1.0.0"
description = "Pferdesport Meldestelle System"
author = "Österreichischer Pferdesportverband"
license = "Proprietary"
# ===================================================================
# PORT MANAGEMENT - Single Source of Truth
# Eliminates 38+ redundant port definitions
# ===================================================================
[ports]
# --- Infrastructure Services ---
api-gateway = 8081
auth-server = 8087
monitoring-server = 8088
# --- Application Services ---
ping-service = 8082
members-service = 8083
horses-service = 8084
events-service = 8085
masterdata-service = 8086
# --- External Infrastructure ---
postgres = 5432
redis = 6379
keycloak = 8180
consul = 8500
zookeeper = 2181
kafka = 9092
# --- Monitoring Stack ---
prometheus = 9090
grafana = 3000
alertmanager = 9093
# --- Client Applications ---
web-app = 4000
desktop-app-vnc = 5901
desktop-app-novnc = 6080
# --- Debug Ports (Development) ---
gateway-debug = 5005
ping-debug = 5005
members-debug = 5004
horses-debug = 5005
events-debug = 5006
masterdata-debug = 5007
auth-debug = 5005
[port-ranges]
# --- Port Range Definitions ---
infrastructure = "8081-8089"
services = "8082-8099"
monitoring = "9090-9099"
clients = "4000-4099"
debug = "5005-5009"
vnc = "5901-5999"
# ===================================================================
# SPRING PROFILE MANAGEMENT - Single Source of Truth
# Eliminates 72+ redundant SPRING_PROFILES_ACTIVE definitions
# ===================================================================
[spring-profiles]
# --- Standard Profile Names ---
default = "default"
development = "dev"
docker = "docker"
production = "prod"
test = "test"
# --- Category-Specific Default Profiles ---
[spring-profiles.defaults]
infrastructure = "default"
services = "docker"
clients = "dev"
# --- Environment Mapping ---
[spring-profiles.environment-mapping]
development = "dev"
staging = "prod"
production = "prod"
testing = "test"
local = "dev"
# ===================================================================
# SERVICE DISCOVERY - Single Source of Truth
# Standardizes service URLs and hostnames
# ===================================================================
[services]
[services.ping-service]
name = "ping-service"
port = 8082
internal-host = "ping-service"
external-host = "localhost"
internal-url = "http://ping-service:8082"
external-url = "http://localhost:8082"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
swagger-endpoint = "/swagger-ui.html"
[services.members-service]
name = "members-service"
port = 8083
internal-host = "members-service"
external-host = "localhost"
internal-url = "http://members-service:8083"
external-url = "http://localhost:8083"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
[services.horses-service]
name = "horses-service"
port = 8084
internal-host = "horses-service"
external-host = "localhost"
internal-url = "http://horses-service:8084"
external-url = "http://localhost:8084"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
[services.events-service]
name = "events-service"
port = 8085
internal-host = "events-service"
external-host = "localhost"
internal-url = "http://events-service:8085"
external-url = "http://localhost:8085"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
[services.masterdata-service]
name = "masterdata-service"
port = 8086
internal-host = "masterdata-service"
external-host = "localhost"
internal-url = "http://masterdata-service:8086"
external-url = "http://localhost:8086"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
[services.api-gateway]
name = "api-gateway"
port = 8081
internal-host = "api-gateway"
external-host = "localhost"
internal-url = "http://api-gateway:8081"
external-url = "http://localhost:8081"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
gateway-endpoint = "/actuator/gateway"
[services.auth-server]
name = "auth-server"
port = 8087
internal-host = "auth-server"
external-host = "localhost"
internal-url = "http://auth-server:8087"
external-url = "http://localhost:8087"
health-endpoint = "/actuator/health/readiness"
metrics-endpoint = "/actuator/prometheus"
info-endpoint = "/actuator/info"
# ===================================================================
# INFRASTRUCTURE SERVICES
# ===================================================================
[infrastructure]
[infrastructure.postgres]
host = "postgres"
port = 5432
database = "meldestelle"
user = "meldestelle"
external-port = 5432
health-check = "pg_isready -U meldestelle -d meldestelle"
[infrastructure.redis]
host = "redis"
port = 6379
external-port = 6379
health-check = "redis-cli ping"
[infrastructure.consul]
host = "consul"
port = 8500
external-port = 8500
health-check = "/v1/status/leader"
[infrastructure.keycloak]
host = "keycloak"
port = 8080
external-port = 8180
admin-user = "admin"
health-check = "/"
[infrastructure.kafka]
host = "kafka"
port = 9092
external-port = 9092
zookeeper-port = 2181
health-check = "kafka-broker-api-versions --bootstrap-server localhost:9092"
# ===================================================================
# MONITORING CONFIGURATION
# ===================================================================
[monitoring]
[monitoring.prometheus]
host = "prometheus"
port = 9090
external-port = 9090
config-path = "/etc/prometheus/prometheus.yml"
health-check = "/-/healthy"
retention = "200h"
[monitoring.grafana]
host = "grafana"
port = 3000
external-port = 3000
admin-user = "admin"
health-check = "/api/health"
datasource-url = "http://prometheus:9090"
[monitoring.alertmanager]
host = "alertmanager"
port = 9093
external-port = 9093
health-check = "/-/healthy"
# ===================================================================
# ENVIRONMENT VARIABLES - Single Source of Truth
# Consolidates variables from .env.template and compose files
# ===================================================================
[environment]
[environment.application]
name = "Meldestelle"
version = "1.0.0"
description = "Pferdesport Meldestelle System"
environment = "development"
debug-mode = true
hot-reload = true
[environment.database]
host = "localhost"
port = 5432
name = "meldestelle"
user = "meldestelle"
password = "meldestelle"
max-pool-size = 10
min-pool-size = 5
auto-migrate = true
[environment.redis]
host = "localhost"
port = 6379
password = ""
database = 0
connection-timeout = 2000
read-timeout = 2000
use-pooling = true
max-pool-size = 8
min-pool-size = 2
[environment.security]
jwt-secret = "meldestelle-jwt-secret-key-for-development-change-in-production"
jwt-issuer = "meldestelle-api"
jwt-audience = "meldestelle-clients"
jwt-realm = "meldestelle"
api-key = "meldestelle-api-key-for-development"
[environment.logging]
level = "DEBUG"
structured = true
correlation-id = true
request-id-header = "X-Request-ID"
# ===================================================================
# HEALTH CHECK CONFIGURATION
# Standardizes health check endpoints and timeouts
# ===================================================================
[health-checks]
[health-checks.defaults]
interval = "15s"
timeout = "5s"
retries = 3
start-period = "30s"
[health-checks.development]
interval = "30s"
timeout = "5s"
retries = 3
start-period = "40s"
[health-checks.production]
interval = "10s"
timeout = "3s"
retries = 3
start-period = "20s"
# ===================================================================
# CLIENT APPLICATIONS
# ===================================================================
[clients]
[clients.web-app]
name = "web-app"
port = 4000
external-port = 4000
build-target = "wasmJsBrowserDistribution"
nginx-port = 4000
health-endpoint = "/health"
[clients.desktop-app]
name = "desktop-app"
vnc-port = 5901
novnc-port = 6080
build-target = "composeDesktop"
health-endpoint = "/health"
# ===================================================================
# BUILD CONFIGURATION
# Integration with existing Docker version management
# ===================================================================
[build]
gradle-version = "9.1.0"
java-version = "21"
node-version = "24.11.0"
nginx-version = "1.29-alpine"
docker-version = "1.0.0"
# ===================================================================
# ENVIRONMENT-SPECIFIC OVERRIDES
# ===================================================================
[environments]
[environments.development]
debug-enabled = true
log-level = "DEBUG"
hot-reload = true
cors-enabled = true
cors-origins = ["*"]
[environments.production]
debug-enabled = false
log-level = "INFO"
hot-reload = false
cors-enabled = true
cors-origins = ["https://meldestelle.at"]
tls-enabled = true
security-headers = true
[environments.testing]
debug-enabled = true
log-level = "DEBUG"
ephemeral-storage = true
test-containers = true

View File

@ -1,204 +0,0 @@
# ===================================================================
# Docker Versions Catalog - Single Source of Truth
# Analogous to gradle/libs.versions.toml for centralized version management
# ===================================================================
# Last updated: 2025-09-13
# Eliminates version redundancy across 12+ Dockerfiles
[versions]
# --- Build Tools ---
gradle = "9.1.0"
java = "21"
node = "22.21.0"
# --- Base Images ---
nginx = "1.28.0-alpine"
alpine = "3.22"
eclipse-temurin-jdk = "21-jdk-alpine"
eclipse-temurin-jre = "21-jre-alpine"
# --- Datastore Images ---
postgres = "16-alpine"
redis = "7.4-alpine"
# --- Additional Infrastructure Images ---
consul = "1.15"
zookeeper = "7.4.0"
kafka = "7.4.0"
# --- Monitoring & Infrastructure Services ---
prometheus = "v2.54.1"
grafana = "11.3.0"
keycloak = "26.4.2"
# --- Spring Configuration ---
spring-profiles-default = "default"
spring-profiles-docker = "docker"
spring-profiles-prod = "prod"
# --- Application Versions ---
app-version = "1.0.0"
# --- Zentrale Port-Verwaltung ---
# Single Source of Truth für alle Service-Ports
[service-ports]
# --- Infrastructure Services ---
api-gateway = 8081
auth-server = 8087
monitoring-server = 8088
# --- Application Services ---
ping-service = 8082
members-service = 8083
horses-service = 8084
events-service = 8085
masterdata-service = 8086
# --- External Services ---
postgres = 5432
redis = 6379
keycloak = 8180
consul = 8500
zookeeper = 2181
kafka = 9092
# --- Monitoring Stack ---
prometheus = 9090
grafana = 3000
# --- Client Applications ---
web-app = 4000
desktop-app-vnc = 5901
desktop-app-novnc = 6080
[port-ranges]
# --- Port-Range-Definitionen für automatische Port-Zuweisung ---
infrastructure = "8081-8088"
services = "8082-8099"
monitoring = "9090-9099"
clients = "4000-4099"
vnc = "5901-5999"
debug = "5005-5009"
# --- Reserved Port Ranges ---
system-reserved = "0-1023"
ephemeral = "32768-65535"
[build-args]
# --- Global Build Arguments (used across all categories) ---
global = [
"GRADLE_VERSION",
"JAVA_VERSION",
"BUILD_DATE",
"VERSION"
]
# --- Spring Boot Services (dockerfiles/services/* and infrastructure/*) ---
spring-services = [
"SPRING_PROFILES_ACTIVE",
"SERVICE_PATH",
"SERVICE_NAME",
"SERVICE_PORT"
]
# --- Kotlin/JS Web Clients (dockerfiles/clients/*) ---
web-clients = [
"NODE_VERSION",
"NGINX_VERSION",
"CLIENT_PATH",
"CLIENT_MODULE",
"CLIENT_NAME"
]
[categories]
# --- Services Configuration ---
[categories.services]
default-spring-profile = "docker"
default-port-start = 8082
services = [
"ping-service",
"members-service",
"horses-service",
"events-service",
"masterdata-service"
]
# --- Infrastructure Configuration ---
[categories.infrastructure]
default-spring-profile = "default"
services = [
"gateway",
"auth-server",
"monitoring-server"
]
# --- Client Applications Configuration ---
[categories.clients]
clients = [
"web-app",
"desktop-app"
]
[environment-mapping]
# --- Environment Variable Names for Docker Compose ---
# Maps internal version names to environment variable names
gradle-version = "DOCKER_GRADLE_VERSION"
java-version = "DOCKER_JAVA_VERSION"
node-version = "DOCKER_NODE_VERSION"
nginx-version = "DOCKER_NGINX_VERSION"
postgres-version = "DOCKER_POSTGRES_VERSION"
redis-version = "DOCKER_REDIS_VERSION"
prometheus-version = "DOCKER_PROMETHEUS_VERSION"
grafana-version = "DOCKER_GRAFANA_VERSION"
keycloak-version = "DOCKER_KEYCLOAK_VERSION"
consul-version = "DOCKER_CONSUL_VERSION"
zookeeper-version = "DOCKER_ZOOKEEPER_VERSION"
kafka-version = "DOCKER_KAFKA_VERSION"
spring-profiles-default = "DOCKER_SPRING_PROFILES_DEFAULT"
spring-profiles-docker = "DOCKER_SPRING_PROFILES_DOCKER"
app-version = "DOCKER_APP_VERSION"
[environments]
# --- Environment-spezifische Konfigurationen ---
# Zentrale Verwaltung für dev/test/prod Umgebungen
[environments.development]
spring-profiles = "dev"
debug-enabled = true
log-level = "DEBUG"
health-check-interval = "30s"
health-check-timeout = "5s"
health-check-retries = 3
health-check-start-period = "40s"
resource-limits = false
jvm-debug-port = 5005
hot-reload = true
[environments.production]
spring-profiles = "prod"
debug-enabled = false
log-level = "INFO"
health-check-interval = "15s"
health-check-timeout = "3s"
health-check-retries = 3
health-check-start-period = "30s"
resource-limits = true
jvm-debug-port = false
hot-reload = false
security-headers = true
tls-enabled = true
[environments.testing]
spring-profiles = "test"
debug-enabled = true
log-level = "DEBUG"
health-check-interval = "10s"
health-check-timeout = "5s"
health-check-retries = 2
health-check-start-period = "20s"
resource-limits = false
jvm-debug-port = 5005
hot-reload = false
ephemeral-storage = true
test-containers = true

View File

@ -18,8 +18,9 @@ services:
POSTGRES_DB: "${POSTGRES_DB:-pg-meldestelle-db}"
volumes:
- "postgres-data:/var/lib/postgresql/data"
- "./config/backend/infrastructure/postgres:/docker-entrypoint-initdb.d:Z"
- "./config/backend/infrastructure/postgres/postgresql.conf:/etc/postgresql/postgresql.conf:Z"
- "./config/docker/postgres:/docker-entrypoint-initdb.d:Z"
- "./config/docker/postgres/postgresql.conf:/etc/postgresql/postgresql.conf:Z"
profiles: [ "infra", "all" ]
command: [ "postgres", "-c", "config_file=/etc/postgresql/postgresql.conf" ]
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
@ -41,7 +42,8 @@ services:
- "${REDIS_PORT:-6379:6379}"
volumes:
- "redis-data:/data"
- "./config/backend/infrastructure/redis/redis.conf:/usr/local/etc/redis/redis.conf:Z"
- "./config/docker/redis/redis.conf:/usr/local/etc/redis/redis.conf:Z"
profiles: [ "infra", "all" ]
command: [ "sh", "-lc", "exec redis-server /usr/local/etc/redis/redis.conf --protected-mode no ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}" ]
healthcheck:
test: [ "CMD-SHELL", "[ -z \"$REDIS_PASSWORD\" ] && redis-cli ping | grep PONG || redis-cli -a \"$REDIS_PASSWORD\" ping | grep PONG" ]
@ -59,7 +61,7 @@ services:
container_name: "${PROJECT_NAME:-meldestelle}-keycloak"
restart: "${RESTART_POLICY:-no}"
build:
context: "./config/backend/infrastructure/keycloak"
context: "./config/docker/keycloak"
args:
KEYCLOAK_IMAGE_TAG: "${KEYCLOAK_IMAGE_TAG:-26.4}"
BUILD_DATE: "${DOCKER_BUILD_DATE}"
@ -87,7 +89,8 @@ services:
redis:
condition: "service_healthy"
volumes:
- "./config/backend/infrastructure/keycloak:/opt/keycloak/data/import:Z"
- "./config/docker/keycloak:/opt/keycloak/data/import:Z"
profiles: [ "infra", "all" ]
command: "start --optimized --import-realm"
healthcheck:
test: [ "CMD-SHELL", "exec 3<>/dev/tcp/127.0.0.1/9000" ]
@ -112,6 +115,7 @@ services:
PGADMIN_DEFAULT_PASSWORD: "${PGADMIN_PASSWORD:-pgadmin}"
volumes:
- "pgadmin-data:/var/lib/pgadmin"
profiles: [ "tools", "all" ]
networks:
meldestelle-network:
aliases:
@ -131,6 +135,7 @@ services:
meldestelle-network:
aliases:
- "postgres-exporter"
profiles: [ "ops", "all" ]
# --- MONITORING: Alertmanager ---
alertmanager:
@ -143,9 +148,10 @@ services:
# Wir müssen hier envsubst nutzen ODER die Config ohne Variablen schreiben.
# Einfachste Lösung: Ein Entrypoint-Script, das envsubst macht (ähnlich wie bei Nginx).
# ODER: Wir hardcoden es für Dev erst mal.
- ./config/backend/infrastructure/monitoring/alertmanager/alertmanager.yaml:/etc/alertmanager/alertmanager.yaml
- ./config/docker/monitoring/alertmanager/alertmanager.yaml:/etc/alertmanager/alertmanager.yaml
command:
- --config.file=/etc/alertmanager/alertmanager.yaml
profiles: [ "ops", "all" ]
networks:
meldestelle-network:
aliases:
@ -160,8 +166,8 @@ services:
- "${PROMETHEUS_PORT:-9090:9090}"
volumes:
- "prometheus-data:/prometheus"
- "./config/backend/infrastructure/monitoring/prometheus:/etc/prometheus:Z"
- "./config/backend/infrastructure/monitoring/prometheus/rules:/etc/prometheus/rules:Z"
- "./config/docker/monitoring/prometheus:/etc/prometheus:Z"
- "./config/docker/monitoring/prometheus/rules:/etc/prometheus/rules:Z"
command:
- --web.enable-lifecycle
- --config.file=/etc/prometheus/prometheus.yaml
@ -176,6 +182,7 @@ services:
meldestelle-network:
aliases:
- "prometheus"
profiles: [ "ops", "all" ]
# --- MONITORING: Grafana ---
grafana:
@ -190,9 +197,9 @@ services:
volumes:
- grafana-data:/var/lib/grafana
# Provisioning (datasources/dashboards) from central config
- ./config/backend/infrastructure/monitoring/grafana/provisioning:/etc/grafana/provisioning:Z
- ./config/docker/monitoring/grafana/provisioning:/etc/grafana/provisioning:Z
# Dashboards directory (referenced by a provisioning file path: /var/lib/grafana/dashboards)
- ./config/backend/infrastructure/monitoring/grafana/dashboards:/var/lib/grafana/dashboards:Z
- ./config/docker/monitoring/grafana/dashboards:/var/lib/grafana/dashboards:Z
depends_on:
prometheus:
condition: "service_healthy"
@ -206,6 +213,7 @@ services:
meldestelle-network:
aliases:
- "grafana"
profiles: [ "ops", "all" ]
# --- CONSUL ---
consul:
@ -225,6 +233,7 @@ services:
meldestelle-network:
aliases:
- "consul"
profiles: [ "infra", "all" ]
# --- API-GATEWAY: Spring Cloud Gateway ---
api-gateway:
@ -294,6 +303,9 @@ services:
meldestelle-network:
aliases:
- "api-gateway"
profiles: [ "backend", "all" ]
volumes:
- ./config/app/base-application.yaml:/workspace/config/application.yml:Z
# ==========================================
# MICROSERVICES
@ -351,6 +363,9 @@ services:
meldestelle-network:
aliases:
- "ping-service"
profiles: [ "backend", "all" ]
volumes:
- ./config/app/base-application.yaml:/workspace/config/application.yml:Z
entries-service:
build:
@ -386,6 +401,9 @@ services:
meldestelle-network:
aliases:
- "entries-service"
profiles: [ "backend", "all" ]
volumes:
- ./config/app/base-application.yaml:/workspace/config/application.yml:Z
results-service:
build:
@ -421,6 +439,9 @@ services:
meldestelle-network:
aliases:
- "results-service"
profiles: [ "backend", "all" ]
volumes:
- ./config/app/base-application.yaml:/workspace/config/application.yml:Z
scheduling-service:
build:
@ -456,6 +477,9 @@ services:
meldestelle-network:
aliases:
- "scheduling-service"
profiles: [ "backend", "all" ]
volumes:
- ./config/app/base-application.yaml:/workspace/config/application.yml:Z
# ==========================================
# FRONTEND
@ -465,7 +489,7 @@ services:
web-app:
build:
context: . # Wichtig: Root Context für Monorepo Zugriff
dockerfile: config/frontends/web-app/Dockerfile
dockerfile: config/docker/nginx/web-app/Dockerfile
args:
GRADLE_VERSION: "${DOCKER_GRADLE_VERSION:-9.1.0}"
JAVA_VERSION: "${DOCKER_JAVA_VERSION:-21}"
@ -489,7 +513,7 @@ services:
dummy_var: "prevent_empty_block"
# volumes:
# # Hot-Reloading der Nginx Config (Optional)
# - ./config/frontends/web-app/nginx.conf:/etc/nginx/nginx.conf:ro
# - ./config/docker/nginx/web-app/nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
api-gateway:
condition: "service_started"
@ -497,12 +521,13 @@ services:
meldestelle-network:
aliases:
- "web-app"
profiles: [ "gui", "all" ]
# --- DESKTOP-APP (optional) ---
desktop-app:
build:
context: .
dockerfile: config/frontends/desktop-app/Dockerfile
dockerfile: config/docker/nginx/desktop-app/Dockerfile
args:
BUILD_DATE: "${DOCKER_BUILD_DATE}"
labels:
@ -521,6 +546,7 @@ services:
meldestelle-network:
aliases:
- "desktop-app"
profiles: [ "gui", "all" ]
volumes:
postgres-data: