diff --git a/gitea/.env.example b/gitea/.env.example index dde6b49..2b65aca 100644 --- a/gitea/.env.example +++ b/gitea/.env.example @@ -28,3 +28,8 @@ GITEA_SSH_DOMAIN= # file's extra_hosts). DOMAIN= EDGE_IP= + +# Token of Gitea's own Cloudflare tunnel (NOT the site's CLOUDFLARE_TUNNEL_TOKEN), +# from Zero Trust -> Networks -> Tunnels -> the stpgit tunnel. Used by the +# cloudflared service (profile `tunnel`), which serves https://git.DOMAIN. +GITEA_TUNNEL_TOKEN= diff --git a/gitea/docker-compose.yml b/gitea/docker-compose.yml index 076e95d..1fb31cf 100644 --- a/gitea/docker-compose.yml +++ b/gitea/docker-compose.yml @@ -124,3 +124,29 @@ services: depends_on: gitea-db: condition: service_healthy + + # Public HTTPS for git.DOMAIN through Gitea's OWN Cloudflare tunnel, so the + # public Gitea no longer passes through stpvm. Remotely managed: the + # hostname -> origin mapping (git.DOMAIN -> http://gitea:3000) lives in the + # Zero Trust dashboard and only the token is here. It must be a separate + # tunnel from the site's: connectors of one tunnel share all its hostnames, + # so a second connector here would be sent www traffic too. + # + # The tunnel carries HTTP only, with Cloudflare's 100 MB request-body cap, so + # SSH (2222), registry pushes and CI stay on the LAN/tailnet path above. + # + # Behind the `tunnel` profile until git.DOMAIN is the canonical address + # (ROOT_URL, the history-view protection), so a routine `docker compose up + # -d` does not publish it early: start it with + # docker compose --profile tunnel up -d + # and drop the profile once the cutover is done. + cloudflared: + image: cloudflare/cloudflared:2026.9.3 + container_name: gitea-cloudflared + profiles: ["tunnel"] + restart: always + command: ["tunnel", "--no-autoupdate", "run"] + environment: + - TUNNEL_TOKEN=${GITEA_TUNNEL_TOKEN:-} + depends_on: + - gitea