From 7060ee7a7152dcb90cacbcaf96f8dd86f055c915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Le=C3=9Fmann=20=28=40MarkL4YG=29?= Date: Wed, 8 Jan 2025 13:14:08 +0100 Subject: [PATCH] Update docs for rootless fixes --- .forgejo/workflows/ipv6test.yml | 3 ++- docs/forgejo-runner.service | 1 + docs/hosting-runners.md | 11 +++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/ipv6test.yml b/.forgejo/workflows/ipv6test.yml index 2513992..3949823 100644 --- a/.forgejo/workflows/ipv6test.yml +++ b/.forgejo/workflows/ipv6test.yml @@ -12,5 +12,6 @@ jobs: image: ubuntu:24.04 steps: - run: | - apt update; apt install --yes curl + apt-get update + apt-get install --yes curl curl -s -o /dev/null https://ipv6.google.com diff --git a/docs/forgejo-runner.service b/docs/forgejo-runner.service index 10b7b2a..7a4c3ff 100644 --- a/docs/forgejo-runner.service +++ b/docs/forgejo-runner.service @@ -7,6 +7,7 @@ After=podman-socket.service ExecStart=/home/forgejo-runner/.local/bin/forgejo-runner daemon ExecReload=/bin/kill -s HUP $MAINPID WorkingDirectory=/home/forgejo-runner +EnvironmentFile=/home/forgejo-runner/.runner-env Restart=on-failure TimeoutSec=0 diff --git a/docs/hosting-runners.md b/docs/hosting-runners.md index dc990bc..228d843 100644 --- a/docs/hosting-runners.md +++ b/docs/hosting-runners.md @@ -20,8 +20,9 @@ loginctl enable-linger forgejo-runner ```bash # As root apt install -y podman -echo "forgejo-runner:10000:12000" >> /etc/subuid -echo "forgejo-runner:10000:12000" >> /etc/subgid + +# Expand the subuid/subgid namespaces for the user, the default one is too small for privileged rootless-containers +usermod --add-subuids 100000-200000 --add-subgids 100000-200000 forgejo-runner ``` #### Enable Podman docker-socket on user @@ -85,8 +86,14 @@ forgejo-runner register --instance "$RUNNER_INST_URL" --name "$RUNNER_NAME" --to ```bash # As forgejo-runner +echo "XDG_RUNTIME_DIR=/run/user/$(id -u)" > .runner-env +echo "DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock" >> .runner-env + mkdir -p ~/.config/systemd/user # Download the file "docs/forgejo-runner.service" from this repository to "~/.config/systemd/user" +# Or create a new file there and paste the contents. + + systemctl --user enable --now forgejo-runner # View logs by using: journalctl -xe --user-unit=forgejo-runner