Raja's Exocortex

Gitea ACT Runner

Gitea ACT Runner is compatible with GitHub Actions, most of the workflow files can be easily ported over to Gitea with minimal customisation.

Note: the older method of using Drone CI is deprecated as the ACT Runner leverages the larger GitHub Actions ecosystem.

The ACT Runner must be setup on a standalone Ubuntu server, preferable a dedicated Proxmox LXC. Do not host any other docker containers or services on this server as ACT Runner needs to manage docker containers that will be used for hosting CI workloads.

ACT Runner Host Setup

The ACT Runner must be hosted on a separate Proxmox LXC running Ubuntu 24.04 server.

  1. LXC specs: Unlimited CPU, 16GB RAM, 50GB disk.
  2. OS: Ubuntu 24.04 LTS Server minimal. Run ubuntu-base and ubuntu-docker to prepare the host OS.
  3. Caching is enabled so workflows can store npm, composer, pip, etc dependencies locally.

Caching

  1. The ACT Runner supports Actions Cache to cache pip, npm, etc files.
  2. The ACT Runner uses an internal web server published on tcp:8080 and is used by the worker docker containers to store and retrieve cached files.
  3. The cache is not shared with CI workflow docker containers via bind mounting or other shared filesystem mechanisms.
  4. This means that runner workloads only need to reach tcp:8080 of the ACT Runner manager to access the cache.
  5. Cache is cleared periodically via an alpine container running cron (runs rm -rf /root/.cache/act/*).

Filename: docker-compose.yaml

# Filename: docker-compose.yaml
# Gitea ACT Runner, run on a dedicated Ubuntu 24.04 host
# To get a Registration Token from Gitea visit
# https://git.example.com/user/settings/actions/runners

name: git-example-com-act-runner

services:
  act-runner:
    image: docker.io/gitea/act_runner
    hostname: git-example-com-act-runner
    restart: always

	# We need this for CI runners to pull the action/cache files
	# See the `cache` section of config.yaml
    ports:
      - "8080:8080"

    environment:
      CONFIG_FILE: /config.yaml
      GITEA_INSTANCE_URL: https://git.example.com
      GITEA_RUNNER_REGISTRATION_TOKEN: TODO_SECRET_TOKEN

    volumes:
      - ./config.yaml:/config.yaml
      - ./runner:/runner
      - ./cache:/cache
      - ./cache-act:/root/.cache/act
      - /var/run/docker.sock:/var/run/docker.sock

    labels:
      - com.centurylinklabs.watchtower.enable=true
        
# clean the runner cache weekly
 cache-clear:
    hostname: git-example-com-act-runner-cache-clear
    image: alpine
    restart: always
    init: true
    
    command: ["/usr/sbin/crond", "-f", "-L", "/dev/stdout"]
    
    volumes:
      - ./cache-act:/root/.cache/act
      - ./crontab-root:/etc/crontabs/root:ro
      - /etc/localtime:/etc/localtime:ro
      
    labels:
      - com.centurylinklabs.watchtower.enable=true

Filename: config.yaml

# Gitea ACT Runner config file
# Filename: config.yaml

log:
  level: info

runner:
  file: /runner/runner.json
  capacity: 2
  env_file: .env
  timeout: 3h
  shutdown_timeout: 0s
  insecure: false
  fetch_timeout: 5s
  fetch_interval: 2s
  github_mirror: ''
  labels:
    - "ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest"
    - "ubuntu-22.04:docker://docker.gitea.com/runner-images:ubuntu-22.04"
    - "ubuntu-20.04:docker://docker.gitea.com/runner-images:ubuntu-20.04"

cache:
  enabled: true
  dir: "/cache"
  host: "169.254.254.169"
  port: 8080
  external_server: ""

container:
  network: ""
  privileged: false
  workdir_parent:
  valid_volumes: []
  force_pull: false
  force_rebuild: false
  require_docker: false
  docker_timeout: 0s

host:
  workdir_parent:

Filename: crontab-root

# Filename: /etc/crontabs/root
# Clean act cache every Sunday at 4am
# See: https://crontab.guru/#0_4_*_*_0

0 4 * * 0 rm -rf /root/.cache/act/*