diff --git a/docker-compose.yml b/docker-compose.yml index edcfaa8b6..3d621b511 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -18,7 +18,14 @@ services: ports: - "3000:3000" environment: - DATABASE_URL: "postgresql://healthlog:${POSTGRES_PASSWORD}@db:5432/healthlog?schema=public" + # connection_limit is set explicitly: Prisma's own default is + # cpu_count*2+1, which starves the combined web+worker process + # (HEALTHLOG_PROCESS_TYPE=all) under background AI/rollup load. Default + # 20 suits a small host; raise DB_CONNECTION_LIMIT on a busy one (keep it + # below the database's max_connections, leaving headroom for pg-boss, + # migrations, and backups). pool_timeout is the seconds a query waits for + # a free connection before erroring. + DATABASE_URL: "postgresql://healthlog:${POSTGRES_PASSWORD}@db:5432/healthlog?schema=public&connection_limit=${DB_CONNECTION_LIMIT:-20}&pool_timeout=${DB_POOL_TIMEOUT:-20}" NODE_ENV: production ENCRYPTION_KEY: "${ENCRYPTION_KEY}" ENCRYPTION_KEYS: "${ENCRYPTION_KEYS:-}"