Namespace-backed autoscaling for Forgejo Actions
- Go 95.5%
- Nix 4.1%
- Shell 0.4%
| .forgejo/workflows | ||
| .github/workflows | ||
| cmd | ||
| deploy | ||
| internal | ||
| .gitignore | ||
| autoscaler.example.yaml | ||
| config.example.yaml | ||
| flake.lock | ||
| flake.nix | ||
| go.mod | ||
| go.sum | ||
| README.md | ||
nsc-autoscaler
nsc-autoscaler turns queued Forgejo Actions jobs into short-lived Namespace
runners.
It ships two binaries:
forgejo-nsc-dispatcher: accepts explicit dispatch requests and launches runners for a Forgejo scope plus label set.forgejo-nsc-autoscaler: polls Forgejo queues, managesworkflow_jobwebhooks, and asks the dispatcher for runners when jobs queue up.
Layout
.
├── cmd/forgejo-nsc-dispatcher
├── cmd/forgejo-nsc-autoscaler
├── internal/
├── config.example.yaml
├── autoscaler.example.yaml
└── deploy/
Local use
cp config.example.yaml config.yaml
cp autoscaler.example.yaml autoscaler.yaml
nix develop
go run ./cmd/forgejo-nsc-dispatcher --config config.yaml
go run ./cmd/forgejo-nsc-autoscaler --config autoscaler.yaml
The checked-in examples are oriented around an on-host compatible.systems
deployment:
- Forgejo API on
http://127.0.0.1:3001 - public runner registration URL
https://compatible.systems - Namespace label allowlists for Linux, macOS, and Windows
- repository controllers for
conrad/nsc-autoscalerandconrad/rdq
The autoscaler examples use loopback webhook URLs, which works well when Forgejo and the autoscaler run on the same machine.
Nix outputs
nix build .#forgejo-nsc-dispatcher
nix build .#forgejo-nsc-autoscaler
nix build .#container-amd64
The container output packages the dispatcher plus the nsc CLI for Linux
deployments. The autoscaler is intended to run next to it as a separate process
or systemd unit.