976f5238f8
- internal .env loader (real env wins) + strictly validated config struct - ULID package: 48-bit ms timestamp + 80-bit crypto randomness, sortable - HTTP server with recovery/request-id/trusted-proxy/access-log middleware - /healthz, /readyz (pluggable checkers), /metricsz (counter registry) - multi-stage Dockerfile (alpine, non-root) + compose with healthchecks, app bound to 127.0.0.1:8787, mongo unpublished, graceful 15s shutdown Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
36 lines
812 B
YAML
36 lines
812 B
YAML
services:
|
|
mongo:
|
|
image: mongo:7
|
|
restart: unless-stopped
|
|
# Mongo is reachable only on the compose network; never published to the
|
|
# host (§12).
|
|
volumes:
|
|
- mongo-data:/data/db
|
|
healthcheck:
|
|
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping').ok"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 15s
|
|
|
|
app:
|
|
build: .
|
|
restart: unless-stopped
|
|
env_file: .env
|
|
environment:
|
|
MONGO_URI: mongodb://mongo:27017
|
|
ports:
|
|
- "127.0.0.1:${APP_PORT:-8787}:8787"
|
|
depends_on:
|
|
mongo:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8787/healthz"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
volumes:
|
|
mongo-data:
|