fix(forge): use non-containerized runner

This commit is contained in:
Marc 2024-03-30 10:07:01 -04:00
parent fb8aa899e7
commit ffa0a3175f
Signed by: marc
GPG key ID: 048E042F22B5DC79
3 changed files with 25 additions and 14 deletions

View file

@ -7,7 +7,7 @@ Forgejo instance serving https://forge.karnov.club.
### Starting / restarting
```bash
FORGEJO_ROOT=.. FORGEJO_RUNNER_ROOT=... FORGEJO_RUNNER_CONFIG=... ./start.sh
FORGEJO_ROOT=.. FORGEJO_RUNNER_ROOT=... ./start.sh
```
`FORGEJO_ROOT` should be a directory with read+write access by the container user, this is where application data will
@ -15,10 +15,10 @@ get stored.
`FORGEJO_RUNNER_ROOT` should also be read+write accessible and will be where the runner stores data.
`FORGEJO_RUNNER_CONFIG` should point to the runner configuration YAML file. If undefined, the default included with the scripts is used.
Calling the `start.sh` script will replace the containers if they already exists.
Note that the runner(s) must be registered and started manually.
### Stopping
```bash

View file

@ -19,6 +19,8 @@ podman pod create \
--replace \
"code-forge"
# Start webapp.
podman run \
-td \
--name "code-forge_app" \
@ -37,14 +39,21 @@ until [[ $response = *"200 OK"* ]]; do
echo "Waiting for app to respond..."
done
podman run \
--pod "code-forge" \
--user root \
-td \
--name "code-forge_runner" \
--pod "code-forge" \
-v "$FORGEJO_RUNNER_ROOT":/data \
-v "${FORGEJO_RUNNER_CONFIG:=./config.yml}":/data/config.yml \
-v "$XDG_RUNTIME_DIR"/podman/podman.sock:/var/run/docker.sock \
code.forgejo.org/forgejo/runner:3.3.0 \
forgejo-runner --config config.yml daemon
wget -O "$FORGEJO_RUNNER_ROOT"/forgejo-runner https://code.forgejo.org/forgejo/runner/releases/download/v3.3.0/forgejo-runner-3.3.0-linux-amd64
chmod +x "$FORGEJO_RUNNER_ROOT"/forgejo-runner
wget -O forgejo-runner.asc https://code.forgejo.org/forgejo/runner/releases/download/v3.3.0/forgejo-runner-3.3.0-linux-amd64.asc
gpg --keyserver keys.openpgp.org --recv EB114F5E6C0DC2BCDD183550A4B61A2DC5923710
gpg --verify forgejo-runner.asc "$FORGEJO_RUNNER_ROOT"/forgejo-runner
rm forgejo-runner.asc
if [ -f "$FORGEJO_RUNNER_ROOT/.runner" ]; then
echo "Found runner state."
(
cd "$FORGEJO_RUNNER_ROOT" || exit
"$FORGEJO_RUNNER_ROOT"/forgejo-runner --config "${FORGEJO_RUNNER_CONFIG:=./config.yml}" daemon &
)
else
echo "Use $FORGEJO_RUNNER_ROOT/forgejo-runner register ... to register the runner"
echo "Once registered, use $FORGEJO_RUNNER_ROOT/forgejo-runner --config <path-to-config> daemon & to start"
fi

View file

@ -1,3 +1,5 @@
#!/usr/bin/bash
podman pod stop "code-forge"
echo "WARN: The runner process must be stopped manually since it's not a container."