Namespace-backed autoscaling for Forgejo Actions
  • Go 95.5%
  • Nix 4.1%
  • Shell 0.4%
Find a file
2026-03-29 00:34:38 -07:00
.forgejo/workflows bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
.github/workflows bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
cmd bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
deploy bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
internal propagate autoscaler dispatch scope 2026-03-29 00:34:38 -07:00
.gitignore bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
autoscaler.example.yaml bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
config.example.yaml bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
flake.lock bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
flake.nix bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
go.mod bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
go.sum bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00
README.md bootstrap nsc-autoscaler 2026-03-28 23:57:07 -07:00

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, manages workflow_job webhooks, 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-autoscaler and conrad/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.