build: optimize Postgres container configuration for performance and stability

Updated `dc-infra.yaml` to enable automatic restart (`unless-stopped`), introduce dynamic memory allocations via environment variables, and adjust healthcheck intervals for reduced load. Enhanced `postgresql.conf` with performance tuning comments, schema search path inclusion for Keycloak and app users, and SSL adjustments for internal communication.
This commit is contained in:
2026-02-12 13:15:53 +01:00
parent f470e88e9f
commit 0ebcfaa3b7
2 changed files with 22 additions and 7 deletions
+14 -4
View File
@@ -9,7 +9,8 @@ services:
postgres:
image: "${POSTGRES_IMAGE:-postgres:16-alpine}"
container_name: "${PROJECT_NAME:-meldestelle}-postgres"
restart: no
# OPTIMIERUNG: Automatischer Neustart bei System-Reboot
restart: unless-stopped
ports:
- "${POSTGRES_PORT:-5432:5432}"
environment:
@@ -21,13 +22,22 @@ services:
- "./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" ]
# OPTIMIERUNG: Dynamische Speicherzuweisung via .env Overrides
command:
- "postgres"
- "-c"
- "config_file=/etc/postgresql/postgresql.conf"
- "-c"
- "shared_buffers=${POSTGRES_SHARED_BUFFERS:-256MB}"
- "-c"
- "effective_cache_size=${POSTGRES_EFFECTIVE_CACHE_SIZE:-768MB}"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}" ]
interval: "5s"
# OPTIMIERUNG: Höheres Intervall (10s), um Zora im Normalbetrieb zu entlasten
interval: "10s"
timeout: "5s"
retries: "5"
start_period: "10s"
start_period: "5s"
networks:
meldestelle-network:
aliases: