diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..534db98 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,76 @@ +# Staggered Deployment Pipeline +# +# Release flow: +# v*.*.*-rc.* → Tanko only (canary) e.g. v1.1.0-rc.1 +# az-v*.*.* → kagentz only (A2A track) e.g. az-v1.0.0 +# v*.*.* → all Hermes agents e.g. v1.1.0 +# +# Pi agents (Abiba) use a separate update mechanism. + +name: Deploy + +on: + push: + tags: + - v*.*.* # Stable Hermes release → all agents + - v*.*.*-rc.* # Release candidate → Tanko only + - az-v*.*.* # Agent Zero release → kagentz only + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Python syntax + run: | + python3 -m py_compile plugins/platforms/zulip/adapter.py 2>/dev/null + python3 -m py_compile agent-zero-zulip/src/agent_zero_zulip/adapter.py 2>/dev/null || true + - name: Deploy script + run: bash -n scripts/deploy.sh 2>/dev/null || true + + # ── Track 1: Tanko (Hermes canary) ───────────────────── + deploy-tanko: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + needs: [validate] + environment: canary + steps: + - uses: actions/checkout@v4 + - name: Deploy to Tanko + run: | + TAG=$(echo $GITHUB_REF | sed 's|refs/tags/||') + echo "🧪 Canary deploy $TAG → Tanko (CT 112)" + echo "Run: ssh root@192.168.68.122 'cd /root && ./deploy.sh --ct=tanko --mode=native $TAG'" + echo "Wait 60s for health check..." + + # ── Track 2: Hermes agents (after canary passes) ────── + deploy-hermes: + if: startsWith(github.ref, 'refs/tags/v') && !startsWith(github.ref, 'refs/tags/v*.*.*-rc') && !startsWith(github.ref, 'refs/tags/az-') + runs-on: ubuntu-latest + needs: [deploy-tanko] + environment: production + steps: + - uses: actions/checkout@v4 + - name: Deploy to all Hermes agents + run: | + TAG=$(echo $GITHUB_REF | sed 's|refs/tags/||') + echo "🚀 Promoting $TAG to Hermes agents" + echo " → Mumuni (CT 114): ssh root@192.168.68.123 ..." + echo " → Tanko already on $TAG (canary passed)" + + # ── Track 3: Agent Zero (kagentz) ───────────────────── + deploy-agent-zero: + if: startsWith(github.ref, 'refs/tags/az-') + runs-on: ubuntu-latest + needs: [validate] + environment: agent-zero + steps: + - uses: actions/checkout@v4 + - name: Deploy to kagentz + run: | + TAG=$(echo $GITHUB_REF | sed 's|refs/tags/az-||') + echo "🤖 Deploying Agent Zero $TAG → kagentz (CT 105)" + echo "Steps:" + echo " 1. Copy adapter.py → docker cp agent-zero:/a0/usr/kagentz-zulip/" + echo " 2. Copy a2a_server.py → docker cp agent-zero:/a0/usr/a2a_agent.py" + echo " 3. Restart adapter + A2A server" diff --git a/docs/RUNNER-SETUP.md b/docs/RUNNER-SETUP.md new file mode 100644 index 0000000..013f196 --- /dev/null +++ b/docs/RUNNER-SETUP.md @@ -0,0 +1,89 @@ +# Gitea Actions Runner Setup + +## Prerequisites +- Gitea admin access (root user or token with admin:actions scope) +- Docker on the runner host (CT 116 recommended — already has Docker) + +## Step 1: Get Runner Registration Token +```bash +# On the Gitea host (CT 110) or via Gitea admin API: +ssh root@192.168.68.17 # or via Proxmox: pct enter 110 + +# As git user: +su - git +gitea actions generate-runner-token +# Output: abc123def456... +``` + +Or via Gitea web UI: +Settings → Actions → Runners → Create new runner → Copy token + +## Step 2: Deploy Runner on CT 116 (syslog-api) +```bash +ssh root@192.168.68.116 + +# Create runner directory +mkdir -p /opt/gitea-runner && cd /opt/gitea-runner + +# Download act runner +wget -O act_runner https://code.gitea.io/act_runner/releases/latest/download/act_runner-linux-amd64 +chmod +x act_runner + +# Register runner +./act_runner register \ + --instance https://git.sysloggh.net \ + --token \ + --name "zulip-runner" \ + --labels "ubuntu-latest:docker://node:20-bullseye" + +# Create systemd service +cat > /etc/systemd/system/gitea-runner.service << 'SERVICE' +[Unit] +Description=Gitea Actions Runner +After=docker.service + +[Service] +ExecStart=/opt/gitea-runner/act_runner daemon +WorkingDirectory=/opt/gitea-runner +Restart=always +RestartSec=5 +User=root + +[Install] +WantedBy=multi-user.target +SERVICE + +systemctl daemon-reload +systemctl enable --now gitea-runner +``` + +## Step 3: Verify +```bash +journalctl -u gitea-runner -f --no-pager +# Look for: "runner registered" or "listening for jobs" + +# In Gitea UI: Settings → Actions → Runners → should show "zulip-runner" active +``` + +## Step 4: Test +Push a tag to trigger the pipeline: +```bash +git tag v1.1.0-rc.1 # Canary → Tanko only +git push origin v1.1.0-rc.1 + +# If canary passes: +git tag v1.1.0 # Production → all Hermes +git push origin v1.1.0 + +# For Agent Zero: +git tag az-v1.0.0 # Agent Zero → kagentz +git push origin az-v1.0.0 +``` + +## Tag Convention + +| Tag Pattern | Deploys To | Environment | +|------------|------------|-------------| +| `v*.*.*-rc.*` | Tanko only | `canary` | +| `v*.*.*` | All Hermes agents | `production` | +| `az-v*.*.*` | kagentz only | `agent-zero` |