diff --git a/.gitea/workflows/snapshot_admin_deploy.yml b/.gitea/workflows/snapshot_admin_deploy.yml index 93af115..cd6c7d1 100644 --- a/.gitea/workflows/snapshot_admin_deploy.yml +++ b/.gitea/workflows/snapshot_admin_deploy.yml @@ -9,7 +9,7 @@ concurrency: jobs: deploy-snapshot-admin: - runs-on: self-hosted + runs-on: [self-hosted, snapshot-admin-host] timeout-minutes: 20 steps: - name: Checkout Code diff --git a/docs/SYNOLOGY_ACT_RUNNER_REFACTOR_PR_BODY.md b/docs/SYNOLOGY_ACT_RUNNER_REFACTOR_PR_BODY.md new file mode 100644 index 0000000..ccff66b --- /dev/null +++ b/docs/SYNOLOGY_ACT_RUNNER_REFACTOR_PR_BODY.md @@ -0,0 +1,20 @@ +# Synology Act Runner Split PR Body + +## Title + +`chore: split Synology act_runner start and re-registration scripts` + +## Body + +- Added `tools/re_register_act_runner_synology.sh` for explicit host-mode re-registration. +- Added `tools/start_act_runner_synology.sh` for boot-time daemon start only. +- Kept `tools/setup_act_runner.sh` as the bootstrap path, but made the re-registration flow explicit and repeatable. +- Switched the runner registration labels to `self-hosted:host,snapshot-admin-host:host` so the job runs in host mode instead of Docker job containers and can be targeted by a dedicated deployment label. +- Updated `docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md` and `docs/ROADMAP_WBS.md` so the operator flow and WBS notes match the new runner split. +- The `snapshot_admin.yml` workflow is split into push smoke validation and manual full validation, which reduces routine CI cost while preserving the full web smoke path on demand. + +## Verification + +- `python tools/validate_snapshot_admin_workflow_v1.py` +- `python -c "import yaml, pathlib; yaml.safe_load(pathlib.Path('.gitea/workflows/snapshot_admin.yml').read_text(encoding='utf-8'))"` +- `git diff -- .gitea/workflows/snapshot_admin.yml tools/setup_act_runner.sh docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md docs/ROADMAP_WBS.md` diff --git a/docs/SYNOLOGY_SNAPSHOT_ADMIN_DEPLOYMENT_CHECKLIST.md b/docs/SYNOLOGY_SNAPSHOT_ADMIN_DEPLOYMENT_CHECKLIST.md index ab4d520..85a75ae 100644 --- a/docs/SYNOLOGY_SNAPSHOT_ADMIN_DEPLOYMENT_CHECKLIST.md +++ b/docs/SYNOLOGY_SNAPSHOT_ADMIN_DEPLOYMENT_CHECKLIST.md @@ -70,6 +70,32 @@ bash /volume1/projects/data_feed/tools/run_snapshot_admin_synology.sh healthchec bash /volume1/projects/data_feed/tools/run_snapshot_admin_synology.sh restart ``` +## 4b. Gitea Actions runner label + +Use a unique host label so the deployment job is not mixed with generic self-hosted work. + +- Runner label: `snapshot-admin-host` +- Registration example: + +```bash +REG_TOKEN="" \ +GITEA_URL="http://192.168.123.100:8418" \ +RUNNER_LABEL="snapshot-admin-host" \ +bash tools/re_register_act_runner_synology.sh +``` + +- Workflow selector: + +```yaml +runs-on: [self-hosted, snapshot-admin-host] +``` + +## 4c. Queue handling + +- If the deploy workflow stays queued, it usually means the host runner is busy. +- Check the job currently holding the runner before re-dispatching. +- Do not keep dispatching deploy runs back-to-back. The workflow already uses `concurrency` to cancel in-progress duplicates. + ## 5. Reverse proxy - DSM path: `Control Panel > Login Portal > Advanced > Reverse Proxy` diff --git a/docs/SYNOLOGY_SNAPSHOT_ADMIN_FINAL_EXECUTION_ONE_PAGER.md b/docs/SYNOLOGY_SNAPSHOT_ADMIN_FINAL_EXECUTION_ONE_PAGER.md index eacaafe..221d669 100644 --- a/docs/SYNOLOGY_SNAPSHOT_ADMIN_FINAL_EXECUTION_ONE_PAGER.md +++ b/docs/SYNOLOGY_SNAPSHOT_ADMIN_FINAL_EXECUTION_ONE_PAGER.md @@ -47,6 +47,20 @@ Confirm that `snapshot_admin_server_v1.py` runs on Synology with loopback bindin - Re-run steps 2-7 - Expected: identical response pattern after restart +## Queue check + +If the deployment workflow stays queued for more than a few minutes: + +1. Confirm the runner is registered with the host label. + - `RUNNER_LABEL=snapshot-admin-host` + - Re-register with `bash tools/re_register_act_runner_synology.sh` after setting the registration token. +2. Confirm the runner daemon is running. + - `bash tools/start_act_runner_synology.sh` +3. Confirm the queue target is the host runner label. + - Deploy workflow uses `runs-on: [self-hosted, snapshot-admin-host]` +4. If another job is occupying the runner, wait for it to finish or cancel the stale workflow from Gitea. +5. Re-dispatch `snapshot_admin_deploy.yml` after the runner is idle. + ## Pass criteria - Loopback `200` confirmed. diff --git a/docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md b/docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md index db465d9..61938e7 100644 --- a/docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md +++ b/docs/SYNOLOGY_SNAPSHOT_ADMIN_POC.md @@ -69,7 +69,7 @@ Use these exact values for the first POC. - Start the Python service on boot or via DSM Task Scheduler - Keep it bound to `127.0.0.1` unless you intentionally use direct bind mode - If you use direct bind mode, keep `--allow-remote` and Basic Auth enabled together - - For Gitea Actions runner verification, register `act_runner` with host labels (`self-hosted:host,linux:host`) if you want to avoid Docker job containers and the `Cleaning up container` log line + - For Gitea Actions runner verification, register `act_runner` with a dedicated host label (`self-hosted:host,snapshot-admin-host:host`) if you want to avoid Docker job containers and the `Cleaning up container` log line - Preferred launcher script: `tools/run_snapshot_admin_synology.sh` - Gitea CI deploy path: trigger `.gitea/workflows/snapshot_admin_deploy.yml` `workflow_dispatch` and let the host runner call the launcher script - Runner bootstrap: `tools/re_register_act_runner_synology.sh` @@ -87,7 +87,7 @@ bash tools/re_register_act_runner_synology.sh - Expected effect: - removes the existing `.runner` registration file - - registers `self-hosted:host,linux:host` + - registers `self-hosted:host,snapshot-admin-host:host` - writes an updated `config.yaml` - If the old runner remains listed in Gitea, remove it from the repository runner page and re-run the command above diff --git a/tools/re_register_act_runner_synology.sh b/tools/re_register_act_runner_synology.sh new file mode 100644 index 0000000..86a24f9 --- /dev/null +++ b/tools/re_register_act_runner_synology.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -eu + +GITEA_URL="${GITEA_URL:-http://192.168.123.100:8418}" +REG_TOKEN="${REG_TOKEN:-}" +RUNNER_NAME="${RUNNER_NAME:-synology-runner}" +RUNNER_LABEL="${RUNNER_LABEL:-snapshot-admin-host}" +RUNNER_DIR="${RUNNER_DIR:-/volume1/gitea/act_runner}" +ACT_RUNNER_VERSION="${ACT_RUNNER_VERSION:-0.2.11}" + +if [ -z "$REG_TOKEN" ]; then + echo "ERROR: REG_TOKEN is required" + echo "usage: REG_TOKEN=... GITEA_URL=... bash tools/re_register_act_runner_synology.sh" + exit 1 +fi + +ARCH=$(uname -m) +case "$ARCH" in + x86_64) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-amd64" ;; + aarch64) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-arm64" ;; + armv7l) BINARY="act_runner-${ACT_RUNNER_VERSION}-linux-arm-7" ;; + *) echo "ERROR: 지원하지 않는 아키텍처: $ARCH"; exit 1 ;; +esac + +mkdir -p "$RUNNER_DIR/workspace" + +if [ ! -x "$RUNNER_DIR/act_runner" ]; then + DOWNLOAD_URL="https://gitea.com/gitea/act_runner/releases/download/v${ACT_RUNNER_VERSION}/${BINARY}" + echo "[install] $DOWNLOAD_URL" + curl -L --progress-bar "$DOWNLOAD_URL" -o "$RUNNER_DIR/act_runner" + chmod +x "$RUNNER_DIR/act_runner" +fi + +cat > "$RUNNER_DIR/config.yaml" <