Files
ansible-role-gitea/templates/runner-compose.yaml.j2
claudeandClaude Opus 5.5 96e5b92bec
Demo / hello (push) Successful in 16s
Runner: turn on the Actions dependency cache (G8)
The runner's built-in cache server now backs actions/cache.

- In the cluster, cache blobs go on a new PVC (gitea-actions-cache, 20Gi,
  default storage class) mounted at /cache in the runner container, so the
  cache survives runner restarts. The role creates the PVC before the
  Helm release. NFS doesn't enforce the size; the runner's own expiry
  (unused 7 days, or older than 30 days) keeps it bounded.
- Fixed port 8088. Job containers reach it at the pod IP, which DinD's
  per-job networks route to because DinD shares the pod's network.
- The dedicated-host runner gets the same config, with the cache on a
  bind mount under gitea_actions_host_dir.
- gitea_actions_cache_enabled: false turns it all off again.

Refs DevOps/software-infrastructure#56

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-17 09:22:21 -05:00

86 lines
2.9 KiB
Django/Jinja

# {{ ansible_managed }}
# Gitea Actions runner on a dedicated host (tasks/actions_host.yaml).
name: gitea-runner
x-logging: &logging
driver: json-file
options:
max-size: 10m
max-file: "3"
services:
# Private Docker daemon for jobs, separate from the host's own Docker.
dind:
image: {{ gitea_actions_host_dind_image }}
privileged: true
restart: unless-stopped
command: ["--host=unix:///run/dind/docker.sock"]
environment:
# No TCP listener, so no TLS certificates are needed.
DOCKER_TLS_CERTDIR: ""
volumes:
- {{ gitea_actions_host_docker_data }}:/var/lib/docker
- docker-socket:/run/dind
healthcheck:
test: ["CMD", "docker", "-H", "unix:///run/dind/docker.sock", "info", "--format", "{{ '{{' }}.ID{{ '}}' }}"]
interval: 10s
timeout: 10s
retries: 30
start_period: 10s
# Jobs run inside this container, so these caps are the jobs' budget.
# cpu_shares below the default 1024 lets the host's other containers win
# when CPU is short.
cpus: {{ gitea_actions_host_dind_cpus }}
cpu_shares: {{ gitea_actions_host_dind_cpu_shares }}
mem_limit: {{ gitea_actions_host_dind_memory }}
memswap_limit: {{ gitea_actions_host_dind_memory }}
logging: *logging
runner:
image: {{ gitea_actions_host_runner_image }}
restart: unless-stopped
# Jobs that are running get shutdown_timeout to finish and
# report_close_timeout to report; give both before Docker kills it.
stop_grace_period: {{ gitea_actions_host_stop_grace_period }}
depends_on:
dind:
condition: service_healthy
environment:
GITEA_INSTANCE_URL: {{ gitea_actions_host_instance_url }}
GITEA_RUNNER_NAME: {{ gitea_actions_host_runner_name }}
GITEA_RUNNER_REGISTRATION_TOKEN_FILE: /token/registration-token
CONFIG_FILE: /runner/config.yaml
DOCKER_HOST: unix:///run/dind/docker.sock
TZ: Etc/UTC
volumes:
- ./config.yaml:/runner/config.yaml:ro
- ./data:/data
- ./token:/token:ro
- {{ gitea_actions_host_cache_dir }}:{{ gitea_actions_cache_dir }}
- docker-socket:/run/dind
mem_limit: 512m
logging: *logging
prune:
image: {{ gitea_actions_prune_image }}
restart: unless-stopped
entrypoint: ["/bin/sh", "/prune/docker-prune.sh"]
depends_on:
dind:
condition: service_healthy
environment:
DOCKER_HOST: unix:///run/dind/docker.sock
PRUNE_INTERVAL_SECONDS: "{{ gitea_actions_prune_interval_seconds }}"
PRUNE_MAX_AGE_MINUTES: "{{ gitea_actions_prune_max_age_minutes }}"
PRUNE_IMAGES_ABOVE_GB: "{{ gitea_actions_host_prune_images_above_gb }}"
PRUNE_KEEP_IMAGES: "{{ gitea_actions_prune_keep_images | join(' ') }}"
volumes:
- ./docker-prune.sh:/prune/docker-prune.sh:ro
- docker-socket:/run/dind
cpus: 0.2
mem_limit: 128m
logging: *logging
volumes:
docker-socket: