forgejo-infra/README.md

40 lines
No EOL
1.7 KiB
Markdown

# Reproducible Forgejo + CI runner setup
This repository contains the declarative configuration for the Forgejo instance
and its self-hosted CI runner at `git.slaid098.dev`.
## What's here
- `compose/docker-compose.yml` — Forgejo + act_runner stack (env-var references; real secrets live in the deployment's `.env`).
- `compose/runner-config.yaml` — act_runner config (`capacity: 4`, cache enabled).
- `runner-image/Dockerfile` — custom job image bundling Python 3.13, uv, Node 22, ripgrep, git, docker CLI. Replaces the flaky `data.forgejo.org` action downloads (`setup-uv`, `setup-python`, `setup-node`).
- `.env.example` — placeholder env vars; copy to `.env` and fill in on the target host.
- `setup.sh` — one-command reproducible deploy on a fresh Ubuntu server.
## Why a custom runner image
`data.forgejo.org` (the action mirror act_runner uses) intermittently returns 404
for `astral-sh/setup-uv@v3` and similar actions, which surfaces as
`Error: Cannot find module '.../dist/setup/index.js'`. Bundling the tools in the
image and dropping those `uses:` steps from CI workflows eliminates the flakiness.
## Quick start
```bash
# On a fresh Ubuntu 22.04/24.04 server with docker + docker compose + git:
git clone https://git.slaid098.dev/slaid098/forgejo-infra.git
cd forgejo-infra
cp .env.example .env # then edit .env with real tokens
./setup.sh
```
After Forgejo is up, register the runner (token from
`docker exec forgejo forgejo actions generate-runner-token`):
```bash
cd /root/dockers/forgejo
docker compose run --rm runner act_runner register \
--instance http://forgejo:3000 --token <TOKEN> --name linux-2 \
--labels ubuntu-latest:docker://git.slaid098.dev/slaid098/runner:latest \
--no-interactive
```