Reach Gitea as git.DOMAIN on the LAN and drop the forwarder
Everything on stpvm now reaches the Gitea LXC by its own name, GITEA_HOST (git.DOMAIN), pinned to its LAN IP: by extra_hosts in caddy, backend, usaco and silverbullet-git, and by /etc/hosts on the host for the runner, CI and Renovate. Public DNS for that name is Cloudflare, which only carries HTTPS, so the pin is what makes :3000 and :2222 work. The haproxy forwarder that kept localhost:3000/2222 working is gone, so stpvm no longer publishes those ports. The deploy and Renovate workflows and the runner script use the new name; the docs and the rollback notes follow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
+23
-47
@@ -34,8 +34,9 @@
|
||||
# the other.
|
||||
#
|
||||
# WHAT IS PUBLISHED TO THE HOST
|
||||
# Only caddy (80, 443), gitea (3000 HTTP, 2222 SSH: the forwarder to the
|
||||
# Gitea LXC) and the liquidsoap harbor port. Everything else is reachable only from inside app-network, which is
|
||||
# Only caddy (80, 443) and the liquidsoap harbor port. (Gitea's 3000 and
|
||||
# 2222 were published here until its forwarder went on 2026-11-24; Gitea
|
||||
# now answers on its own LXC as GITEA_HOST.) Everything else is reachable only from inside app-network, which is
|
||||
# why the backend, db, silverbullet and python have no `ports:` — they are
|
||||
# deliberately not exposed and are reached through Caddy. Web traffic can
|
||||
# also arrive through the `cloudflared` tunnel, which publishes nothing.
|
||||
@@ -157,6 +158,13 @@ services:
|
||||
- RADAR_UPSTREAM=${RADAR_UPSTREAM:-radar-web:80}
|
||||
# Zone -> Zone -> Read and Zone -> DNS -> Edit; see .env.example.
|
||||
- CLOUDFLARE_DNS_API_TOKEN=${CLOUDFLARE_DNS_API_TOKEN:-}
|
||||
# Gitea runs on its own LXC (the adamf/stpgit repo), and the registry at
|
||||
# the apex's /v2/ is still proxied from here. GITEA_HOST is its public
|
||||
# name; this pins it to the LXC's LAN IP so the hop stays on the LAN
|
||||
# (Docker's DNS cannot see LAN names, and public DNS would send it to
|
||||
# Cloudflare, which has nothing on :3000). Same pin on backend and usaco.
|
||||
extra_hosts:
|
||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||
networks:
|
||||
app-network:
|
||||
# The site's public names, resolving to this container for everything
|
||||
@@ -266,6 +274,9 @@ services:
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
# The Gitea activity feed (GITEA_HOST:GITEA_PORT); see caddy's extra_hosts.
|
||||
extra_hosts:
|
||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||
networks:
|
||||
- app-network
|
||||
env_file:
|
||||
@@ -472,14 +483,13 @@ services:
|
||||
restart: always
|
||||
networks:
|
||||
- app-network
|
||||
# The vault's remotes are ssh://git@DOMAIN:2222/..., but Caddy's network
|
||||
# aliases make DOMAIN resolve to Caddy on app-network, which has no :2222,
|
||||
# so every pull and push was refused. /etc/hosts wins over Docker's DNS, so
|
||||
# this sends DOMAIN back to the host, where the gitea forwarder publishes
|
||||
# 2222. The name
|
||||
# is unchanged, so known_hosts still matches.
|
||||
# The vault's remote is ssh://git@GITEA_HOST:2222/..., Gitea's SSH on its
|
||||
# own LXC. /etc/hosts wins over Docker's DNS, so this sends the name to
|
||||
# the LXC's LAN IP; public DNS would answer with Cloudflare, which has
|
||||
# nothing on 2222. silverbullet/ssh/known_hosts carries Gitea's host key
|
||||
# under that name.
|
||||
extra_hosts:
|
||||
- "${DOMAIN}:host-gateway"
|
||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||
# Same uid SilverBullet writes as, so commits don't leave root-owned objects
|
||||
# in .git that the host user can no longer clean up.
|
||||
user: "1000:1000"
|
||||
@@ -587,7 +597,7 @@ services:
|
||||
# that touches the site. Pin USACO_IMAGE_TAG to hold a version.
|
||||
#
|
||||
# It has no database: git is its store. It keeps a clone of adamf/usaco in
|
||||
# ./usaco-data, pulled over the Docker network when Gitea's push webhook
|
||||
# ./usaco-data, pulled from Gitea over the LAN when Gitea's push webhook
|
||||
# fires (USACO_WEBHOOK_SECRET signs it), and commits the admin's edits
|
||||
# (status, link, notes, statement, explanations) back with USACO_GIT_TOKEN.
|
||||
# CLAUDE_API_KEY powers the admin's Explain button (USACO_CLAUDE_MODEL picks
|
||||
@@ -615,8 +625,10 @@ services:
|
||||
restart: always
|
||||
stop_grace_period: 6m
|
||||
depends_on:
|
||||
- gitea
|
||||
- usaco-runner
|
||||
# Its clone of the repo (GIT_REMOTE_URL); see caddy's extra_hosts.
|
||||
extra_hosts:
|
||||
- "${GITEA_HOST}:${GITEA_UPSTREAM}"
|
||||
networks:
|
||||
- app-network
|
||||
- usaco-runner-net
|
||||
@@ -835,39 +847,3 @@ services:
|
||||
- /tmp
|
||||
volumes:
|
||||
- ./garage/garage.toml:/etc/garage.toml:ro
|
||||
|
||||
# Gitea's ports on this host, forwarded to Gitea itself, which runs in its
|
||||
# own LXC (the adamf/stpgit repo; DEPLOYMENT.md §7, "Gitea LXC"). A
|
||||
# plain TCP forwarder (gitea-forwarder/haproxy.cfg), kept under the old service and
|
||||
# container name so nothing that talked to Gitea here had to change:
|
||||
# Caddy's /gitea/ and /v2/ upstream and the backend's feed (GITEA_HOST,
|
||||
# GITEA_PORT), usaco's pulls, and on the host the runner and Renovate
|
||||
# (localhost:3000) and every repo's CI and the obsidian checkout
|
||||
# (localhost:2222, or DOMAIN:2222 pinned to the host).
|
||||
#
|
||||
# Gitea is also the CI server: .gitea/workflows/deploy.yaml redeploys this
|
||||
# whole stack on push to main, executed by the act_runner that lives
|
||||
# outside docker (gitea-runner/). Recreating this container drops git and
|
||||
# registry connections in flight for a moment, which is why its config is
|
||||
# small and rarely changes; Gitea itself is never restarted by a deploy.
|
||||
#
|
||||
# GITEA_UPSTREAM is the LXC's LAN IP. Dev has no Gitea: it points at a dummy
|
||||
# address and /gitea/ answers 502.
|
||||
gitea:
|
||||
image: haproxy:3.2.27-alpine
|
||||
container_name: "${GITEA_HOST}"
|
||||
restart: always
|
||||
networks:
|
||||
- app-network
|
||||
environment:
|
||||
- GITEA_UPSTREAM=${GITEA_UPSTREAM:?set GITEA_UPSTREAM in .env to the Gitea LXC's LAN IP}
|
||||
volumes:
|
||||
- ./gitea-forwarder/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
|
||||
ports:
|
||||
# 2222 = Gitea's built-in SSH server; clones use ssh://git@host:2222/...
|
||||
# — including the deploy workflow, which fetches from
|
||||
# ssh://git@localhost:2222.
|
||||
- "2222:2222"
|
||||
# 3000 = HTTP, published as well as proxied at /gitea/, because the
|
||||
# act_runner registers against http://localhost:3000 from the host.
|
||||
- "3000:3000"
|
||||
|
||||
Reference in New Issue
Block a user