2026-08-17 13:40:09 +03:00

84 lines
2.2 KiB
YAML

# Reverse proxy / TLS edge — production single-node profile.
#
# Caddy is the only service published to the host. It terminates TLS (automatic
# HTTPS via ACME by default) and forwards to the admission gateway. All
# application ingress passes through the gateway's limits/rate-window; Caddy
# adds TLS, HSTS, and basic security headers. Included by compose.yaml.
#
# For an internal-only deployment set LAWSYNTH_TLS_MODE=internal to use Caddy's
# local CA instead of ACME.
configs:
caddyfile:
content: |
{
email {$LAWSYNTH_ACME_EMAIL}
admin off
}
# Plain-HTTP liveness endpoint for the container healthcheck (no TLS
# redirect). Not published to the host.
http://:2019 {
respond /healthz "ok" 200
respond 404
}
{$LAWSYNTH_DOMAIN} {
encode zstd gzip
header {
Strict-Transport-Security "max-age=31536000; includeSubDomains"
X-Content-Type-Options "nosniff"
X-Frame-Options "DENY"
Referrer-Policy "strict-origin-when-cross-origin"
-Server
}
# Application + API traffic to the admission gateway.
reverse_proxy gateway:8081 {
health_uri /v1/health
health_interval 10s
}
}
services:
proxy:
image: caddy:2-alpine
restart: unless-stopped
stop_grace_period: 30s
depends_on:
gateway:
condition: service_healthy
environment:
LAWSYNTH_DOMAIN: ${LAWSYNTH_DOMAIN:?set LAWSYNTH_DOMAIN in .env}
LAWSYNTH_ACME_EMAIL: ${LAWSYNTH_ACME_EMAIL:?set LAWSYNTH_ACME_EMAIL in .env}
ports:
- "${LAWSYNTH_HTTP_PORT:-80}:80"
- "${LAWSYNTH_HTTPS_PORT:-443}:443"
configs:
- source: caddyfile
target: /etc/caddy/Caddyfile
volumes:
- lawsynth_caddy_data:/data
- lawsynth_caddy_config:/config
healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:2019/healthz"]
interval: 15s
timeout: 5s
retries: 5
start_period: 10s
security_opt:
- no-new-privileges:true
logging:
driver: json-file
options: { max-size: "10m", max-file: "5" }
networks:
- lawsynth
networks:
lawsynth:
volumes:
lawsynth_caddy_data:
lawsynth_caddy_config: