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:
@@ -73,6 +73,14 @@ secrets from `.env`; stpvm's `.env` still has them, so keep them there until
|
||||
this copy is deleted. Delete `data/`, `config/app.ini` and the old database once the LXC has run
|
||||
cleanly for a few weeks (from about 2026-12-08).
|
||||
|
||||
Since later on 2026-11-24 the stack has no `gitea` service at all (the
|
||||
forwarder is gone) and Gitea's address is `git.<DOMAIN>`, so a rollback
|
||||
also needs: `GITEA_HOST=gitea` in stpvm's `.env` (the containers'
|
||||
`extra_hosts` pin then becomes harmless), the `/gitea/` proxy route back in
|
||||
`caddy/routes.caddy` (revert `180f6ac`), `ROOT_URL` back to
|
||||
`https://<DOMAIN>/gitea/` in `config/app.ini` here, and the CI remotes,
|
||||
`.runner`'s address and Renovate's endpoint back to `localhost`.
|
||||
|
||||
The laptop's own leftovers (an old dev `gitea/data` and `app.ini`, and a
|
||||
stale `gitea-runner/.runner`) are under `dev-leftovers/` here, also
|
||||
gitignored, and can simply be deleted.
|
||||
|
||||
@@ -38,9 +38,10 @@ POSTGRES_TRACKER_USER=tracker
|
||||
POSTGRES_TRACKER_PASSWORD=dev-tracker-password
|
||||
|
||||
# --- Gitea -------------------------------------------------------------------
|
||||
# Dev has no Gitea: the forwarder points at a TEST-NET address that never
|
||||
# answers, so /gitea/ is a 502 and the home page's git feed is empty.
|
||||
GITEA_HOST=gitea
|
||||
# Dev has no Gitea: GITEA_HOST is pinned to a TEST-NET address that never
|
||||
# answers, so the home page's git feed is empty (and /gitea/ redirects to
|
||||
# git.localhost, which goes nowhere).
|
||||
GITEA_HOST=git.localhost
|
||||
GITEA_PORT=3000
|
||||
GITEA_UPSTREAM=192.0.2.1
|
||||
|
||||
|
||||
+7
-5
@@ -54,11 +54,13 @@ POSTGRES_TRACKER_PASSWORD=
|
||||
|
||||
# --- Gitea -------------------------------------------------------------------
|
||||
# Gitea runs in its own LXC (the adamf/stpgit repo, whose variables are in its
|
||||
# .env.example). This stack's `gitea` service is a TCP forwarder to it.
|
||||
# GITEA_HOST is that forwarder's container name AND the upstream host for
|
||||
# Caddy, the backend's feed and usaco. GITEA_UPSTREAM is the LXC's LAN IP
|
||||
# (an IP, not a name: Docker's DNS cannot see LAN or tailnet names).
|
||||
GITEA_HOST=gitea
|
||||
# .env.example); this stack has no Gitea container. GITEA_HOST is its public
|
||||
# name, used on its plain-HTTP port GITEA_PORT by Caddy's /v2/, the backend's
|
||||
# feed and usaco, and as the SSH host for silverbullet-git. GITEA_UPSTREAM is
|
||||
# the LXC's LAN IP, which those containers pin GITEA_HOST to (extra_hosts), so
|
||||
# the hop stays on the LAN instead of going to Cloudflare. On the host itself
|
||||
# (the runner, CI, Renovate) the same pin is a line in /etc/hosts.
|
||||
GITEA_HOST=git.adam-french.co.uk
|
||||
GITEA_PORT=3000
|
||||
GITEA_UPSTREAM=
|
||||
|
||||
|
||||
@@ -18,8 +18,9 @@
|
||||
# pinned to the same base images as backend/Dockerfile (golang:1.26) and
|
||||
# python/Dockerfile (python:3.12-slim). Bump them together.
|
||||
# - No `actions/checkout`. It is a JavaScript action and would need Node on
|
||||
# the host. The source is fetched with plain git instead, from the same
|
||||
# local Gitea SSH remote the deploy step has always used.
|
||||
# the host. The source is fetched with plain git instead, over Gitea's SSH
|
||||
# on its LXC (git.adam-french.co.uk:2222, pinned to the LAN IP in
|
||||
# stpvm's /etc/hosts).
|
||||
#
|
||||
# THE LIVE DIRECTORY IS NOT TOUCHED UNTIL TESTS PASS
|
||||
# The site runs out of /home/adamf/deploy/web_server. The test job never
|
||||
@@ -55,7 +56,7 @@ jobs:
|
||||
# parsed as shell.
|
||||
SHA: ${{ github.sha }}
|
||||
REF: ${{ github.ref }}
|
||||
REMOTE: ssh://git@localhost:2222/adamf/web_server.git
|
||||
REMOTE: ssh://git@git.adam-french.co.uk:2222/adamf/web_server.git
|
||||
GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no"
|
||||
# Bare repo kept between runs so each fetch is incremental (the
|
||||
# history is ~140MB; a fresh clone per push would be slow on the
|
||||
@@ -151,7 +152,7 @@ jobs:
|
||||
run: |
|
||||
set -eu
|
||||
git config --global --add safe.directory /home/adamf/deploy/web_server
|
||||
git fetch ssh://git@localhost:2222/adamf/web_server.git main
|
||||
git fetch ssh://git@git.adam-french.co.uk:2222/adamf/web_server.git main
|
||||
# Deploy only the commit the test job just passed. If main
|
||||
# has moved on since this run started, FETCH_HEAD is a newer
|
||||
# commit that THIS run never tested — stop, and let that
|
||||
|
||||
@@ -7,11 +7,12 @@
|
||||
# HOW IT RUNS
|
||||
# The same host-mode act_runner as deploy.yaml, so (as there) nothing but
|
||||
# git and docker is assumed on the host: Renovate runs from its own image.
|
||||
# --network host lets the container reach Gitea on localhost:3000, the port
|
||||
# the runner itself registers against, so this keeps working while Caddy or
|
||||
# the tunnel is down. RENOVATE_GIT_URL=endpoint matters for the same reason:
|
||||
# without it Renovate clones from the URL Gitea advertises, which is
|
||||
# ROOT_URL — the public https://…/gitea/ path.
|
||||
# --network host gives the container the host's /etc/hosts, which pins
|
||||
# git.adam-french.co.uk to the Gitea LXC's LAN IP, so it reaches Gitea on
|
||||
# :3000, the port the runner itself registers against, and keeps working
|
||||
# while the tunnel is down. RENOVATE_GIT_URL=endpoint matters for the same
|
||||
# reason: without it Renovate clones from the URL Gitea advertises, which is
|
||||
# ROOT_URL — the public https://git.adam-french.co.uk through Cloudflare.
|
||||
#
|
||||
# WHAT HAPPENS AFTER
|
||||
# Each update is pushed as a renovate/* branch, which triggers deploy.yaml's
|
||||
@@ -62,7 +63,7 @@ jobs:
|
||||
fi
|
||||
docker run --rm --pull always --network host \
|
||||
-e RENOVATE_PLATFORM=gitea \
|
||||
-e RENOVATE_ENDPOINT=http://localhost:3000/api/v1 \
|
||||
-e RENOVATE_ENDPOINT=http://git.adam-french.co.uk:3000/api/v1 \
|
||||
-e RENOVATE_GIT_URL=endpoint \
|
||||
-e RENOVATE_REPOSITORIES=adamf/web_server,adamf/stpgit \
|
||||
-e RENOVATE_TOKEN \
|
||||
|
||||
@@ -63,7 +63,7 @@ Dockerized multi-service personal website self-hosted on `stpvm` (an x86-64 Ubun
|
||||
|
||||
**Job tracker** (`jobs` service, `/jobs/`): the job application tracker, leads inbox, email pipeline and capture userscript now live in their own repo (`adamf/job-tracker` on Gitea) and run here as a published image, with their own Postgres database and role. It has no login: it asks the backend's `/auth/validate-admin` with the visitor's cookies. Nothing of it is left in `backend/`, `python/` or `vue/`; Caddy redirects the old `/cv/jobs`, `/cv/leads` and userscript URLs to `/jobs/`. A push to that repo's `main` publishes the image and rolls this stack's `jobs` container onto it; pin `JOBS_IMAGE_TAG` in `.env` to hold a version. Its variables are passed through the `jobs` service's explicit `environment:` list in `docker-compose.yml`.
|
||||
|
||||
**Gitea** (own repo, `adamf/stpgit`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from the `adamf/stpgit` repo (this repo's `gitea/` directory until then) with their own Postgres (`gitea-db`) and `.env`, deployed by hand there and never by CI. This stack's `gitea` service is an haproxy TCP forwarder (`gitea-forwarder/haproxy.cfg`) from stpvm's 3000/2222 to the LXC's LAN IP (`GITEA_UPSTREAM`), so `gitea:3000`, `localhost:3000` and `localhost:2222` still work for Caddy, the backend feed, usaco, the runner and every repo's CI. The act_runner stays on stpvm. Runbook: that repo's README, summarised in "Gitea LXC" in `DEPLOYMENT.md` §7.
|
||||
**Gitea** (own repo, `adamf/stpgit`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from the `adamf/stpgit` repo (this repo's `gitea/` directory until then) with their own Postgres (`gitea-db`) and `.env`, deployed by hand there and never by CI. Everything on stpvm reaches it as `GITEA_HOST` (`git.<DOMAIN>`, :3000 HTTP and :2222 SSH), pinned to the LXC's LAN IP (`GITEA_UPSTREAM`) by `extra_hosts` in containers and `/etc/hosts` on the host; public DNS for that name is Cloudflare, which carries only HTTPS. There is no Gitea container or forwarder in this stack since 2026-11-24. The act_runner stays on stpvm. Runbook: that repo's README, summarised in "Gitea LXC" in `DEPLOYMENT.md` §7.
|
||||
|
||||
**Uploads / Garage** (`garage/`): every stored file goes through one path. Frontend: `vue/src/uploads.js` (`uploadFile(file)` → URL, plus `ACCEPT` for pickers, `kindOf`, `isUploadUrl`, `tagFor`). Backend: `POST /api/uploads` (`handlers/handle_upload.go`), a thin wrapper over `services.Uploads.Save` (`services/uploads.go`), which owns the type table (`UploadTypes`), the 10MB limit, random naming and storage. A new feature that takes a file calls those, never its own endpoint. `GET /api/uploads` (admin only, `Uploads.List`, `listUploads()`) lists what is stored, bucket and disk merged, for `components/util/UploadPicker.vue`, the "choose an existing upload" modal used by the canvas's Background panel, Box editor and admin bar. Public files go to a bucket in a self-hosted Garage container (the `uploads` volume when `S3_ENDPOINT` is unset, or when Garage refuses a write). Caddy serves `/uploads/` from Garage's anonymous website endpoint first and the volume second, so the bucket is the source of truth and a Garage outage only affects bucket-only files. Private attachments (`/uploads/private/`) always stay on disk. `garage-webui` at `/garage/` (admin-gated) manages the bucket. First run on a fresh volume needs `garage/bootstrap.sh`; the full runbook is "Garage" in `DEPLOYMENT.md` §7.
|
||||
|
||||
|
||||
+20
-15
@@ -13,8 +13,8 @@ network, behind one Caddy (nginx and certbot until 2026-11-17).
|
||||
|
||||
## 1. Service topology
|
||||
|
||||
Only three things are reachable from outside the host: Caddy on 80/443, Gitea on
|
||||
3000/2222 (a forwarder to the Gitea LXC, below), and the liquidsoap harbor port. Everything else is internal. Web
|
||||
Only two things are reachable from outside the host: Caddy on 80/443 and the
|
||||
liquidsoap harbor port. (Gitea, below, is on its own LXC.) Everything else is internal. Web
|
||||
traffic can also come in through the Cloudflare tunnel (`cloudflared`), which
|
||||
dials out and publishes no port; see "Cloudflare Tunnel" in §3.
|
||||
|
||||
@@ -54,27 +54,33 @@ backend icecast2 gitea sb sb-pub python |
|
||||
Gitea (git, Actions, the image registry) is not in this stack. It runs on a
|
||||
separate Proxmox LXC, from its own repo (`adamf/stpgit`), with its own Postgres
|
||||
(`gitea-db`); the runbook is that repo's README, summarised in "Gitea LXC" in §7.
|
||||
The `gitea` service here is an haproxy TCP forwarder (`gitea-forwarder/haproxy.cfg`) from this host's 3000 and
|
||||
2222 to the LXC's LAN IP (`GITEA_UPSTREAM`), under the old container name, so
|
||||
everything that reached Gitea on stpvm still does at the same address:
|
||||
Everything here reaches it by one name, `GITEA_HOST`
|
||||
(`git.<DOMAIN>`), pinned to the LXC's LAN IP (`GITEA_UPSTREAM`): in
|
||||
containers by `extra_hosts`, and on the host by a line in `/etc/hosts`. Public
|
||||
DNS for that name points at Cloudflare, which carries only HTTPS, so without
|
||||
the pin SSH and port 3000 would go nowhere. (Until 2026-11-24 an haproxy
|
||||
forwarder here published 3000/2222 and everything used `localhost`.)
|
||||
|
||||
```
|
||||
stpvm Gitea LXC (LAN IP)
|
||||
stpvm (pin: git.DOMAIN -> LAN IP) Gitea LXC (LAN IP)
|
||||
caddy /v2/ (apex) ----+ +------------------+
|
||||
backend feed ----------+--> gitea:3000 (haproxy) ---> | gitea :3000 |
|
||||
usaco pulls -----------+ :2222 ------------> | :2222 |
|
||||
runner, Renovate localhost:3000 | gitea-db |
|
||||
CI, obsidian localhost:2222 / DOMAIN:2222 +--------+---------+
|
||||
backend feed ----------+--> git.DOMAIN:3000 --------> | gitea :3000 |
|
||||
usaco pulls -----------+ | |
|
||||
runner, Renovate git.DOMAIN:3000 (/etc/hosts) ----> | |
|
||||
CI, silverbullet-git, obsidian git.DOMAIN:2222 ----> | :2222 |
|
||||
| gitea-db |
|
||||
usaco <-- caddy <-- https://www.DOMAIN/usaco/api/hooks/gitea --+ (webhook,
|
||||
over the LAN)
|
||||
```
|
||||
|
||||
A new machine or container that talks to Gitea needs the same pin, or a
|
||||
`~/.ssh/config` entry pointing the name at the tailnet name `stpgit` for SSH.
|
||||
|
||||
Gitea's public address is `https://git.<DOMAIN>/` (its `ROOT_URL`), served by
|
||||
the LXC's own Cloudflare tunnel, not by this edge; Caddy only 301s the old
|
||||
`/gitea/*` URLs there and still proxies the registry at the apex's `/v2/`.
|
||||
The LXC is also on the tailnet, so a laptop can use its own name directly.
|
||||
Deploys of this stack never restart Gitea; recreating the forwarder only
|
||||
drops connections in flight.
|
||||
Deploys of this stack never touch Gitea.
|
||||
|
||||
### Who listens where
|
||||
|
||||
@@ -90,7 +96,6 @@ drops connections in flight.
|
||||
| jobs (job tracker, published image) | `jobs` | 8080 | `/jobs/` (admin-gated by Caddy `forward_auth`; capture API and userscript public, bearer-token) | no |
|
||||
| activity-tracker (published image, adamf/ccp) | `activity-tracker` | 8080 | `/tracker/`, prefix stripped (pages admin-gated by Caddy `forward_auth`; `/api/v1/` bearer/app-checked) | no |
|
||||
| icecast2 + liquidsoap | `${ICECAST_HOST}` | `${ICECAST_PORT}` | `/radio/` | **harbor port only** |
|
||||
| gitea (haproxy forwarder to the Gitea LXC) | `${GITEA_HOST}` | 3000, 2222 | the registry at the apex `/v2/` (`/gitea/*` 301s to `git.<DOMAIN>`) | **3000, 2222** |
|
||||
| vue | `vue` | 5173 (dev only) | `/` (dev only) | no |
|
||||
| cloudflared | `cloudflared` | — (fixed IP `172.28.255.250`) | all of Caddy, via Cloudflare | no (outbound only) |
|
||||
| dozzle (log viewer) | `dozzle` | 8080 | `/dozzle/` (admin-gated by Caddy `forward_auth`; reads the Docker socket) | no |
|
||||
@@ -188,8 +193,8 @@ which has two jobs:
|
||||
leaves the old containers running.
|
||||
- **`deploy`** runs only on `main`, only after `test` passes, and only if the
|
||||
tested commit is still the tip of `main` (so an older run cannot deploy a
|
||||
newer, untested commit). It fetches over `ssh://git@localhost:2222` (the
|
||||
forwarder to the Gitea LXC),
|
||||
newer, untested commit). It fetches over `ssh://git@git.<DOMAIN>:2222` (Gitea
|
||||
on its LXC, pinned in `/etc/hosts`),
|
||||
hard-resets the deploy checkout, and runs
|
||||
`docker compose up -d --build --remove-orphans` under the
|
||||
`.compose.lock` flock, shared with the weekly maintenance workflow.
|
||||
|
||||
@@ -251,7 +251,7 @@ Create a `.env` file in the project root. All services read from this file.
|
||||
|
||||
### Gitea Config
|
||||
|
||||
Gitea is not part of this stack. It runs in its own LXC from the `adamf/stpgit` repo, whose README covers its config; this stack only runs a forwarder to it (`gitea-forwarder/haproxy.cfg`).
|
||||
Gitea is not part of this stack. It runs in its own LXC from the `adamf/stpgit` repo, whose README covers its config; this stack reaches it as `GITEA_HOST`, pinned to its LAN IP (`GITEA_UPSTREAM`).
|
||||
|
||||
### Spotify Token Setup
|
||||
|
||||
|
||||
+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"
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
# =============================================================================
|
||||
# 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"
|
||||
+12
-8
@@ -4,7 +4,7 @@
|
||||
#
|
||||
# WHAT IT DOES
|
||||
# 1. Downloads the act_runner binary if it is not already present.
|
||||
# 2. Blocks until Gitea answers on http://localhost:3000.
|
||||
# 2. Blocks until Gitea answers on http://git.adam-french.co.uk:3000.
|
||||
# 3. Registers with Gitea the first time only.
|
||||
# 4. execs the runner daemon in the foreground.
|
||||
#
|
||||
@@ -19,9 +19,13 @@
|
||||
# starting the daemon against a Gitea that is not up yet fails permanently
|
||||
# rather than retrying, so the loop polls (forever, by design — there is no
|
||||
# sensible timeout when the answer is "wait longer") until Gitea responds.
|
||||
# It targets localhost:3000, the port docker-compose.yml publishes directly,
|
||||
# NOT the public /gitea/ path through Caddy — so the runner keeps working
|
||||
# even while TLS or Caddy is broken.
|
||||
# It targets git.adam-french.co.uk:3000, Gitea's plain-HTTP port on its own
|
||||
# LXC, which stpvm's /etc/hosts pins to the LXC's LAN IP — NOT the public
|
||||
# https://git.adam-french.co.uk through Cloudflare — so the runner keeps
|
||||
# working while the tunnel or the internet link is down. (It was
|
||||
# localhost:3000, the forwarder's port, until 2026-11-24. An existing
|
||||
# .runner keeps the address it registered with: edit its "address" field to
|
||||
# move it, as was done then.)
|
||||
#
|
||||
# THE REGISTRATION TOKEN (one-shot, and easy to get wrong)
|
||||
# GITEA_RUNNER_REGISTRATION_TOKEN comes from ./.env and is generated in the
|
||||
@@ -51,18 +55,18 @@ if [ ! -f ./act_runner ]; then
|
||||
bash "$(dirname "$0")/download.sh"
|
||||
fi
|
||||
|
||||
echo "Waiting for localhost:3000 to respond..." >&2
|
||||
echo "Waiting for git.adam-french.co.uk:3000 to respond..." >&2
|
||||
|
||||
while ! curl -sf http://localhost:3000 > /dev/null 2>&1; do
|
||||
while ! curl -sf http://git.adam-french.co.uk:3000 > /dev/null 2>&1; do
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "localhost:3000 is up." >&2
|
||||
echo "git.adam-french.co.uk:3000 is up." >&2
|
||||
|
||||
if [ ! -f .runner ]; then
|
||||
echo "No .runner file found. Registering runner..." >&2
|
||||
./act_runner register --no-interactive \
|
||||
--instance http://localhost:3000 \
|
||||
--instance http://git.adam-french.co.uk:3000 \
|
||||
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
||||
--name "${GITEA_RUNNER_NAME:-pi-runner}" \
|
||||
--labels self-hosted
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
<rect class="dg-box dg-box--tint" x="480" y="414" width="180" height="56" rx="4" />
|
||||
<text class="dg-title" x="570" y="434" text-anchor="middle">GITEA</text>
|
||||
<text class="dg-code" x="570" y="451" text-anchor="middle">:3000 http · :2222 ssh</text>
|
||||
<text class="dg-small" x="570" y="465" text-anchor="middle" style="fill: var(--color-tertiary)">both published</text>
|
||||
<text class="dg-small" x="570" y="465" text-anchor="middle" style="fill: var(--color-tertiary)">on the stpgit LXC</text>
|
||||
<path class="dg-edge" d="M400,437 H476" />
|
||||
<text class="dg-edge-label dg-edge-label--mint" x="440" y="430" text-anchor="middle">/v2/</text>
|
||||
<path class="dg-edge dg-edge--green dg-edge--both-green" d="M520,392 V410" />
|
||||
@@ -245,7 +245,7 @@
|
||||
<text class="dg-title dg-title--pink" x="1093" y="422" text-anchor="middle">ACT_RUNNER</text>
|
||||
<text class="dg-small" x="1093" y="439" text-anchor="middle">outside Docker, host mode</text>
|
||||
<text class="dg-code" x="1093" y="457" text-anchor="middle">gitea-runner/run.sh</text>
|
||||
<text class="dg-small" x="1093" y="475" text-anchor="middle">polls localhost:3000,</text>
|
||||
<text class="dg-small" x="1093" y="475" text-anchor="middle">polls git.DOMAIN:3000,</text>
|
||||
<text class="dg-small" x="1093" y="489" text-anchor="middle">runs docker compose</text>
|
||||
<path class="dg-edge dg-edge--pink" d="M1093,400 V360" />
|
||||
<text class="dg-edge-label dg-edge-label--pink" x="1099" y="384">compose up</text>
|
||||
|
||||
Reference in New Issue
Block a user