mirror of
https://code.forgejo.org/infrastructure/documentation
synced 2024-12-02 14:21:13 +00:00
68 lines
2.2 KiB
Markdown
68 lines
2.2 KiB
Markdown
## Forgejo runners
|
|
|
|
The LXC container in which the runner is installed must have capabilities that support the backend.
|
|
|
|
- docker:// needs a Docker enabled container
|
|
- lxc:// needs a Docker and LXC enabled container
|
|
|
|
The runners it contains are not started at boot, it must be done manually. The bash history has the command line to do so.
|
|
|
|
### Installation
|
|
|
|
```shell
|
|
version=4.0.1
|
|
sudo wget -O /usr/local/bin/forgejo-runner-$version https://code.forgejo.org/forgejo/runner/releases/download/v$version/forgejo-runner-$version-linux-amd64
|
|
sudo chmod +x /usr/local/bin/forgejo-runner-$version
|
|
echo 'export TERM=xterm-256color' >> .bashrc
|
|
```
|
|
|
|
### Creating a runner
|
|
|
|
Multiple runners can co-exist on the same machine. To keep things
|
|
organized they are located in a directory that is the same as the URL
|
|
from which the token is obtained. For instance
|
|
DIR=codeberg.org/forgejo-integration means that the token was obtained from the
|
|
https://codeberg.org/forgejo-integration organization.
|
|
|
|
If a runner only provides unprivileged docker containers, the labels
|
|
in `config.yml` should be:
|
|
`labels: ['docker:docker://node:20-bookworm']`.
|
|
|
|
If a runner provides LXC containers and unprivileged docker
|
|
containers, the labels in `config.yml` should be
|
|
`labels: ['self-hosted:lxc://debian:bookworm', 'docker:docker://node:20-bookworm']`.
|
|
|
|
```shell
|
|
name=myrunner
|
|
mkdir -p $DIR ; cd $DIR
|
|
forgejo-runner-$version generate-config > config-$name.yml
|
|
## edit config-$name.yml and adjust the `labels:`
|
|
## Obtain a $TOKEN from https://$DIR
|
|
forgejo-runner-$version register --no-interactive --token $TOKEN --name runner --instance https://codeberg.org
|
|
forgejo-runner-$version --config config-$name.yml daemon |& cat -v > runner.log &
|
|
```
|
|
|
|
### Removing old docker images
|
|
|
|
[docuum](https://github.com/stepchowfun/docuum)
|
|
|
|
```sh
|
|
curl https://raw.githubusercontent.com/stepchowfun/docuum/main/install.sh -LSfs | sh
|
|
sudo tee /etc/systemd/system/docuum.service <<'EOF'
|
|
[Unit]
|
|
Description=Docuum
|
|
After=docker.service
|
|
Wants=docker.service
|
|
|
|
[Service]
|
|
Environment='THRESHOLD=10 GB'
|
|
ExecStart=/usr/local/bin/docuum --threshold ${THRESHOLD}
|
|
Restart=on-failure
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
sudo systemctl enable docuum --now
|
|
sudo journalctl --follow --unit docuum
|
|
```
|