# ============================================================================= # gitea-forwarder/haproxy.cfg — haproxy config for the `gitea` service on stpvm. # # Gitea itself runs in its own LXC (the adamf/stpgit repo). This forwards # stpvm's Gitea ports to it, unchanged, at the TCP level: # :3000 HTTP — Caddy's /gitea/ and /v2/ routes, the backend's activity # feed and usaco's pulls reach it as gitea:3000 on # app-network; the runner and Renovate as localhost:3000. # :2222 SSH — every repo's CI (ssh://git@localhost:2222), the obsidian # checkout and silverbullet-git (DOMAIN:2222, pinned to this # host), and laptops using stpvm's tailnet name. # So nothing that talked to Gitea on stpvm had to change address. # # TCP mode, not HTTP: the bytes are passed through untouched, so Caddy's # X-Forwarded-For still reaches Gitea (which trusts one hop of it), SSH just # works, and there is no second body-size limit on registry uploads. # # GITEA_UPSTREAM is the LXC's LAN IP, set in the site's .env. An IP and not a # name: Docker's DNS cannot see tailnet or LAN names. # ============================================================================= global log stdout format raw local0 notice defaults mode tcp log global option tcplog timeout connect 5s # Inactivity timeouts, not total ones. A large clone or image layer upload # keeps bytes moving; an idle `git` waiting on a slow server-side pack # should not be cut off at a minute, so these are generous. timeout client 1h timeout server 1h # Start even if the upstream does not resolve yet (dev has no Gitea at # all); connections then fail rather than the container. default-server init-addr last,libc,none frontend http bind :3000 default_backend gitea_http frontend ssh bind :2222 default_backend gitea_ssh backend gitea_http server gitea "${GITEA_UPSTREAM}:3000" backend gitea_ssh server gitea "${GITEA_UPSTREAM}:2222"