chore: clear dead-code after spud migration

docs: update usage guidance
This commit is contained in:
Marc 2024-06-09 01:50:12 -04:00
parent 38d5e583cf
commit d7b0ad699c
Signed by: marc
GPG key ID: 048E042F22B5DC79
4 changed files with 25 additions and 109 deletions

View file

@ -2,31 +2,12 @@
Forgejo instance serving https://forge.karnov.club.
## Usage
## Maintaining
### Starting / restarting
Using [spud](https://forge.karnov.club/spadinastan/spud), just `spud start ./service.yml`!
### Starting runners
```bash
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
get stored.
`FORGEJO_RUNNER_ROOT` should also be read+write accessible and will be where the runner stores data.
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
./stop.sh
FORGEJO_RUNNER_ROOT=... ./start-action-runner.sh
```
## Networking
| Port | Notes |
|---|---|
|`3000`|Web listening port|

20
start-action-runner.sh Executable file
View file

@ -0,0 +1,20 @@
#!/usr/bin/bash
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,80 +0,0 @@
#!/usr/bin/bash
if [[ -z "$FORGEJO_ROOT" ]]; then
echo "Error: FORGEJO_ROOT must be defined in the environment."
exit 1
fi
if [[ -z "$FORGEJO_RUNNER_ROOT" ]]; then
echo "Error: FORGEJO_RUNNER_ROOT must be defined in the environment."
exit 1
fi
if [[ -z "$FORGEJO_RUNNER_CONFIG" ]]; then
echo "Using the default runner configuration."
fi
podman pod create \
-p 3000:3000 \
-p 2052:2222 \
-p 3001:9187 \
--replace \
"code-forge"
# Start app database.
podman run \
-td \
--pod "code-forge" \
--name "code-forge_db" \
-v code-forge_db:/var/lib/postgresql/data:Z \
--replace \
postgres:16.2
# Start webapp.
podman run \
-td \
--name "code-forge_app" \
--pod "code-forge" \
-v "$FORGEJO_ROOT"/data:/var/lib/gitea \
-v "$FORGEJO_ROOT"/config:/etc/gitea \
-v /etc/timezone:/etc/timezone:ro \
-v /etc/localtime:/etc/localtime:ro \
--replace \
codeberg.org/forgejo/forgejo:1.21.8-0-rootless
# The runners require the app to be healthy before startup.
response=""
until [[ $response = *"200 OK"* ]]; do
response="$(curl localhost:3000 -s -i | head -1)"
echo "Waiting for app to respond..."
done
podman run -d \
--env-file "$ENV_FILE_DIR"/code-forge-exporter.env \
--pod code-forge \
--replace \
--name "code-forge-pg-exporter" \
quay.io/prometheuscommunity/postgres-exporter
if [[ -n $START_RUNNER ]]; then
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
fi

View file

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