Files
k3s/poc/gitea/stack-compose.yml
T
hermesandadmin 0a9e795b8f feat(hermes_infra/gitea): add second act_runner on rudolf-T (#53)
Closes #52.

Adds exactly one second act_runner on `rudolf-T`. The existing runner is constrained away from `rudolf-T`, so when that node is unavailable only the existing runner remains available. Both runners share the normal build label.

Validation: `docker stack config -c poc/gitea/stack-compose.yml` passes; the stack contains exactly two runner services.
Co-authored-by: rudolf <rudolfss13@gmail.com>
Co-authored-by: hermes <rudolfss13@gmail.com>
Co-authored-by: admin <rudolfss13@gmail.com>
Reviewed-on: admin/ansible#53
Co-authored-by: hermes <rudolfss13+hermes@gmail.com>
2026-10-08 22:04:58 +02:00

149 lines
4.2 KiB
YAML

# Gitea Actions stack. Uses a dedicated act_runner cache-server so that
# job-container networks can reach the cache backend via Swarm service DNS
# (gitea_cache_server:37051) instead of the unreachable IP the built-in
# cache server binds to per-job.
services:
server:
image: docker.gitea.com/gitea:1.27.3
# environment:
# - USER_UID=1000
# - USER_GID=1000
restart: always
networks:
- gitea
- nginx_ingress
volumes:
- /root/volumes/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
deploy:
placement:
constraints:
- node.hostname == odroid
ports:
- "3002:3000"
- "222:22"
runner:
image: docker.io/gitea/act_runner:nightly
entrypoint: ["/usr/local/bin/runner-run.sh"]
environment:
CONFIG_FILE: /cfg/config.yaml
GITEA_INSTANCE_URL: "https://gitea.rudolf.keenetic.link"
GITEA_RUNNER_REGISTRATION_TOKEN: "ojWqzQ4fj9GsLRIhnC7ELAV5Y5MYyhet36tno8fz"
GITEA_RUNNER_NAME: "runner1"
GITEA_RUNNER_LABELS: "runner_label1"
# GITEA_RUNNER_EPHEMERAL: "1"
ACT_RUNNER_EXTERNAL_SECRET_FILE: /run/secrets/gitea_cache_secret
networks:
- gitea
# - nginx_ingress
configs:
- source: runner_config
target: /cfg/config.yaml
mode: 0444
- source: runner_run
target: /usr/local/bin/runner-run.sh
mode: 0755
volumes:
- /var/run/docker.sock:/var/run/docker.sock
secrets:
- gitea_cache_secret
deploy:
placement:
constraints:
- node.hostname == odroid
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
runner_rudolf_t:
image: docker.io/gitea/act_runner:nightly
entrypoint: ["/usr/local/bin/runner-run.sh"]
environment:
CONFIG_FILE: /cfg/config.yaml
GITEA_INSTANCE_URL: "https://gitea.rudolf.keenetic.link"
GITEA_RUNNER_REGISTRATION_TOKEN: "ZIB6L21imA3XJkq65Cq1h43NzB5U1zhAJK9ybfCz"
GITEA_RUNNER_NAME: "runner2"
GITEA_RUNNER_LABELS: "runner_label1"
ACT_RUNNER_EXTERNAL_SECRET_FILE: /run/secrets/gitea_cache_secret
networks:
- gitea
configs:
- source: runner_config
target: /cfg/config.yaml
mode: 0444
- source: runner_run
target: /usr/local/bin/runner-run.sh
mode: 0755
volumes:
- /var/run/docker.sock:/var/run/docker.sock
secrets:
- gitea_cache_secret
deploy:
placement:
constraints:
- node.hostname == rudolf-T
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
cache_server:
# The image's /usr/local/bin/run.sh hardcodes `act_runner daemon` and
# ignores argv, so passing `cache-server` via `command` doesn't help —
# the daemon path is always taken. We replace the entrypoint by
# mounting our own script via a Swarm config (file mount), then have it
# substitute the Docker secret literal into a runtime copy of
# config.yaml's cache.external_secret and exec act_runner.
image: docker.io/gitea/act_runner:nightly
entrypoint: ["/usr/local/bin/cache-server-run.sh"]
environment:
ACT_RUNNER_EXTERNAL_SECRET_FILE: /run/secrets/gitea_cache_secret
networks:
- gitea
volumes:
- cache_data:/root/.cache/actcache
secrets:
- gitea_cache_secret
configs:
- source: runner_config
target: /cfg/config.yaml
mode: 0444
- source: cache_server_run
target: /usr/local/bin/cache-server-run.sh
mode: 0755
networks:
nginx_ingress:
external: true
gitea:
driver: overlay
driver_opts:
com.docker.network.driver.mtu: "1200"
configs:
runner_config:
file: ./config.yaml
cache_server_run:
file: ./cache-server-run.sh
runner_run:
file: ./runner-run.sh
secrets:
gitea_cache_secret:
# Create once before first deploy (or to rotate):
# echo -n "$SECRET" | docker secret create gitea_cache_secret -
# Then `docker stack deploy -c stack-compose.yml gitea`.
external: true
volumes:
# data:
# driver: local
# driver_opts:
# type: nfs
# o: addr=192.168.1.96
# device: :/root/volumes/gitea
# # device: :/media/DATA/runtime/gitea
cache_data: