New services: - animaltrack.hcl: Python app with health checks and auto_revert - act-runner.hcl: Gitea Actions runner on Nomad New infrastructure: - nix-runner/: Custom Nix Docker image for CI with modern Nix, local cache (c3), and bundled tools (skopeo, jq, etc.) Modified: - gitea.hcl: Enable Gitea Actions The CI workflow (in animaltrack repo) builds Docker images with Nix, pushes to Gitea registry, and triggers Nomad deployments with automatic rollback on health check failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
76 lines
1.8 KiB
HCL
76 lines
1.8 KiB
HCL
# ABOUTME: Gitea Actions runner for CI/CD pipelines.
|
|
# ABOUTME: Runs containerized actions with Docker-in-Docker support.
|
|
|
|
# Setup required before running:
|
|
# sudo mkdir -p /data/services/act-runner
|
|
# nomad var put secrets/act-runner registration_token="<token-from-gitea-ui>"
|
|
|
|
job "act-runner" {
|
|
datacenters = ["alo"]
|
|
type = "service"
|
|
|
|
group "runner" {
|
|
network {
|
|
mode = "host"
|
|
}
|
|
|
|
task "runner" {
|
|
driver = "docker"
|
|
|
|
config {
|
|
image = "gitea/act_runner:latest"
|
|
network_mode = "host"
|
|
privileged = true
|
|
volumes = [
|
|
"/var/run/docker.sock:/var/run/docker.sock",
|
|
"/data/services/act-runner:/data",
|
|
"local/config.yaml:/.runner/config.yaml",
|
|
]
|
|
}
|
|
|
|
template {
|
|
destination = "local/config.yaml"
|
|
data = <<EOH
|
|
log:
|
|
level: info
|
|
runner:
|
|
file: /data/.runner
|
|
capacity: 2
|
|
timeout: 3h
|
|
labels:
|
|
- "ubuntu-latest:docker://node:20-bookworm"
|
|
- "nix:docker://nixos/nix:latest"
|
|
cache:
|
|
enabled: true
|
|
dir: /data/cache
|
|
container:
|
|
network: "host"
|
|
privileged: true
|
|
valid_volumes:
|
|
- /data/services/**
|
|
EOH
|
|
}
|
|
|
|
env {
|
|
GITEA_INSTANCE_URL = "https://gitea.v.paler.net"
|
|
GITEA_RUNNER_LABELS = "ubuntu-latest:docker://node:20-bookworm,nix:docker://gitea.v.paler.net/ppetru/nix-runner:v4"
|
|
}
|
|
|
|
# Template needed for nomadVar interpolation (secrets) and Nomad runtime vars
|
|
template {
|
|
destination = "secrets/env.env"
|
|
env = true
|
|
data = <<EOH
|
|
GITEA_RUNNER_REGISTRATION_TOKEN={{ with nomadVar "secrets/act-runner" }}{{ .registration_token }}{{ end }}
|
|
GITEA_RUNNER_NAME={{ env "NOMAD_ALLOC_ID" }}
|
|
EOH
|
|
}
|
|
|
|
resources {
|
|
cpu = 2000
|
|
memory = 2048
|
|
}
|
|
}
|
|
}
|
|
}
|