Move gitea/ to its own repo, adamf/stpgit
Test and deploy / test (push) Successful in 21s
Test and deploy / deploy (push) Successful in 13s

The Gitea LXC's compose file, entrypoint, app.ini template and env example
now live in adamf/stpgit, which the LXC checks out instead of this repo.
What stays here is stpvm's side: the haproxy forwarder, renamed to
gitea-forwarder/haproxy.cfg, and a copy of the entrypoint in
.deprecated/gitea/ so the stpvm rollback does not depend on the new repo.
Renovate now also covers adamf/stpgit, and the docs point there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 16:52:55 +00:00
co-authored by Claude Opus 5.5
parent fc777ba8b2
commit bb83c6bb03
15 changed files with 41 additions and 374 deletions
+4 -2
View File
@@ -53,17 +53,19 @@ DEPLOYMENT.md §7 ("Roll back to nginx") has the commands.
## gitea/ ## gitea/
Gitea as it ran inside this stack on stpvm until 2026-11-24, when it moved to Gitea as it ran inside this stack on stpvm until 2026-11-24, when it moved to
its own Proxmox LXC (`stpgit`, `gitea/docker-compose.yml`) and stpvm's its own Proxmox LXC (`stpgit`, run from the `adamf/stpgit` repo) and stpvm's
`gitea` service became a forwarder to it. `gitea` service became a forwarder to it.
- `docker-compose.gitea.yml` — the old service, with its state mounts - `docker-compose.gitea.yml` — the old service, with its state mounts
repointed at this directory. repointed at this directory.
- `entrypoint.sh` — its app.ini-seeding wrapper, copied here when `gitea/`
moved to its own repo, so the rollback does not depend on that repo.
- `data/` and `config/app.ini` (gitignored, on stpvm only) — the pre-move - `data/` and `config/app.ini` (gitignored, on stpvm only) — the pre-move
copy of the repositories and the live config, moved here from `gitea/`. copy of the repositories and the live config, moved here from `gitea/`.
Gitea's pre-move database is still the `gitea` database in stpvm's `db`. Gitea's pre-move database is still the `gitea` database in stpvm's `db`.
To bring it back on stpvm: stop Gitea on stpgit, copy anything pushed since To bring it back on stpvm: stop Gitea on stpgit, copy anything pushed since
the move back (its `gitea/data`, and a `pg_dump` of `gitea-db` restored into the move back (its `data/`, and a `pg_dump` of `gitea-db` restored into
`db`'s `gitea` database), then `db`'s `gitea` database), then
`docker compose -f docker-compose.yml -f .deprecated/gitea/docker-compose.gitea.yml up -d gitea`. `docker compose -f docker-compose.yml -f .deprecated/gitea/docker-compose.gitea.yml up -d gitea`.
The service still reads `POSTGRES_GITEA_DB` and the three `GITEA_*` The service still reads `POSTGRES_GITEA_DB` and the three `GITEA_*`
+2 -2
View File
@@ -2,7 +2,7 @@
# .deprecated/gitea/docker-compose.gitea.yml — Gitea as it ran on stpvm until # .deprecated/gitea/docker-compose.gitea.yml — Gitea as it ran on stpvm until
# 2026-11-24, kept as the rollback from the move to its own LXC. # 2026-11-24, kept as the rollback from the move to its own LXC.
# #
# STATUS: not live. Gitea runs on stpgit (gitea/docker-compose.yml); stpvm's # STATUS: not live. Gitea runs on stpgit (the adamf/stpgit repo); stpvm's
# `gitea` service is an haproxy forwarder to it. # `gitea` service is an haproxy forwarder to it.
# #
# This is the old service verbatim except for the two state mounts, which now # This is the old service verbatim except for the two state mounts, which now
@@ -68,7 +68,7 @@ services:
- ./.deprecated/gitea/config:/etc/gitea - ./.deprecated/gitea/config:/etc/gitea
# Mounted over the config dir so the wrapper script is available at the # Mounted over the config dir so the wrapper script is available at the
# path the overridden entrypoint points at. # path the overridden entrypoint points at.
- ./gitea/entrypoint.sh:/etc/gitea/entrypoint.sh:ro - ./.deprecated/gitea/entrypoint.sh:/etc/gitea/entrypoint.sh:ro
# Match the Pi's clock/zone so commit and CI timestamps are local time. # Match the Pi's clock/zone so commit and CI timestamps are local time.
- /etc/timezone:/etc/timezone:ro - /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro
+2 -2
View File
@@ -53,8 +53,8 @@ POSTGRES_TRACKER_USER=tracker
POSTGRES_TRACKER_PASSWORD= POSTGRES_TRACKER_PASSWORD=
# --- Gitea ------------------------------------------------------------------- # --- Gitea -------------------------------------------------------------------
# Gitea runs in its own LXC (gitea/docker-compose.yml, whose variables are in # Gitea runs in its own LXC (the adamf/stpgit repo, whose variables are in its
# gitea/.env.example). This stack's `gitea` service is a TCP forwarder to it. # .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 # 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 # 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). # (an IP, not a name: Docker's DNS cannot see LAN or tailnet names).
+1 -1
View File
@@ -64,7 +64,7 @@ jobs:
-e RENOVATE_PLATFORM=gitea \ -e RENOVATE_PLATFORM=gitea \
-e RENOVATE_ENDPOINT=http://localhost:3000/api/v1 \ -e RENOVATE_ENDPOINT=http://localhost:3000/api/v1 \
-e RENOVATE_GIT_URL=endpoint \ -e RENOVATE_GIT_URL=endpoint \
-e RENOVATE_REPOSITORIES=adamf/web_server \ -e RENOVATE_REPOSITORIES=adamf/web_server,adamf/stpgit \
-e RENOVATE_TOKEN \ -e RENOVATE_TOKEN \
-e GITHUB_COM_TOKEN \ -e GITHUB_COM_TOKEN \
-e LOG_LEVEL=info \ -e LOG_LEVEL=info \
-3
View File
@@ -16,13 +16,10 @@ usaco-data/
# flock taken by the deploy and maintenance workflows around docker compose # flock taken by the deploy and maintenance workflows around docker compose
.compose.lock .compose.lock
gitea/data/*
# Gitea's pre-move state, kept as the rollback (.deprecated/gitea/README) # Gitea's pre-move state, kept as the rollback (.deprecated/gitea/README)
.deprecated/gitea/data/ .deprecated/gitea/data/
.deprecated/gitea/config/ .deprecated/gitea/config/
.deprecated/gitea/dev-leftovers/ .deprecated/gitea/dev-leftovers/
gitea/config/app.ini
gitea/.env
# Gitea runner # Gitea runner
gitea-runner/.runner gitea-runner/.runner
+1 -1
View File
@@ -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`. **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** (`gitea/`): git, Actions and the image registry (`<DOMAIN>/adamf/...`) run in their own Proxmox LXC since 2026-11-24, from `gitea/docker-compose.yml` with their own Postgres (`gitea-db`) and `gitea/.env`, deployed by hand there and never by CI. This stack's `gitea` service is an haproxy TCP forwarder (`gitea/forwarder.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: "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. 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.
**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. **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.
+23 -21
View File
@@ -52,9 +52,9 @@ backend icecast2 gitea sb sb-pub python |
### Gitea runs in its own LXC ### Gitea runs in its own LXC
Gitea (git, Actions, the image registry) is not in this stack. It runs on a Gitea (git, Actions, the image registry) is not in this stack. It runs on a
separate Proxmox LXC, from `gitea/docker-compose.yml`, with its own Postgres separate Proxmox LXC, from its own repo (`adamf/stpgit`), with its own Postgres
(`gitea-db`); the runbook is "Gitea LXC" in §7. The `gitea` service here is (`gitea-db`); the runbook is that repo's README, summarised in "Gitea LXC" in §7.
an haproxy TCP forwarder (`gitea/forwarder.cfg`) from this host's 3000 and 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 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 that reached Gitea on stpvm still does at the same address:
@@ -420,8 +420,8 @@ of deleting the directory:
| `./icecast2/fallback_music` | Radio fallback MP3s | Copied to the host by hand, not git | | `./icecast2/fallback_music` | Radio fallback MP3s | Copied to the host by hand, not git |
| `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | Read-write to backend and silverbullet, **read-only** to silverbullet-public | | `${OBSIDIAN_DIR}` | The Obsidian vault (a git clone of the notes repo) | Read-write to backend and silverbullet, **read-only** to silverbullet-public |
Gitea's state (`gitea/data`, `gitea/config`, the `gitea_db` volume) is on Gitea's state (`data/`, `config/` and the `gitea_gitea_db` volume, in the
the Gitea LXC, not here; see "Gitea LXC" in §7. The pre-move copy is in `adamf/stpgit` checkout) is on the Gitea LXC, not here; see "Gitea LXC" in §7. The pre-move copy is in
stpvm's `.deprecated/gitea/` (gitignored), kept as the rollback. stpvm's `.deprecated/gitea/` (gitignored), kept as the rollback.
**Ephemeral:** anything else inside a container. Notably the Vue build, the **Ephemeral:** anything else inside a container. Notably the Vue build, the
@@ -442,7 +442,8 @@ Two distinct mechanisms read it, and services use both:
- **`env_file: ./.env`** — injects the whole file into the container. Used by - **`env_file: ./.env`** — injects the whole file into the container. Used by
backend, db and icecast2. backend, db and icecast2.
Gitea's own variables are in `gitea/.env` on the Gitea LXC (`gitea/.env.example`); Gitea's own variables are in the `.env` of its checkout on the Gitea LXC (the
`adamf/stpgit` repo's `.env.example`);
there it receives explicit `GITEA__section__KEY` variables (Gitea's own there it receives explicit `GITEA__section__KEY` variables (Gitea's own
convention for overriding `app.ini` keys). Here, `python` receives an explicit convention for overriding `app.ini` keys). Here, `python` receives an explicit
allow-list (as do `jobs`, `caddy` and the rest), so it never sees the database password or any API key other than allow-list (as do `jobs`, `caddy` and the rest), so it never sees the database password or any API key other than
@@ -677,39 +678,40 @@ Back up `garage_meta` and `garage_data` together (meta without data, or the
reverse, is useless); Garage also snapshots its metadata every 6h inside reverse, is useless); Garage also snapshots its metadata every 6h inside
`garage_meta`. `garage_meta`.
**Gitea LXC.** Gitea runs in its own Proxmox LXC (§1), from **Gitea LXC.** Gitea runs in its own Proxmox LXC (§1), from a checkout of its
`gitea/docker-compose.yml` in a checkout of this repo, with its secrets in own repo, `adamf/stpgit` (until 2026-11-24 this repo's `gitea/` directory),
`gitea/.env`. It is deployed by hand, never by CI: with its secrets in that checkout's `.env`. Its README is the full runbook.
It is deployed by hand, never by CI:
``` ```
cd ~/deploy/web_server/gitea && git pull && docker compose up -d cd ~/deploy/stpgit && git pull && docker compose up -d
``` ```
That includes a Renovate PR that bumps its image: merging deploys stpvm, not That includes a Renovate PR to that repo that bumps an image: merging deploys
the LXC, so pull and `up -d` here afterwards. nothing, so pull and `up -d` there afterwards.
- *The container.* Debian, unprivileged, with `nesting=1,keyctl=1` (Docker - *The container.* Debian, unprivileged, with `nesting=1,keyctl=1` (Docker
needs both), a static LAN IP on stpvm's bridge, Docker and Tailscale. needs both), a static LAN IP on stpvm's bridge, Docker and Tailscale.
`GITEA_UPSTREAM` in stpvm's `.env` is that LAN IP; `GITEA_SSH_DOMAIN` in `GITEA_UPSTREAM` in stpvm's `.env` is that LAN IP; `GITEA_SSH_DOMAIN` in
`gitea/.env` is its tailnet name, which Gitea prints in SSH clone URLs. the stpgit `.env` is its tailnet name, which Gitea prints in SSH clone URLs.
- *Webhooks to the site* (usaco's push hook, - *Webhooks to the site* (usaco's push hook,
`https://www.<DOMAIN>/usaco/api/hooks/gitea`) go straight to stpvm's Caddy `https://www.<DOMAIN>/usaco/api/hooks/gitea`) go straight to stpvm's Caddy
over the LAN: `extra_hosts` pins `www.<DOMAIN>` to `EDGE_IP`, and over the LAN: `extra_hosts` pins `www.<DOMAIN>` to `EDGE_IP`, and
`ALLOWED_HOST_LIST` allows that name, since its address is private. `ALLOWED_HOST_LIST` allows that name, since its address is private.
- *Backups.* A Proxmox `vzdump` of the whole LXC covers the git data and the - *Backups.* A Proxmox `vzdump` of the whole LXC covers the git data and the
database together. `gitea/data` alone is not a backup: the issues, PRs, database together. `data/` alone is not a backup: the issues, PRs,
users and registry index are in `gitea_db`. users and registry index are in `gitea_db`.
- *If it is down,* `/gitea/` and the registry are 502, CI does not run, and - *If it is down,* `/gitea/` and the registry are 502, CI does not run, and
image pulls fail; the site itself keeps serving. image pulls fail; the site itself keeps serving.
- *Moving it again* (or the first move, from stpvm): stop Gitea, `pg_dump -Fc` - *Moving it again* (or the first move, from stpvm): stop Gitea, `pg_dump -Fc`
its database and restore it with `pg_restore --no-owner --role=gitea` into its database and restore it with `pg_restore --no-owner --role=gitea` into
a fresh `gitea-db`, copy `gitea/data` and `gitea/config` with a fresh `gitea-db`, copy `data/` and `config/` with
`tar --numeric-owner` (owned by uid 1000), start it, then point `tar --numeric-owner` (owned by uid 1000), start it, then point
`GITEA_UPSTREAM` at the new address and `docker compose up -d gitea` on `GITEA_UPSTREAM` at the new address and `docker compose up -d gitea` on
stpvm. The SSH host key is in `gitea/data`, so clients' `known_hosts` still stpvm. The SSH host key is in `data/`, so clients' `known_hosts` still
match. match.
- *Rollback to running it on stpvm:* stop it on the LXC, copy its - *Rollback to running it on stpvm:* stop it on the LXC, copy its
`gitea/data` and database back over the pre-move copy in `data/` and database back over the pre-move copy in
`.deprecated/gitea/` and stpvm's `db`, then `.deprecated/gitea/` and stpvm's `db`, then
`docker compose -f docker-compose.yml -f .deprecated/gitea/docker-compose.gitea.yml up -d gitea`. `docker compose -f docker-compose.yml -f .deprecated/gitea/docker-compose.gitea.yml up -d gitea`.
`.deprecated/README.md` has the details. `.deprecated/README.md` has the details.
@@ -782,7 +784,7 @@ Documented, not fixed — each would change deploy behaviour.
and `./logs/nginx/`, plus the `logs/nginx` stanza in and `./logs/nginx/`, plus the `logs/nginx` stanza in
`/etc/logrotate.d/web_server`. The code is in `.deprecated/`. Once the `/etc/logrotate.d/web_server`. The code is in `.deprecated/`. Once the
rollback is no longer wanted, delete the two directories and the stanza. rollback is no longer wanted, delete the two directories and the stanza.
2. **`gitea/config/entrypoint.sh` is an empty, unused file** that would be 2. **`config/entrypoint.sh` in the stpgit checkout is an empty, unused,
mounted to the same in-container path as the real wrapper. It is currently root-owned file** that would be mounted to the same in-container path as
shadowed by an explicit file mount — fragile. Deleting it would be safe but the real wrapper. It is currently shadowed by an explicit file mount —
is a file removal. fragile. Deleting it (`sudo rm`) would be safe but is a file removal.
+1 -3
View File
@@ -111,9 +111,7 @@ check-compose:
echo "docker compose -f docker-compose.yml config -q"; \ echo "docker compose -f docker-compose.yml config -q"; \
docker compose --project-directory "$$pd" -f docker-compose.yml config -q; \ docker compose --project-directory "$$pd" -f docker-compose.yml config -q; \
echo "docker compose -f docker-compose.yml -f docker-compose.dev.yml config -q"; \ echo "docker compose -f docker-compose.yml -f docker-compose.dev.yml config -q"; \
docker compose --project-directory "$$pd" -f docker-compose.yml -f docker-compose.dev.yml config -q; \ docker compose --project-directory "$$pd" -f docker-compose.yml -f docker-compose.dev.yml config -q
echo "docker compose -f gitea/docker-compose.yml config -q (the Gitea LXC, against gitea/.env.example)"; \
docker compose -f gitea/docker-compose.yml --env-file gitea/.env.example config -q
# The edge config is validated by the image build itself (the last RUN in # The edge config is validated by the image build itself (the last RUN in
# caddy/Dockerfile runs `caddy validate` for the production and dev sites), so # caddy/Dockerfile runs `caddy validate` for the production and dev sites), so
+1 -8
View File
@@ -251,13 +251,7 @@ Create a `.env` file in the project root. All services read from this file.
### Gitea Config ### Gitea Config
Copy from the template and fill in secrets: 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`).
```sh
cp gitea/config/app.ini.template gitea/config/app.ini
```
Populate `LFS_JWT_SECRET`, `SECRET_KEY`, `INTERNAL_TOKEN`, `JWT_SECRET`, and the database `PASSWD`. Alternatively, the Gitea entrypoint generates `app.ini` from the template using environment variables.
### Spotify Token Setup ### Spotify Token Setup
@@ -339,7 +333,6 @@ These files are git-ignored and must be created manually:
| File | Notes | | File | Notes |
| ------------------------------- | --------------------------------------------------------------- | | ------------------------------- | --------------------------------------------------------------- |
| `.env` | See setup section above | | `.env` | See setup section above |
| `gitea/config/app.ini` | Copy from `app.ini.template` or let entrypoint generate it |
| `caddy/data/` | Created automatically by Caddy (certificates and their keys) | | `caddy/data/` | Created automatically by Caddy (certificates and their keys) |
| `backend/token/` | Created automatically by Docker volume mount | | `backend/token/` | Created automatically by Docker volume mount |
| `icecast2/fallback_music/*.mp3` | Place at least one MP3 file | | `icecast2/fallback_music/*.mp3` | Place at least one MP3 file |
+4 -4
View File
@@ -303,7 +303,7 @@ services:
# and activity trackers' databases. The postgres image only creates # and activity trackers' databases. The postgres image only creates
# POSTGRES_DB on first init; the others are created by hand (see their # POSTGRES_DB on first init; the others are created by hand (see their
# READMEs). Gitea's database is not here any more: it has its own Postgres # READMEs). Gitea's database is not here any more: it has its own Postgres
# in the Gitea LXC (gitea/docker-compose.yml). # in the Gitea LXC (the adamf/stpgit repo).
# Schema for the app DB comes from GORM auto-migration at backend start — # Schema for the app DB comes from GORM auto-migration at backend start —
# there are no migration files. # there are no migration files.
db: db:
@@ -837,8 +837,8 @@ services:
- ./garage/garage.toml:/etc/garage.toml:ro - ./garage/garage.toml:/etc/garage.toml:ro
# Gitea's ports on this host, forwarded to Gitea itself, which runs in its # Gitea's ports on this host, forwarded to Gitea itself, which runs in its
# own LXC (gitea/docker-compose.yml; DEPLOYMENT.md §7, "Gitea LXC"). A # own LXC (the adamf/stpgit repo; DEPLOYMENT.md §7, "Gitea LXC"). A
# plain TCP forwarder (gitea/forwarder.cfg), kept under the old service and # 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: # 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, # 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 # GITEA_PORT), usaco's pulls, and on the host the runner and Renovate
@@ -862,7 +862,7 @@ services:
environment: environment:
- GITEA_UPSTREAM=${GITEA_UPSTREAM:?set GITEA_UPSTREAM in .env to the Gitea LXC's LAN IP} - GITEA_UPSTREAM=${GITEA_UPSTREAM:?set GITEA_UPSTREAM in .env to the Gitea LXC's LAN IP}
volumes: volumes:
- ./gitea/forwarder.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro - ./gitea-forwarder/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg:ro
ports: ports:
# 2222 = Gitea's built-in SSH server; clones use ssh://git@host:2222/... # 2222 = Gitea's built-in SSH server; clones use ssh://git@host:2222/...
# — including the deploy workflow, which fetches from # — including the deploy workflow, which fetches from
@@ -1,7 +1,7 @@
# ============================================================================= # =============================================================================
# gitea/forwarder.cfg — haproxy config for the `gitea` service on stpvm. # gitea-forwarder/haproxy.cfg — haproxy config for the `gitea` service on stpvm.
# #
# Gitea itself runs in its own LXC (gitea/docker-compose.yml). This forwards # Gitea itself runs in its own LXC (the adamf/stpgit repo). This forwards
# stpvm's Gitea ports to it, unchanged, at the TCP level: # stpvm's Gitea ports to it, unchanged, at the TCP level:
# :3000 HTTP — Caddy's /gitea/ and /v2/ routes, the backend's activity # :3000 HTTP — Caddy's /gitea/ and /v2/ routes, the backend's activity
# feed and usaco's pulls reach it as gitea:3000 on # feed and usaco's pulls reach it as gitea:3000 on
-35
View File
@@ -1,35 +0,0 @@
# =============================================================================
# gitea/.env.example — variables for gitea/docker-compose.yml (the Gitea LXC).
#
# Copy to gitea/.env on the LXC and fill in. Separate from the site's .env on
# purpose: the LXC holds Gitea's secrets and nothing of the site's.
# NOTHING IN THIS FILE HAS A REAL VALUE.
# =============================================================================
# Gitea's own Postgres (the gitea-db service). Created on first init.
GITEA_DB_NAME=gitea
GITEA_DB_USER=gitea
GITEA_DB_PASSWORD=
# Passed as GITEA__section__KEY overrides so the committed app.ini.template
# can keep those fields blank. Moving from stpvm, copy the existing values
# from the site's .env (they had the same names there); a fresh install
# generates each as a long random string.
GITEA_INTERNAL_TOKEN=
GITEA_LFS_JWT_SECRET=
GITEA_OAUTH2_JWT_SECRET=
# This LXC's Tailscale MagicDNS name (e.g. stpgit.tailf20278.ts.net), shown in
# Gitea's SSH clone URLs. Becomes Gitea's SSH_DOMAIN and DOMAIN.
GITEA_SSH_DOMAIN=
# The site's public domain (no www), and stpvm's LAN IP, where Caddy listens.
# Webhooks to https://www.DOMAIN/... are sent there directly (see the compose
# 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=
-138
View File
@@ -1,138 +0,0 @@
; =============================================================================
; app.ini.template — seed configuration for Gitea, copied to app.ini on the
; FIRST boot on a host by gitea/entrypoint.sh and never touched again after.
;
; IMPORTANT: editing this file does nothing to a running install. Gitea owns
; ./gitea/config/app.ini (it rewrites it from the web UI) and that real file is
; gitignored because it accumulates generated secrets.
;
; SECRET FIELDS ARE DELIBERATELY BLANK HERE
; LFS_JWT_SECRET, PASSWD, SECRET_KEY and JWT_SECRET are empty on purpose so
; nothing sensitive is committed. Real values arrive at runtime as
; GITEA__section__KEY environment variables from gitea/.env (see
; gitea/docker-compose.yml), which override app.ini. SECRET_KEY is the exception —
; Gitea generates one itself on first run and writes it into the live app.ini.
;
; SETTINGS WORTH KNOWING
; ROOT_URL must match the public path Caddy serves Gitea at (/gitea/), or
; every link, clone URL and OAuth redirect Gitea emits will be wrong.
; START_SSH_SERVER = true with SSH_PORT 2222: the rootless image cannot bind
; 22 and cannot use the host's sshd, so Gitea runs its own Go SSH server.
; 2222 is published in gitea/docker-compose.yml (on the Gitea LXC) and
; forwarded on stpvm, so the deploy workflow still clones over
; ssh://git@localhost:2222.
; SSH_DOMAIN and DOMAIN are not set here: they come from GITEA_SSH_DOMAIN in
; gitea/.env (see gitea/docker-compose.yml). The value is the Gitea LXC's Tailscale
; MagicDNS name, not the public domain: SSH
; (22 and 2222) is not forwarded by the router, so the SSH clone URL Gitea
; shows only works from a device on the tailnet. HTTPS clones go through
; Caddy at ROOT_URL and stay public.
; REVERSE_PROXY_LIMIT = 1 / TRUSTED_PROXIES = * : trust exactly one hop of
; X-Forwarded-For, i.e. our Caddy, so Gitea logs real client IPs. Caddy
; sends a single entry, the visitor (its `proxy` snippet). stpvm's
; forwarder is TCP-level and adds no hop. This is only safe because Caddy
; is the sole edge (3000 on the LXC is reachable from the LAN and the
; tailnet, never from the internet).
; INSTALL_LOCK = true skips the first-run web installer.
; DISABLE_REGISTRATION = true — single-user instance; nobody can sign up.
; OFFLINE_MODE = true — no calls out to gravatar/CDNs.
; DB_TYPE postgres; the host, name and credentials come from gitea/.env
; (gitea/docker-compose.yml), pointing at its own `gitea-db` container.
; The HOST below is only the seed value. WORK_PATH/APP_DATA_PATH are /var/lib/gitea, the
; rootless image's layout (the root image uses /data instead).
; =============================================================================
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
RUN_MODE = prod
WORK_PATH = /var/lib/gitea
[repository]
ROOT = /var/lib/gitea/git/repositories
[repository.local]
LOCAL_COPY_PATH = /tmp/gitea/local-repo
[repository.upload]
TEMP_PATH = /tmp/gitea/uploads
[server]
APP_DATA_PATH = /var/lib/gitea
HTTP_PORT = 3000
ROOT_URL = https://adam-french.co.uk/gitea/
DISABLE_SSH = false
; In rootless gitea container only internal ssh server is supported
START_SSH_SERVER = true
SSH_PORT = 2222
SSH_LISTEN_PORT = 2222
BUILTIN_SSH_SERVER_USER = git
LFS_START_SERVER = true
LFS_JWT_SECRET =
OFFLINE_MODE = true
[database]
PATH = /var/lib/gitea/data/gitea.db
DB_TYPE = postgres
HOST = gitea-db:5432
NAME = gitea
USER = gitea
PASSWD =
SCHEMA =
SSL_MODE = disable
LOG_SQL = false
[session]
PROVIDER_CONFIG = /var/lib/gitea/data/sessions
PROVIDER = file
[picture]
AVATAR_UPLOAD_PATH = /var/lib/gitea/data/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /var/lib/gitea/data/repo-avatars
[attachment]
PATH = /var/lib/gitea/data/attachments
[log]
ROOT_PATH = /var/lib/gitea/data/log
MODE = console
LEVEL = info
[security]
INSTALL_LOCK = true
SECRET_KEY =
REVERSE_PROXY_LIMIT = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
PASSWORD_HASH_ALGO = pbkdf2
[service]
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = false
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost
[lfs]
PATH = /var/lib/gitea/git/lfs
[mailer]
ENABLED = false
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[cron.update_checker]
ENABLED = false
[repository.pull-request]
DEFAULT_MERGE_STYLE = merge
[repository.signing]
DEFAULT_TRUST_MODEL = committer
[oauth2]
JWT_SECRET =
-152
View File
@@ -1,152 +0,0 @@
# =============================================================================
# gitea/docker-compose.yml — Gitea and its database, on the Gitea LXC.
#
# WHAT IT DOES
# Runs the self-hosted git server (also the Actions server and the image
# registry) and a Postgres that holds nothing but Gitea's database. It does
# NOT run on stpvm: it runs in its own Proxmox LXC, so a bad deploy of the
# site stack, a site Postgres problem or load on stpvm cannot take down the
# git server and CI you would use to fix them. DEPLOYMENT.md §7, "Gitea
# LXC", is the runbook (setup, upgrade, backup, rollback).
#
# WHEN IT RUNS
# By hand, on the LXC, from this directory:
# cd ~/deploy/web_server/gitea && git pull && docker compose up -d
# Deliberately NOT by CI. The runner that would deploy it lives on stpvm and
# deploys stpvm; letting CI redeploy the server CI itself runs on is the
# coupling this split exists to remove. A Renovate PR that bumps the image
# below is therefore deployed by hand here after it merges.
#
# HOW THE SITE REACHES IT
# stpvm's stack keeps a `gitea` service, but it is a TCP forwarder
# (haproxy, gitea/forwarder.cfg) pointed at this host's LAN IP. So the Caddy
# routes, the registry at /v2/, the backend's activity feed, usaco's pulls,
# and everything on stpvm that says localhost:3000 or localhost:2222 (the
# runner, every repo's CI, Renovate, the obsidian checkout) still work
# unchanged. Clients on the tailnet can also use this host's own name.
#
# ENV VARS
# Read from ./.env in THIS directory (gitea/.env, gitignored), not the
# site's .env. gitea/.env.example lists them.
# =============================================================================
volumes:
# PERSISTENT: Gitea's relational data (users, issues, PRs, Actions runs,
# registry metadata). The git objects themselves are in ./data. Back the two
# up together: Proxmox's vzdump of the whole LXC does that.
gitea_db:
services:
# Postgres 16, the same major as the site's `db`, so the pg_dump taken
# there restores here with no surprises. Owned by its own `gitea` role, and
# POSTGRES_DB means the image creates the database on first init (it had to
# be created by hand in the shared instance).
gitea-db:
image: postgres:16
container_name: gitea-db
restart: always
environment:
- POSTGRES_USER=${GITEA_DB_USER:-gitea}
- POSTGRES_PASSWORD=${GITEA_DB_PASSWORD}
- POSTGRES_DB=${GITEA_DB_NAME:-gitea}
volumes:
- gitea_db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER}"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
# ROOTLESS image: runs as an unprivileged user, so config lives in /etc/gitea
# and data in /var/lib/gitea (not /data as in the root image) — that is why
# the bind mounts look unlike most Gitea compose examples.
#
# The GITEA__section__KEY environment convention is Gitea's own: each maps to
# an app.ini key and overrides the file at runtime, which is how the secrets
# stay in .env instead of in the committed app.ini.template.
#
# entrypoint is overridden to run our wrapper (which materialises app.ini
# from the template on first boot) before handing off to Gitea's real
# docker-entrypoint.sh. dumb-init is kept as PID 1 for correct signal/zombie
# handling, exactly as the stock image does it.
gitea:
image: docker.gitea.com/gitea:1.25.4-rootless
container_name: gitea
entrypoint: ["/usr/bin/dumb-init", "--", "/etc/gitea/entrypoint.sh"]
environment:
- GITEA__database__DB_TYPE=postgres
- GITEA__database__HOST=gitea-db:5432
- GITEA__database__NAME=${GITEA_DB_NAME:-gitea}
- GITEA__database__USER=${GITEA_DB_USER:-gitea}
- GITEA__database__PASSWD=${GITEA_DB_PASSWORD}
- GITEA__server__LFS_JWT_SECRET=${GITEA_LFS_JWT_SECRET}
- GITEA__security__INTERNAL_TOKEN=${GITEA_INTERNAL_TOKEN}
- GITEA__oauth2__JWT_SECRET=${GITEA_OAUTH2_JWT_SECRET}
# The name Gitea prints in SSH clone URLs: a tailnet MagicDNS name, since
# 2222 is not reachable from the internet. Blank means localhost.
- GITEA__server__SSH_DOMAIN=${GITEA_SSH_DOMAIN:-localhost}
- GITEA__server__DOMAIN=${GITEA_SSH_DOMAIN:-localhost}
# Webhooks are refused to private addresses by default ("external").
# The usaco site's push hook goes to https://www.DOMAIN/usaco/..., which
# extra_hosts below sends to stpvm's Caddy on the LAN, a private address,
# so that one name is allowed explicitly.
- GITEA__webhook__ALLOWED_HOST_LIST=external,www.${DOMAIN}
- USER_UID=1000
- USER_GID=1000
# Webhooks to the site go straight to Caddy on stpvm over the LAN rather
# than out through Cloudflare and back down the tunnel. Caddy still
# terminates TLS with the real certificate, so the name has to be the
# public one. The container does not read the LXC's /etc/hosts, hence here.
extra_hosts:
- "www.${DOMAIN}:${EDGE_IP}"
restart: always
volumes:
# PERSISTENT: repositories, LFS objects, avatars, sessions, the SSH host
# key, registry blobs. The git data itself.
- ./data:/var/lib/gitea
# PERSISTENT: app.ini is generated into this host directory on first boot
# and then edited by Gitea itself, so it is gitignored — only the
# template is committed.
- ./config:/etc/gitea
# Mounted over the config dir so the wrapper script is available at the
# path the overridden entrypoint points at.
- ./entrypoint.sh:/etc/gitea/entrypoint.sh:ro
# Match the host's clock/zone so commit and CI timestamps are local time.
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
# 2222 = Gitea's *built-in* SSH server (the rootless image cannot use 22).
# 3000 = HTTP. Both are reached by stpvm's forwarder over the LAN and by
# tailnet clients directly; neither is forwarded by the router.
- "2222:2222"
- "3000:3000"
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