Hostityourself/infra/docker-compose.yml
Claude a8b22d8e2d
fix: switch to Caddy JSON config so dynamic routes work correctly
The Caddyfile created a server with an auto-generated name, not 'hiy',
so build.sh's PUT to /config/apps/http/servers/hiy/routes was creating
a parallel server that never received traffic.

- Replace Caddyfile with caddy.json that names the server 'hiy' with
  the dashboard as a catch-all fallback route
- Insert app routes at index 0 so host-matched routes are evaluated
  before the catch-all dashboard fallback
- Update docker-compose to mount caddy.json and pass --config flag
2026-03-19 11:02:57 +00:00

63 lines
1.9 KiB
YAML

# HIY — local development stack
# Run with: docker compose up --build
#
# On a real Pi you would run Caddy as a systemd service; here it runs in Compose
# so you can develop without changing the host.
services:
# ── Control plane ─────────────────────────────────────────────────────────
server:
build:
context: ..
dockerfile: infra/Dockerfile.server
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- hiy-data:/data
# Mount Docker socket so the server can spawn build containers.
- /var/run/docker.sock:/var/run/docker.sock
# Mount the builder script so edits take effect without rebuilding.
- ../builder:/app/builder:ro
environment:
HIY_DATA_DIR: /data
HIY_ADDR: 0.0.0.0:3000
HIY_BUILD_SCRIPT: /app/builder/build.sh
CADDY_API_URL: http://caddy:2019
DOMAIN_SUFFIX: ${DOMAIN_SUFFIX:-localhost}
RUST_LOG: hiy_server=debug,tower_http=info
depends_on:
caddy:
condition: service_started
networks:
- hiy-net
- default
# ── Reverse proxy ─────────────────────────────────────────────────────────
caddy:
image: caddy:2-alpine
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "2019:2019" # admin API
volumes:
- ../proxy/caddy.json:/etc/caddy/caddy.json:ro
- caddy-data:/data
- caddy-config:/config
command: caddy run --config /etc/caddy/caddy.json
networks:
- hiy-net
- default
networks:
hiy-net:
name: hiy-net
# External so deployed app containers can join it.
external: false
volumes:
hiy-data:
caddy-data:
caddy-config: