From 8c402e30849ef891a0000cb7e60bec74a6b26198 Mon Sep 17 00:00:00 2001 From: ReachableCEO Date: Tue, 15 Jul 2025 10:53:19 -0500 Subject: [PATCH] gitea/peertube runner foundations. secrets mgmt is a blocker. Adding that to my shell framework and will vendor that framework into here. --- inprep/gitea-runner/README.md | 1 + inprep/gitea-runner/docker-compose.yml | 14 ++++++++++++++ inprep/peertube-runner/Dockerfile | 9 +++++++++ inprep/peertube-runner/README.md | 21 +++++++++++++++++++++ inprep/peertube-runner/entrypoint.sh | 20 ++++++++++++++++++++ 5 files changed, 65 insertions(+) create mode 100644 inprep/gitea-runner/README.md create mode 100644 inprep/gitea-runner/docker-compose.yml create mode 100644 inprep/peertube-runner/Dockerfile create mode 100644 inprep/peertube-runner/README.md create mode 100644 inprep/peertube-runner/entrypoint.sh diff --git a/inprep/gitea-runner/README.md b/inprep/gitea-runner/README.md new file mode 100644 index 0000000..abfee80 --- /dev/null +++ b/inprep/gitea-runner/README.md @@ -0,0 +1 @@ +https://docs.gitea.com/next/usage/actions/act-runner/ diff --git a/inprep/gitea-runner/docker-compose.yml b/inprep/gitea-runner/docker-compose.yml new file mode 100644 index 0000000..62c790d --- /dev/null +++ b/inprep/gitea-runner/docker-compose.yml @@ -0,0 +1,14 @@ +version: "3.8" +services: + runner: + image: docker.io/gitea/act_runner:nightly + environment: + CONFIG_FILE: /config.yaml + GITEA_INSTANCE_URL: "${INSTANCE_URL}" + GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}" + GITEA_RUNNER_NAME: "${RUNNER_NAME}" + GITEA_RUNNER_LABELS: "${RUNNER_LABELS}" + volumes: + - ./config.yaml:/config.yaml + - ./data:/data + - /var/run/docker.sock:/var/run/docker.sock diff --git a/inprep/peertube-runner/Dockerfile b/inprep/peertube-runner/Dockerfile new file mode 100644 index 0000000..47054e9 --- /dev/null +++ b/inprep/peertube-runner/Dockerfile @@ -0,0 +1,9 @@ +FROM alpine:latest + +RUN apk add --no-cache nodejs npm ffmpeg +RUN npm install -g @peertube/peertube-runner + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh + +ENTRYPOINT ["/entrypoint.sh"] diff --git a/inprep/peertube-runner/README.md b/inprep/peertube-runner/README.md new file mode 100644 index 0000000..123daf6 --- /dev/null +++ b/inprep/peertube-runner/README.md @@ -0,0 +1,21 @@ +# PeerTube Runner Docker + +This Docker image sets up a PeerTube runner with all necessary dependencies installed. + +When stopping the container, the runner is removed from the peertube instance. + +Name is set to the container ID when run standalone, and the node name when run in a swarm . + +## Usage + +1. **Environment Variables**: + - `URL`: PeerTube instance URL. + - `TOKEN`: Registration token. + +2. **Run the Container**: + ```bash + docker run -e URL=http://127.0.0.1:9000 -e TOKEN=ptrrt-**** peertube-runner + ``` +## Note + +This container is meant to be a basic runner, so there is no encryption or captioning diff --git a/inprep/peertube-runner/entrypoint.sh b/inprep/peertube-runner/entrypoint.sh new file mode 100644 index 0000000..9a53857 --- /dev/null +++ b/inprep/peertube-runner/entrypoint.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ -n "$DOCKER_SERVICE_NAME" ]; then + NAME="$NODE_NAME" +else + NAME=$(uname -n) +fi + +cleanup() { + echo "Container is stopping, removing runner '$NAME'..." + peertube-runner unregister --url $URL --runner-name $NAME +} + +trap cleanup SIGTERM + +echo "Starting runner $NAME"... + +peertube-runner server & sleep 5 && \ +peertube-runner register --url $URL --registration-token $TOKEN --runner-name $NAME && \ +wait