docs: add Gitea runner installation
CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions
CI — Test & Build / 🐳 Docker integration & API E2E (push) Blocked by required conditions
CI — Test & Build / 🌐 Staging Playwright smoke (push) Waiting to run
CI — Test & Build / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI — Test & Build / 🏗️ Build Docker Image (push) Blocked by required conditions
CI — Test & Build / 🐳 Docker integration & API E2E (push) Blocked by required conditions
CI — Test & Build / 🌐 Staging Playwright smoke (push) Waiting to run
This commit is contained in:
@@ -0,0 +1,61 @@
|
|||||||
|
# Gitea Actions runner telepítése
|
||||||
|
|
||||||
|
Ez a projekt `ubuntu-latest` címkéjű Gitea Actions jobokat használ. A futtató ne a Gitea alkalmazásszerveren, hanem egy dedikált Linux CI-hoston fusson. A jelenlegi Gitea szerver verziója 1.22.6, ezért a telepítő az ahhoz illeszkedő `act_runner` 0.2.11 binárist használja.
|
||||||
|
|
||||||
|
## Előfeltételek a CI-hoston
|
||||||
|
|
||||||
|
- Linux (`amd64` vagy `arm64`)
|
||||||
|
- systemd
|
||||||
|
- futó Docker daemon
|
||||||
|
- Docker Compose v2: `docker compose version`
|
||||||
|
- Node.js és npm: `node --version`, `npm --version`
|
||||||
|
- a Gitea szerver HTTPS-címe elérhető: `https://git.mozdit.hu`
|
||||||
|
|
||||||
|
Mivel a workflow Docker Compose-t futtat, a `gitea-runner` szolgáltatásfelhasználó a `docker` csoportba kerül. Ez a runneren futó repository-workflowknak lényegében Docker-admin jogosultságot ad; ezért kizárólag dedikált, más célra nem használt CI-hoston szabad alkalmazni.
|
||||||
|
|
||||||
|
## Regisztrációs token beszerzése
|
||||||
|
|
||||||
|
Nyisd meg a `si/websitedev` repositoryt a Gitea felületén, majd:
|
||||||
|
|
||||||
|
`Settings → Actions → Runners → Create new runner`
|
||||||
|
|
||||||
|
A megjelenő token repository-szintű. Ne mentsd el a repositoryba, ne add át chatben, és ne tedd shell historyba.
|
||||||
|
|
||||||
|
## Telepítés
|
||||||
|
|
||||||
|
Másold fel a repositoryból a `scripts/install-gitea-runner.sh` fájlt a CI-hostra, majd ott futtasd:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
chmod +x install-gitea-runner.sh
|
||||||
|
sudo ./install-gitea-runner.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
A script kérni fogja a tokent rejtett bevitelként, majd:
|
||||||
|
|
||||||
|
1. letölti az `act_runner` 0.2.11 binárist a CPU-architektúrához;
|
||||||
|
2. létrehozza a `gitea-runner` rendszerfelhasználót és az `/opt/gitea-runner` könyvtárat;
|
||||||
|
3. regisztrálja `mozdit-ci-01` néven, `ubuntu-latest:host` címkével;
|
||||||
|
4. systemd szolgáltatásként elindítja;
|
||||||
|
5. a regisztrációt a CI-host helyi `/opt/gitea-runner/.runner` fájljában tárolja.
|
||||||
|
|
||||||
|
A `:host` címke szándékos: a projekt CI-je Node-ot, Playwrightot és Docker Compose-t igényel. Ezek a dedikált CI-host eszközeivel futnak. Ez nem érinti a tervezett, Docker nélküli éles webalkalmazás-telepítést.
|
||||||
|
|
||||||
|
## Ellenőrzés és hibaelhárítás
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl status gitea-act-runner
|
||||||
|
sudo journalctl -u gitea-act-runner -f
|
||||||
|
sudo -u gitea-runner docker ps
|
||||||
|
```
|
||||||
|
|
||||||
|
A Gitea `Settings → Actions → Runners` nézetében a runner állapota `Idle`. Ekkor a most várakozó CI-futás automatikusan elindul. A workflow `Run Tests & Generate Reports`, `Build Docker Image` és `Docker integration & API E2E` jobjai futni fognak; a staging Playwright smoke csak manuális vagy ütemezett futásnál indul.
|
||||||
|
|
||||||
|
## Egyedi értékek
|
||||||
|
|
||||||
|
Nem alapértelmezett név vagy útvonal esetén a telepítő környezeti változókkal paraméterezhető:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo RUNNER_NAME=mozdit-ci-02 RUNNER_HOME=/opt/mozdit-runner ./install-gitea-runner.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
Az `INSTANCE_URL` és a `RUNNER_LABELS` csak akkor módosítandó, ha a Gitea cím vagy a workflow `runs-on` címkéje is megváltozik.
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# Install and register a repository-scoped Gitea Actions runner on a dedicated Linux CI host.
|
||||||
|
# This script must be run on the CI host, not on the Gitea application server.
|
||||||
|
|
||||||
|
set -Eeuo pipefail
|
||||||
|
|
||||||
|
readonly RUNNER_VERSION="${RUNNER_VERSION:-0.2.11}"
|
||||||
|
readonly RUNNER_USER="${RUNNER_USER:-gitea-runner}"
|
||||||
|
readonly RUNNER_HOME="${RUNNER_HOME:-/opt/gitea-runner}"
|
||||||
|
readonly INSTANCE_URL="${INSTANCE_URL:-https://git.mozdit.hu}"
|
||||||
|
readonly RUNNER_NAME="${RUNNER_NAME:-mozdit-ci-01}"
|
||||||
|
readonly RUNNER_LABELS="${RUNNER_LABELS:-ubuntu-latest:host}"
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
printf 'HIBA: %s\n' "$*" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
require_command() {
|
||||||
|
command -v "$1" >/dev/null 2>&1 || fail "Hiányzó parancs: $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ "${EUID}" -ne 0 ]]; then
|
||||||
|
fail "Futtasd sudo-val: sudo ./scripts/install-gitea-runner.sh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
require_command curl
|
||||||
|
require_command docker
|
||||||
|
require_command node
|
||||||
|
require_command npm
|
||||||
|
|
||||||
|
docker info >/dev/null 2>&1 || fail "A Docker daemon nem érhető el. Indítsd el, majd futtasd újra a scriptet."
|
||||||
|
docker compose version >/dev/null 2>&1 || fail "Hiányzik a Docker Compose v2 (docker compose)."
|
||||||
|
|
||||||
|
case "$(uname -m)" in
|
||||||
|
x86_64) runner_arch="amd64" ;;
|
||||||
|
aarch64|arm64) runner_arch="arm64" ;;
|
||||||
|
*) fail "Nem támogatott CPU-architektúra: $(uname -m)" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
readonly RUNNER_ARCH="${runner_arch}"
|
||||||
|
readonly RUNNER_URL="https://dl.gitea.com/gitea-runner/${RUNNER_VERSION}/act_runner-${RUNNER_VERSION}-linux-${RUNNER_ARCH}"
|
||||||
|
|
||||||
|
if ! id -u "${RUNNER_USER}" >/dev/null 2>&1; then
|
||||||
|
useradd --system --create-home --home-dir "${RUNNER_HOME}" --shell /usr/sbin/nologin "${RUNNER_USER}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
usermod -aG docker "${RUNNER_USER}"
|
||||||
|
install -d -o "${RUNNER_USER}" -g "${RUNNER_USER}" -m 0750 "${RUNNER_HOME}"
|
||||||
|
|
||||||
|
tmp_binary="$(mktemp)"
|
||||||
|
trap 'rm -f "${tmp_binary}"' EXIT
|
||||||
|
curl --fail --location --retry 3 --output "${tmp_binary}" "${RUNNER_URL}"
|
||||||
|
install -o root -g root -m 0755 "${tmp_binary}" "${RUNNER_HOME}/act_runner"
|
||||||
|
|
||||||
|
"${RUNNER_HOME}/act_runner" --version
|
||||||
|
|
||||||
|
if [[ ! -f "${RUNNER_HOME}/.runner" ]]; then
|
||||||
|
if [[ -z "${GITEA_RUNNER_REGISTRATION_TOKEN:-}" ]]; then
|
||||||
|
read -r -s -p "Gitea runner regisztrációs token: " GITEA_RUNNER_REGISTRATION_TOKEN
|
||||||
|
printf '\n'
|
||||||
|
fi
|
||||||
|
[[ -n "${GITEA_RUNNER_REGISTRATION_TOKEN}" ]] || fail "Üres regisztrációs token."
|
||||||
|
|
||||||
|
# The token is intentionally neither written to disk nor printed by this script.
|
||||||
|
runuser -u "${RUNNER_USER}" -- "${RUNNER_HOME}/act_runner" register --no-interactive \
|
||||||
|
--instance "${INSTANCE_URL}" \
|
||||||
|
--token "${GITEA_RUNNER_REGISTRATION_TOKEN}" \
|
||||||
|
--name "${RUNNER_NAME}" \
|
||||||
|
--labels "${RUNNER_LABELS}"
|
||||||
|
else
|
||||||
|
printf 'A runner már regisztrálva van, a regisztráció kihagyva.\n'
|
||||||
|
fi
|
||||||
|
|
||||||
|
install -m 0644 /dev/stdin /etc/systemd/system/gitea-act-runner.service <<EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Gitea Actions Runner (${RUNNER_NAME})
|
||||||
|
After=network-online.target docker.service
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=${RUNNER_USER}
|
||||||
|
WorkingDirectory=${RUNNER_HOME}
|
||||||
|
ExecStart=${RUNNER_HOME}/act_runner daemon
|
||||||
|
Restart=always
|
||||||
|
RestartSec=5
|
||||||
|
NoNewPrivileges=true
|
||||||
|
PrivateTmp=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable --now gitea-act-runner.service
|
||||||
|
systemctl --no-pager --full status gitea-act-runner.service
|
||||||
|
|
||||||
|
printf '\nKész. Ellenőrizd a Gitea felületén: Settings → Actions → Runners; az állapotnak Idle-nak kell lennie.\n'
|
||||||
Reference in New Issue
Block a user