Split docs to split rootfull & rootless hosting

This commit is contained in:
Magnus Leßmann (@MarkL4YG) 2025-01-08 23:38:29 +01:00
parent 20d349e701
commit 08b9ee1f7d
Signed by: Mark.TwoFive
GPG key ID: 5B5EBCBE331F1E6F
3 changed files with 167 additions and 37 deletions

View file

@ -6,39 +6,11 @@
For example on the Hetzner cloud.
### 2. Create a new user for the runner
### 2. Install Docker
Since we don't want to the new forgejo runner to be ``root`` on out machine, we create a new user for it:
```bash
# As root
useradd -s /bin/bash --create-home forgejo-runner
loginctl enable-linger forgejo-runner
```
See [Install using the API repository](https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository)
### 3. Install podman (rootless)
```bash
# As root
apt install -y podman
# 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
```bash
# As root
apt install -y systemd-container
machinectl shell --uid forgejo-runner # <-- This is basically "sudo -Hi XXX" but makes sure the systemd container is switched too.
```
```bash
systemctl --user enable --now podman.socket podman
echo 'export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/podman/podman.sock' >> ~/.profile
```
### 4. Install the forgejo-runner
### 3. Install the forgejo-runner
```bash
# As forgejo-runner
@ -58,13 +30,13 @@ mv ./forgejo-runner ~/.local/bin/forgejo-runner
chmod 750 ~/.local/bin/forgejo-runner
```
### 5. Configure and register the forgejo-runner
### 4. Configure and register the forgejo-runner
__The official runner registration is__ [here](https://forgejo.org/docs/v8.0/admin/runner-installation/#standard-registration)
Or, if you're volunteering another runner for our instance, please contact us to receive the necessary registration information. :)
```bash
# As forgejo-runner
# As forgejo-runner (recreate shell to update PATH)
forgejo-runner generate-config > config.yml
# You should open the config.yml and enable IPv6 support! (Your cloud host might charge extra for IPv4 connectivity)
@ -86,9 +58,6 @@ 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.