diff --git a/.env.example b/.env.example index ee93ff0..5c93756 100644 --- a/.env.example +++ b/.env.example @@ -16,7 +16,8 @@ # ---- PostgreSQL ---- DB_USER=ems_user DB_PASSWORD=change_me_strong_password - +# Limit současných připojení k DB (deploy/docker-compose + kořenové docker-compose). Výchozí v compose je 300. +# POSTGRES_MAX_CONNECTIONS=300 # ---- PostgREST ---- POSTGREST_JWT_SECRET=change_me_jwt_secret_min_32_chars # PostgREST anonymní role (viz db/migration/V009__postgrest_roles.sql + R__z_postgrest_ems_anon_grants.sql). diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 5aa1036..aa2ec68 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -10,6 +10,11 @@ services: db: image: timescale/timescaledb:2.26.1-pg18 restart: unless-stopped + # Výchozí max_connections=100 snadno nestačí (PostgREST, backend, psql, IDE, MCP). Zvýšení přes .env. + command: + - postgres + - -c + - max_connections=${POSTGRES_MAX_CONNECTIONS:-100} environment: POSTGRES_DB: ems POSTGRES_USER: ${DB_USER} diff --git a/docker-compose.yml b/docker-compose.yml index 822e47f..bf1cceb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,10 @@ services: db: image: timescale/timescaledb:2.26.1-pg18 restart: unless-stopped + command: + - postgres + - -c + - max_connections=${POSTGRES_MAX_CONNECTIONS:-300} environment: POSTGRES_DB: ems POSTGRES_USER: ${DB_USER}