### Run with Configuration File Source: https://github.com/gitea/runner/blob/main/README.md Examples of running Gitea Runner commands with a specified configuration file. ```bash ./gitea-runner -c config.yaml register ./gitea-runner -c config.yaml daemon ./gitea-runner -c config.yaml cache-server ``` -------------------------------- ### Runner Registration Process Example Source: https://github.com/gitea/runner/blob/main/README.md Example output of the interactive runner registration process. ```text INFO Registering runner, arch=amd64, os=darwin, version=0.1.5. WARN Runner in user-mode. INFO Enter the Gitea instance URL (for example, https://gitea.com/): http://192.168.8.8:3000/ INFO Enter the runner token: fe884e8027dc292970d4e0303fe82b14xxxxxxxx INFO Enter the runner name (if set empty, use hostname: Test.local): INFO Enter the runner labels, leave blank to use the default labels (comma-separated, for example, ubuntu-latest:docker://docker.gitea.com/runner-images:ubuntu-latest): INFO Registering runner, name=Test.local, instance=http://192.168.8.8:3000/, 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]. DEBU Successfully pinged the Gitea instance server INFO Runner registered successfully. ``` -------------------------------- ### Create rootless user and install uidmap Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Commands to create a new user for running Docker and gitea-runner, and to install the necessary uidmap package. ```bash useradd -m rootless passwd rootless apt-get install -y uidmap # Not mentioned but needed for docker rootless. ``` -------------------------------- ### Running Single Go Unit Tests Source: https://github.com/gitea/runner/blob/main/AGENTS.md Example of how to run a single Go unit test. ```bash go test -run '^TestName$' ./modulepath/ ``` -------------------------------- ### Register Runner (Interactive) Source: https://github.com/gitea/runner/blob/main/README.md Command to start the interactive runner registration process. ```bash ./gitea-runner register ``` -------------------------------- ### Register gitea-runner Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Commands to navigate to the gitea-runner data directory and register a new runner. ```bash cd /home/rootless/gitea-runner gitea-runner register ``` -------------------------------- ### Code Formatting and Linting Source: https://github.com/gitea/runner/blob/main/AGENTS.md Commands to format and lint Go files. ```bash make fmt make lint-go ``` -------------------------------- ### Build from source Source: https://github.com/gitea/runner/blob/main/README.md Command to build the Gitea Runner from source. ```bash make build ``` -------------------------------- ### Generate gitea-runner configuration Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Generates a default configuration file for gitea-runner and saves it to the specified data directory. ```bash gitea-runner generate-config >/home/rootless/gitea-runner/config ``` -------------------------------- ### Build a docker image Source: https://github.com/gitea/runner/blob/main/README.md Command to build a Docker image for Gitea Runner. ```bash make docker ``` -------------------------------- ### Check gitea-runner status Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Commands to verify the status of the gitea-runner service and view its logs. ```bash systemctl --user status gitea-runner journalctl --user -xeu gitea-runner ``` -------------------------------- ### Development Targets Source: https://github.com/gitea/runner/blob/main/AGENTS.md Lists available development targets using make. ```bash make help ``` -------------------------------- ### Add configuration to .bashrc Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Appends lines to the .bashrc file to ensure Docker is configured correctly for rootless mode when a new shell is opened. ```bash for f in ./.bashrc.d/*.bash; do echo "Processing $f file..."; . "$f"; done ``` -------------------------------- ### Run Cache Server Source: https://github.com/gitea/runner/blob/main/README.md Command to run the Gitea Runner cache server. ```bash gitea-runner cache-server ``` -------------------------------- ### Run Runner with Docker Source: https://github.com/gitea/runner/blob/main/README.md Command to run the Gitea Runner as a Docker container. ```bash docker run -e GITEA_INSTANCE_URL=https://your_gitea.com -e GITEA_RUNNER_REGISTRATION_TOKEN= -v /var/run/docker.sock:/var/run/docker.sock --name my_runner gitea/runner:nightly ``` -------------------------------- ### Generate Configuration File Source: https://github.com/gitea/runner/blob/main/README.md Command to generate a default configuration file for Gitea Runner. ```bash ./gitea-runner generate-config > config.yaml ``` -------------------------------- ### Go Module Management Source: https://github.com/gitea/runner/blob/main/AGENTS.md Command to run after making changes to go.mod files. ```bash make tidy ``` -------------------------------- ### Gitea-runner systemd user service file Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md A systemd user service file to manage the gitea-runner process, ensuring it runs as a non-privileged user and restarts automatically. ```bash Description=Gitea Actions runner Documentation=https://gitea.com/gitea/runner After=docker.service [Service] Environment=PATH=/home/rootless/bin:/sbin:/usr/sbin:/home/rootless/bin:/home/rootless/bin:/home/rootless/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games Environment=DOCKER_HOST=unix:///run/user/1001/docker.sock ExecStart=/usr/bin/gitea-runner daemon -c /home/rootless/gitea-runner/config ExecReload=/bin/kill -s HUP $MAINPID WorkingDirectory=/home/rootless/gitea-runner TimeoutSec=0 RestartSec=2 Restart=always StartLimitBurst=3 StartLimitInterval=60s LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity TasksMax=infinity Delegate=yes Type=notify NotifyAccess=all KillMode=mixed [Install] WantedBy=default.target ``` -------------------------------- ### Standard docker-compose configuration for Gitea Runner Source: https://github.com/gitea/runner/blob/main/examples/docker-compose/README.md This snippet shows the docker-compose configuration for running Gitea and its associated runner service. It includes environment variables for registration token and instance URL, volume mounts, and healthcheck configurations. ```yaml ... gitea: image: gitea/gitea ... healthcheck: # checks availability of Gitea's front-end with curl test: ["CMD", "curl", "-f", ""] interval: 10s retries: 3 start_period: 30s timeout: 10s environment: # GITEA_RUNNER_REGISTRATION_TOKEN can be used to set a global runner registration token. # The Gitea version must be v1.23 or higher. # It's also possible to use GITEA_RUNNER_REGISTRATION_TOKEN_FILE to pass the location. # - GITEA_RUNNER_REGISTRATION_TOKEN= runner: image: gitea/runner restart: always depends_on: gitea: # required so runner can attach to gitea, see "healthcheck" condition: service_healthy restart: true volumes: - ./data/runner:/data - /var/run/docker.sock:/var/run/docker.sock environment: - GITEA_INSTANCE_URL= # When using Docker Secrets, it's also possible to use # GITEA_RUNNER_REGISTRATION_TOKEN_FILE to pass the location. # The env var takes precedence. # Needed only for the first start. - GITEA_RUNNER_REGISTRATION_TOKEN= ``` -------------------------------- ### Configure rootless Docker environment variables Source: https://github.com/gitea/runner/blob/main/examples/vm/rootless-docker.md Sets environment variables in a separate bash script to configure the Docker host for rootless operation. ```bash export XDG_RUNTIME_DIR=/home/rootless/.docker/run export PATH=/home/rootless/bin:$PATH export DOCKER_HOST=unix:///run/user/$(id -u)/docker.sock ``` -------------------------------- ### Enable Actions in Gitea Configuration Source: https://github.com/gitea/runner/blob/main/README.md Configuration snippet to enable Actions in Gitea. ```ini [actions] ENABLED=true ``` -------------------------------- ### Register Runner (Command Line Arguments) Source: https://github.com/gitea/runner/blob/main/README.md Command to register a runner using command line arguments, bypassing interactive prompts. ```bash ./gitea-runner register --instance http://192.168.8.8:3000 --token --no-interactive ``` -------------------------------- ### Docker-in-Docker (DIND) configuration for Gitea Runner Source: https://github.com/gitea/runner/blob/main/examples/docker-compose/README.md This snippet details the docker-compose configuration for running Gitea Runner with Docker-in-Docker (DIND), specifically for rootless environments. It highlights the need for `privileged: true` and `security_opt` settings, along with environment variables for Docker daemon configuration. ```yaml ... runner: image: gitea/runner:latest-dind-rootless restart: always privileged: true security_opt: - apparmor=rootlesskit depends_on: gitea: condition: service_healthy restart: true volumes: - ./data/runner:/data environment: - GITEA_INSTANCE_URL= - DOCKER_HOST=unix:///var/run/user/1000/docker.sock # Use slirp4netns instead of vpnkit for significantly better network throughput. - DOCKERD_ROOTLESS_ROOTLESSKIT_NET=slirp4netns - DOCKERD_ROOTLESS_ROOTLESSKIT_MTU=65520 # When using Docker Secrets, it's also possible to use # GITEA_RUNNER_REGISTRATION_TOKEN_FILE to pass the location. # The env var takes precedence. # Needed only for the first start. - GITEA_RUNNER_REGISTRATION_TOKEN= ``` -------------------------------- ### Run gitea-runner in Docker Source: https://github.com/gitea/runner/blob/main/examples/docker/README.md This command runs the gitea-runner in a Docker container. It sets the GITEA_INSTANCE_URL and GITEA_RUNNER_REGISTRATION_TOKEN environment variables, mounts the Docker socket and a local data directory, and names the container 'my_runner'. The image used is 'gitea/runner:nightly'. ```shell docker run -e GITEA_INSTANCE_URL=http://192.168.8.18:3000 -e GITEA_RUNNER_REGISTRATION_TOKEN= -v /var/run/docker.sock:/var/run/docker.sock -v $PWD/data:/data --name my_runner gitea/runner:nightly ``` -------------------------------- ### Run Runner Daemon Source: https://github.com/gitea/runner/blob/main/README.md Command to run the Gitea Runner in daemon mode. ```bash ./gitea-runner daemon ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.