diff --git a/services/code-forge/README.md b/services/code-forge/README.md index 98c26ee..883131f 100644 --- a/services/code-forge/README.md +++ b/services/code-forge/README.md @@ -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 diff --git a/services/code-forge/start.sh b/services/code-forge/start.sh index d6bb93f..27e4cbd 100755 --- a/services/code-forge/start.sh +++ b/services/code-forge/start.sh @@ -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 daemon & to start" +fi diff --git a/services/code-forge/stop.sh b/services/code-forge/stop.sh index 784b968..02a7ec6 100755 --- a/services/code-forge/stop.sh +++ b/services/code-forge/stop.sh @@ -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."