A spare-machine Gitea forge, hardened, backed up and with CI, as a template. Personal values are placeholders listed in the README.
90 lines
5.5 KiB
Markdown
90 lines
5.5 KiB
Markdown
---
|
|
type: Roadmap
|
|
purpose: Carry the phased plan, its verify evidence, live risks and what stays out of scope.
|
|
answers:
|
|
- "What is this project building next, and how is each phase verified?"
|
|
cites:
|
|
- decisions/index.md
|
|
- compose.yml
|
|
---
|
|
|
|
# Mithlond Roadmap
|
|
|
|
Self-hosted Git server on a spare machine running Arch Linux. Gitea served publicly via your own domain with per-repository public/private control, plus an optional site on the apex domain. Work through the phases in order; each has a verify step. The step-by-step version is [guides/index.md](guides/index.md). See [CONTEXT.md](CONTEXT.md) for vocabulary.
|
|
|
|
## Locked decisions
|
|
|
|
The why-register: [decisions/index.md](decisions/index.md) — forge, database,
|
|
proxy, orchestration, DNS, SSH ports, manual backup format. How the pieces
|
|
connect: [ARCHITECTURE.md](ARCHITECTURE.md).
|
|
|
|
## Phases
|
|
|
|
### Phase 0 — Arch Linux base
|
|
- Install Arch Linux (headless, minimal)
|
|
- Create non-root user with sudo
|
|
- Install: `docker`, `docker-compose`, `ddclient`, `openssh`, `nftables`
|
|
- Harden SSH: key-only auth, move to port 2234 (`/etc/ssh/sshd_config`)
|
|
- Configure nftables: allow 22→2234, 80, 443, 2222; drop everything else inbound
|
|
- Enable services: `sshd`, `docker`, `nftables`
|
|
|
|
**Verify:** SSH into host on port 2234 with key only; password attempt rejected; `docker run hello-world` succeeds.
|
|
|
|
### Phase 1 — DNS and DDNS
|
|
- Point `git.example.com` A record to home IP in Cloudflare (DNS-only, grey cloud)
|
|
- Configure ddclient with Cloudflare API token, zone, record name
|
|
- Enable and start `ddclient` systemd service
|
|
|
|
**Verify:** `dig git.example.com` returns home IP; ddclient log shows successful update.
|
|
|
|
### Phase 2 — Gitea + Caddy deploy
|
|
- Write `compose.yml`: Gitea (SQLite) + Caddy services, volumes, network
|
|
- Write `Caddyfile`: `git.example.com` → `http://gitea:3000`, automatic TLS
|
|
- Router: forward external 80→80, 443→443, 2222→2222 to the server's LAN IP
|
|
- Start stack: `docker compose up -d`
|
|
- Complete Gitea install wizard (admin account, site URL, SSH clone URL with port 2222)
|
|
- Disable or require-approval for public registration
|
|
|
|
**Verify:** `https://git.example.com` loads with valid cert; create test repo; `git clone https://git.example.com/user/repo.git` from external machine succeeds; `git push` via SSH (`ssh -p 2222`) succeeds; public repo visible without login; private repo returns 404 without login.
|
|
|
|
### Phase 3 — Hardening
|
|
- fail2ban: protect admin SSH (port 2234) and Gitea login endpoint
|
|
- Gitea `app.ini`: disable raw git HTTP if not needed, set `[server] LFS_START_SERVER = false` unless needed
|
|
- Caddy security headers: `Strict-Transport-Security`, `X-Frame-Options`, `X-Content-Type-Options`
|
|
- Verify nftables rules survive reboot
|
|
|
|
**Verify:** 10 failed SSH attempts trigger fail2ban ban; 10 failed Gitea logins trigger ban; headers present in `curl -I https://git.example.com`.
|
|
|
|
### Phase 4 — Backup procedure
|
|
- Archive `gitea-data/` to the portable HDD and restore-test it — procedure in [guides/10-backup-manual.md](guides/10-backup-manual.md), scripted as `scripts/backup.sh`
|
|
|
|
**Verify:** Restore test completes successfully; repos and issues intact after restore from backup. Check: `integrity_check` ok, every repo fscks clean, a throwaway Gitea boots on the restored copy.
|
|
|
|
### Phase 4b — Automated backup
|
|
- Nightly restic snapshot of `gitea-data/` to the portable HDD via systemd timer, failure mail, weekly report — [guides/11-backup-automated.md](guides/11-backup-automated.md)
|
|
|
|
**Verify:** First run, restore test, failure mail and `check --read-data` all pass; timer enabled.
|
|
|
|
### Phase 5 — Optional site on the apex domain
|
|
- Build it as its own project (e.g. a portfolio) with its own compose stack and systemd unit — not a service in this `compose.yml`
|
|
- Caddy serves `example.com` → `portfolio:8000` over the shared external `edge` Docker network; `www` → 301 → apex
|
|
- Keep it stateless if you can, so there is nothing to back up
|
|
|
|
## Risks & gotchas
|
|
|
|
- **HDD failure** — an old spinning HDD is the highest failure risk. Manual backup to portable HDD is the only mitigation. Back up before any system update.
|
|
- **ISP blocks port 80/443** — some residential ISPs block these. Test early (Phase 2 step 1). Fallback: use port 8443 for HTTPS and tell git clients to use that port; Caddy can listen on any port.
|
|
- **Dynamic IP gap** — ddclient polls on an interval; short window where IP changes and DNS is stale. Mitigated by short TTL on Cloudflare A record (1 min minimum on free plan).
|
|
- **Arch rolling release** — system updates can break Docker or nftables. Pin Gitea image to a specific tag (e.g., `gitea/gitea:1.23`), not `latest`. Test updates on a spare machine or snapshot before applying.
|
|
- **Let's Encrypt rate limits** — 5 failed cert issuances per domain per hour. Test Caddy config with `acme_ca https://acme-staging-v02.api.letsencrypt.org/directory` staging endpoint first.
|
|
- **Thermal throttling** — an old laptop under sustained load may throttle. Monitor with `sensors` package; ensure cooling is adequate for always-on operation.
|
|
|
|
## Out of scope (v1)
|
|
|
|
- CI/CD — added later as an extra phase: Gitea Actions runner on the server, see [guides/12-gitea-actions.md](guides/12-gitea-actions.md)
|
|
- Container/package registry
|
|
- Email notifications from Gitea
|
|
- Off-site backup copy (left out by default — the drive shares fire/theft risk with the server; outbound-only `restic copy` if ever wanted — see [guides/11-backup-automated.md](guides/11-backup-automated.md))
|
|
- Gitea federation (ActivityPub)
|
|
- Multiple users / organization management
|