forked from jappel/leistungsbilanz-ts
Adds a leveled JSON logger (error/warn/info/verbose/debug, controlled via LOG_LEVEL) wired into the Express API (access log, error middleware, crash handlers, memory heartbeat) and the Next.js server (page-request proxy, instrumentation crash handlers, heartbeat). LOG_LEVEL is exposed through compose.yaml, and both services now rotate their Docker logs (json-file, 20m x 10 files) instead of growing unbounded. Intended to capture long-running diagnostic data for the intermittent 502s seen on the Docker host. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
80 lines
1.8 KiB
YAML
80 lines
1.8 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
|
|
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
|
|
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
|