docs: runner installation guide for all 8 HomeLab servers + automation script
- New doc: DevOps/Installation Gitea Runners — Tous les Serveurs.md
- Step-by-step for each server: deepin-desktop, dev.lab, dev.prod,
docker.test, automate.prod, media-1.lab, openclaw1.dev, automate.dev
- Alpine vs Debian/Ubuntu instructions (OpenRC vs systemd)
- Labels reference table for all 8 servers
- Automated install script + usage examples
- New script: scripts/install-gitea-runner.sh
- Universal installer: auto-detects OS (Alpine/Debian/Arch)
- Installs Docker if missing, downloads runner, registers, sets up service
- Supports x86_64, ARM64, ARMv7 architectures
This commit is contained in:
Executable
+142
@@ -0,0 +1,142 @@
|
||||
#!/bin/bash
|
||||
# ================================================================
|
||||
# install-gitea-runner.sh
|
||||
# Installation automatisée d'un runner Gitea Actions
|
||||
#
|
||||
# Usage:
|
||||
# ./install-gitea-runner.sh <TOKEN> <NAME> <LABELS>
|
||||
#
|
||||
# Exemple:
|
||||
# ./install-gitea-runner.sh abc123 "dev-lab" "self-hosted,lab,docker,obsigate"
|
||||
# ================================================================
|
||||
set -e
|
||||
|
||||
TOKEN="$1"
|
||||
NAME="$2"
|
||||
LABELS="$3"
|
||||
|
||||
if [ -z "$TOKEN" ] || [ -z "$NAME" ] || [ -z "$LABELS" ]; then
|
||||
echo "❌ Usage: ./install-gitea-runner.sh <TOKEN> <NAME> <LABELS>"
|
||||
echo " Example: ./install-gitea-runner.sh abc123 dev-lab 'self-hosted,lab,docker,obsigate'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "============================================="
|
||||
echo " Gitea Runner Installer"
|
||||
echo " Server : $NAME"
|
||||
echo " Labels : $LABELS"
|
||||
echo "============================================="
|
||||
echo ""
|
||||
|
||||
# ── 1. Detect OS ─────────────────────────────────────────────────
|
||||
if [ -f /etc/alpine-release ]; then
|
||||
OS="alpine"
|
||||
elif [ -f /etc/debian_version ]; then
|
||||
OS="debian"
|
||||
elif [ -f /etc/arch-release ]; then
|
||||
OS="arch"
|
||||
else
|
||||
echo "⚠️ Unknown OS — assuming Debian-based"
|
||||
OS="debian"
|
||||
fi
|
||||
echo "🖥️ Detected OS: $OS"
|
||||
|
||||
# ── 2. Ensure Docker ─────────────────────────────────────────────
|
||||
echo "[1/4] Checking Docker..."
|
||||
if ! command -v docker &>/dev/null; then
|
||||
echo " Installing Docker..."
|
||||
if [ "$OS" = "alpine" ]; then
|
||||
apk add --no-cache docker curl
|
||||
rc-update add docker boot
|
||||
service docker start
|
||||
elif [ "$OS" = "debian" ]; then
|
||||
sudo apt-get update -qq
|
||||
sudo apt-get install -y -qq docker.io curl
|
||||
sudo usermod -aG docker "$USER"
|
||||
elif [ "$OS" = "arch" ]; then
|
||||
sudo pacman -S --noconfirm docker curl
|
||||
sudo systemctl enable --now docker
|
||||
sudo usermod -aG docker "$USER"
|
||||
fi
|
||||
fi
|
||||
echo " ✅ Docker OK"
|
||||
|
||||
# ── 3. Download & install runner ──────────────────────────────────
|
||||
echo "[2/4] Downloading Gitea act_runner..."
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64) RUNNER_ARCH="amd64" ;;
|
||||
aarch64) RUNNER_ARCH="arm64" ;;
|
||||
armv7l) RUNNER_ARCH="armv7" ;;
|
||||
*) echo "❌ Unsupported architecture: $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
RUNNER_URL="https://dl.gitea.com/act_runner/act_runner-linux-${RUNNER_ARCH}"
|
||||
sudo curl -sL -o /usr/local/bin/act_runner "$RUNNER_URL"
|
||||
sudo chmod +x /usr/local/bin/act_runner
|
||||
echo " ✅ act_runner installed ($(/usr/local/bin/act_runner --version 2>&1 | head -1))"
|
||||
|
||||
# ── 4. Register ───────────────────────────────────────────────────
|
||||
echo "[3/4] Registering runner with Gitea..."
|
||||
/usr/local/bin/act_runner register \
|
||||
--instance https://git.dracodev.net \
|
||||
--token "$TOKEN" \
|
||||
--name "$NAME" \
|
||||
--labels "$LABELS" \
|
||||
--no-interactive
|
||||
echo " ✅ Runner registered"
|
||||
|
||||
# ── 5. Install as service ────────────────────────────────────────
|
||||
echo "[4/4] Installing as system service..."
|
||||
|
||||
if [ "$OS" = "alpine" ]; then
|
||||
# Alpine OpenRC
|
||||
sudo tee /etc/init.d/gitea-runner > /dev/null <<EOF
|
||||
#!/sbin/openrc-run
|
||||
name="Gitea Actions Runner ($NAME)"
|
||||
command="/usr/local/bin/act_runner"
|
||||
command_args="daemon"
|
||||
command_background=true
|
||||
pidfile="/run/\${RC_SVCNAME}.pid"
|
||||
output_log="/var/log/gitea-runner.log"
|
||||
error_log="/var/log/gitea-runner.log"
|
||||
EOF
|
||||
sudo chmod +x /etc/init.d/gitea-runner
|
||||
sudo rc-update add gitea-runner default
|
||||
sudo service gitea-runner start
|
||||
else
|
||||
# Systemd (Debian, Arch)
|
||||
sudo tee /etc/systemd/system/gitea-runner.service > /dev/null <<EOF
|
||||
[Unit]
|
||||
Description=Gitea Actions Runner ($NAME)
|
||||
After=network.target docker.service
|
||||
Requires=docker.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/act_runner daemon
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now gitea-runner
|
||||
fi
|
||||
echo " ✅ Service installed and started"
|
||||
|
||||
# ── 6. Verify ─────────────────────────────────────────────────────
|
||||
echo ""
|
||||
sleep 2
|
||||
if [ "$OS" = "alpine" ]; then
|
||||
sudo service gitea-runner status 2>&1 | head -3
|
||||
else
|
||||
sudo systemctl status gitea-runner --no-pager -l 2>&1 | head -5
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "============================================="
|
||||
echo " ✅ Runner '$NAME' installed successfully!"
|
||||
echo " Labels : $LABELS"
|
||||
echo " Vérifier dans Gitea → Admin → Runners"
|
||||
echo "============================================="
|
||||
Reference in New Issue
Block a user