Files
3dealer/docker-compose.yml
T
elviraandClaude Opus 5.5 6d88d53882 Infra: Caddy instead of nginx (plain swap, TLS stays in front)
Caddy 2.11.7 built with xcaddy, with caddy-ratelimit pinned to commit
5625512f (for M3/F7 later; its only tag is years old). Prod bakes
public/ and the config into the image (target caddy); dev uses the
caddy-base stage with docker/caddy and public/ bind-mounted.

It's a 1:1 swap for the host's TLS proxy: plain HTTP on
127.0.0.1:${APP_PORT:-8090}, auto_https off, and
trusted_proxies private_ranges so the proxy's X-Forwarded-* headers
still reach Laravel (checked: https + forwarded host in redirects, as
before). Narrow that range once it's known where TLS ends.

Carried over from nginx:
- php_fastcgi to app:9000, 300s read timeout, try_files to index.php
- /build, /static, /packages and /storage (from the storage volume)
  with Cache-Control "public, max-age=31536000, immutable"
- /sitemap.xml from storage/app, max-age=3600, application/xml
- X-Frame-Options SAMEORIGIN + X-Content-Type-Options nosniff
- 100 MiB upload limit (413 above, as before)
- dotfiles denied except /.well-known/
- /stoic/ proxied to stoic:2727, prefix stripped, cookie paths
  rewritten to /stoic/
- access log to stdout, favicon/robots not logged

Changed on purpose:
- FastCGI page cache dropped (and X-Cache-Status with it). The static
  page cache comes later (P2). It also replayed the first visitor's
  Set-Cookie (session + XSRF) to other guests, since it ignored
  Set-Cookie and keyed on URL only.
- New: zstd/gzip compression for text responses (nginx had none).
- Security headers now on every response; prod nginx dropped them on
  PHP responses and on 4xx/5xx.
- A missing file under the static paths is a plain 404 instead of
  Laravel's page with a 404 status.
- No Via or CGI Status header; one Content-Type on the sitemap (nginx
  sent two).
- Dropped as unneeded: open_file_cache, fastcgi buffers/keepalive,
  `charset utf-8` (Caddy's MIME types carry it where it matters).

Stoic's dev config called the app at http://nginx/validate; it's now
http://caddy/validate. bootstrap/app.php and .env.example comments
updated. docker/nginx/ is removed.

Not in this repo, not changed: boboko-test and the boboko starter
still use nginx.

Deploy note: the service is renamed nginx -> caddy; Envoy's
`up -d --remove-orphans` removes the old nginx container. Expect a few
seconds without a listener on 8090 while it swaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:01:13 +02:00

185 lines
6.1 KiB
YAML

name: ${COMPOSE_PROJECT_NAME:-boboko-starter}
services:
app:
build:
context: .
target: production
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
restart: unless-stopped
env_file: .env
environment:
DB_HOST: postgres
REDIS_HOST: valkey
REDIS_PORT: 6379
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: otlp
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
volumes:
- storage:/var/www/html/storage/app:rw
- logs:/var/www/html/storage/logs
- framework:/var/www/html/storage/framework
depends_on:
postgres:
condition: service_healthy
valkey:
condition: service_started
healthcheck:
test: ["CMD", "php-fpm8.5", "-t"]
interval: 5s
timeout: 5s
retries: 20
start_period: 60s
# Caddy (docker/caddy/Caddyfile), plain HTTP on 127.0.0.1 behind the
# host's TLS proxy, same port nginx used.
caddy:
build:
context: .
target: caddy
restart: unless-stopped
ports:
- "127.0.0.1:${APP_PORT:-8090}:80"
volumes:
- storage:/var/www/html/storage/app:ro
depends_on:
app:
condition: service_healthy
queue:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan queue:work --tries=3 --max-jobs=500 --memory=256
restart: unless-stopped
env_file: .env
environment:
DB_HOST: postgres
REDIS_HOST: valkey
REDIS_PORT: 6379
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: none
OTEL_LOGS_EXPORTER: none
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
volumes:
- storage:/var/www/html/storage/app
- logs:/var/www/html/storage/logs
- framework:/var/www/html/storage/framework
depends_on:
app:
condition: service_healthy
scheduler:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan schedule:work
restart: unless-stopped
env_file: .env
environment:
DB_HOST: postgres
REDIS_HOST: valkey
REDIS_PORT: 6379
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: none
OTEL_LOGS_EXPORTER: none
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
volumes:
- storage:/var/www/html/storage/app
- logs:/var/www/html/storage/logs
- framework:/var/www/html/storage/framework
depends_on:
app:
condition: service_healthy
postgres:
image: postgres:18-alpine
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_DATABASE:-boboko}
POSTGRES_USER: ${DB_USERNAME:-laravel}
POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required}
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${DB_USERNAME:-laravel} -d ${DB_DATABASE:-boboko}",
]
interval: 5s
timeout: 5s
retries: 10
valkey:
image: valkey/valkey:7.2.13
restart: unless-stopped
command: valkey-server --appendonly yes
volumes:
- valkeydata:/data
meilisearch:
image: getmeili/meilisearch:v1.12
restart: unless-stopped
environment:
MEILI_MASTER_KEY: ${MEILISEARCH_KEY:?MEILISEARCH_KEY is required}
MEILI_NO_ANALYTICS: "true"
volumes:
- meilidata:/meili_data
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"]
interval: 5s
timeout: 5s
retries: 10
stoic:
image: ghcr.io/lexx27/stoic:latest
# Runs as root — the app container's entrypoint.sh chowns the whole
# storage/ tree to www-data on every boot (docker/entrypoint.sh),
# and Stoic's own image user isn't www-data or in its group, so it
# can't write thumbnails into storage/app/public/stoic/ otherwise
# (libvips reports this as "Failed to write VipsImage to file").
# Same fix already applied in docker-compose.dev.yml.
user: root
ports:
- "127.0.0.1:${STOIC_PORT:-2727}:2727"
environment:
STOIC_CONFIG_DIR: /config/
STOIC_SECRET: ${STOIC_SECRET:?STOIC_SECRET is required}
STOIC_SSO_SECRET: ${STOIC_SSO_SECRET:?STOIC_SSO_SECRET is required}
volumes:
- ./docker/stoic/stoic_config.yml:/config/stoic_config.yml:ro
- ./resources/stoic/stoic_schemas.yml:/config/stoic_schemas.yml:ro
- ./resources/stoic/content:/content
- ./resources/stoic/media:/media
- storage:/var/www/html/storage/app
restart: unless-stopped
vector:
image: timberio/vector:latest-alpine
restart: unless-stopped
environment:
APP_ENV: ${APP_ENV:-production}
VICTORIALOGS_ENDPOINT: ${VICTORIALOGS_ENDPOINT:?VICTORIALOGS_ENDPOINT is required}
VICTORIALOGS_USER: ${VICTORIALOGS_USER:?VICTORIALOGS_USER is required}
VICTORIALOGS_PASSWORD: ${VICTORIALOGS_PASSWORD:?VICTORIALOGS_PASSWORD is required}
VECTOR_DANGEROUSLY_ALLOW_ENV_VAR_INTERPOLATION: "true"
volumes:
- ./docker/vector/vector.yaml:/etc/vector/vector.yaml:ro
- logs:/var/www/html/storage/logs:ro
- vector_data:/var/lib/vector
depends_on:
app:
condition: service_healthy
volumes:
pgdata:
storage:
logs:
framework:
valkeydata:
meilidata:
vector_data: