Review of the logging work from the previous commit turned up a real correctness issue: the uncaughtException/unhandledRejection handlers logged the error but let the process keep running, which silently disabled Node's default crash-on-fatal-error behavior and could leave a zombie process serving broken requests instead of restarting. Both processes now log and then exit(1); restart: unless-stopped is added to both services so Docker actually brings them back up. Also: harden the logger against JSON.stringify throwing on non-serializable meta, log aborted (closed-before-finished) requests in the API access log, and stop the Next.js proxy from logging the Docker healthcheck's request to "/" every few seconds so real navigation events aren't drowned out. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
82 lines
1.9 KiB
YAML
82 lines
1.9 KiB
YAML
name: leistungsbilanz
|
|
|
|
services:
|
|
api:
|
|
build:
|
|
context: .
|
|
command:
|
|
- sh
|
|
- -c
|
|
- npm run db:migrate && npm run db:verify:circuit-schema && npm run dev:api
|
|
environment:
|
|
PORT: "3000"
|
|
CHOKIDAR_USEPOLLING: "true"
|
|
LOG_LEVEL: "${LOG_LEVEL:-info}"
|
|
init: true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "20m"
|
|
max-file: "10"
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- ./src:/app/src
|
|
- ./scripts:/app/scripts
|
|
- ./data:/app/data
|
|
- ./drizzle.config.ts:/app/drizzle.config.ts:ro
|
|
- ./tsconfig.json:/app/tsconfig.json:ro
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- node
|
|
- -e
|
|
- fetch('http://localhost:3000/health').then(response=>{if(!response.ok)process.exit(1)}).catch(()=>process.exit(1))
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 20s
|
|
|
|
web:
|
|
build:
|
|
context: .
|
|
command:
|
|
- npm
|
|
- run
|
|
- dev:web
|
|
- --
|
|
- --hostname
|
|
- 0.0.0.0
|
|
environment:
|
|
API_INTERNAL_URL: http://api:3000
|
|
WATCHPACK_POLLING: "true"
|
|
NEXT_TELEMETRY_DISABLED: "1"
|
|
LOG_LEVEL: "${LOG_LEVEL:-info}"
|
|
init: true
|
|
restart: unless-stopped
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "20m"
|
|
max-file: "10"
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
ports:
|
|
- "3001:3001"
|
|
volumes:
|
|
- ./src:/app/src
|
|
- ./next.config.mjs:/app/next.config.mjs:ro
|
|
- ./tsconfig.json:/app/tsconfig.json:ro
|
|
- ./tsconfig.next.json:/app/tsconfig.next.json:ro
|
|
healthcheck:
|
|
test:
|
|
- CMD
|
|
- node
|
|
- -e
|
|
- fetch('http://localhost:3001/').then(response=>{if(!response.ok)process.exit(1)}).catch(()=>process.exit(1))
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 12
|
|
start_period: 20s
|