Expose only the Lattice web app to the public internet. Keep OpenCode query and the sync worker private.
- Create a tunnel in Cloudflare Zero Trust.
- Map the hostname for Lattice to
http://web:3000. - Add a Cloudflare Access application for the same hostname.
- Require login with your preferred identity provider.
- Store the tunnel token in
CLOUDFLARE_TUNNEL_TOKEN.
The Docker Compose file includes an optional cloudflared service:
docker compose --env-file .env -f infra/docker/docker-compose.yml --profile cloudflare up -dFor the web app auth behavior itself:
- Set
WEB_AUTH_MODE=devandWEB_DEV_USER_EMAIL=you@example.comfor local development without Cloudflare. - Set
WEB_AUTH_MODE=cloudflarefor strict production-style auth that requires the Cloudflare Access email header. - Set
WEB_AUTH_MODE=autoonly when you intentionally want Cloudflare-authenticated traffic to fall back toWEB_DEV_USER_EMAILin non-Cloudflare environments.
- Do not publish
opencode-queryorsync-workerports on the host. - Access should happen at the Cloudflare edge before traffic reaches the origin.
WEB_AUTH_MODE=devis intended for local development only.- If you do expose the web port directly for local troubleshooting, keep that scoped to LAN-only access.