From 14d4daa844c5922577cbf5d2b3b7d802ce0ed535 Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 1 Jun 2024 00:43:59 -0400 Subject: [PATCH] feat: add pg exporter --- start.sh | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/start.sh b/start.sh index 882b32a..1f44814 100755 --- a/start.sh +++ b/start.sh @@ -17,6 +17,7 @@ fi podman pod create \ -p 3000:3000 \ -p 2052:2222 \ + -p 3001:9187 \ --replace \ "code-forge" @@ -50,21 +51,30 @@ until [[ $response = *"200 OK"* ]]; do echo "Waiting for app to respond..." done -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 +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 daemon & to start" + 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 fi