4.5 KiB
4.5 KiB
| project | type | status | path | tags | created | updated | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pbsii-cicd-pipeline | session-notes | active | Tech/Sessions |
|
2026-04-18 | 2026-04-18 |
PBSII CI/CD Pipeline — Session Notes (April 18, 2026)
What We Built
CI/CD pipeline for the PBSII monorepo using GitHub Actions with a self-hosted runner. Push to a branch triggers Ansible to deploy the correct layer to the correct environment.
Architecture Decisions
- Monorepo stays: PBSII keeps all layers in one repo (
collector/,parser/,dashboard/,n8n/). Each subdirectory is self-contained with its own deps, Dockerfile (if applicable), and README. - One workflow per layer: Separate
.github/workflows/deploy-*.ymlfiles, each triggered bypaths:filter on its directory. Explicit over clever. - Self-hosted runner on
ustest1: Runner agent installed as systemd service on the Proxmox homelab VM.ustest1already haswp-i(Ansible project), SSH keys, and Ansible installed — no secrets in GitHub cloud, no rebuilding environments. - Branch strategy:
stagingbranch → deploys to staging server.mainbranch → deploys to production. Solves the staging drift problem. - Ansible stays the executor: GitHub Actions is just the trigger.
Ansible roles live in
wp-i, source code lives in PBSII repo. - Build on server for v1: Ansible SSHs to target, pulls code, runs
docker compose up -d --build. No Docker registry needed yet. - Google Chat notifications: Success/failure on every deploy.
What's Done
- GitHub Actions self-hosted runner installed on
ustest1(systemd service, runs asherbyadmin) - Runner shows as Idle in GitHub repo settings
pbsdeployuser created on staging serverdeployergroup created, owns/opt/dockerwith setgid bitpbsdeployadded todeployeranddockergroups on staging- SSH key (
linode_deploy) generated onustest1, installed on staging forpbsdeploy - SSH alias
spbs-runnerconfigured onustest1for staging access - Production cleaned up — no deploy user, key removed
- Workflow files created in PBSII repo (Lovebug)
- Ansible dashboard role created in
wp-i(Lovebug) - Google Chat notification workflow added (Lovebug)
What's Next
- Test the pipeline: Push a small change to
dashboard/on thestagingbranch, watch the Actions tab — this is the moment of truth - Fix vault files:
wp-ivault files (group/host vars) didn't get pushed before leaving home. Need to recreate or push from tower. Other Docker services won't work on staging until this is resolved — dashboard test may be blocked by this. - Extend to collector and parser: Same pattern — new workflow file per layer, new Ansible role per layer
- Production deploy user: Once staging pipeline is proven, repeat
pbsdeploy+deployersetup on production and create themainbranch workflow - Security hardening (separate project): Env files with API keys/passwords are readable by anyone with Docker group access. Not a PBSII problem, but flagged.
Key Learnings
- Self-hosted runner avoids the two-repo problem: Using GitHub's cloud
runners would require cloning both PBSII and
wp-ionto a temporary VM, exposing vault secrets. The self-hosted runner onustest1sidesteps all of that. dockergroup is effectively root: Any user in thedockergroup can mount the host filesystem via a privileged container. Accepted risk for now, but worth knowing.- setgid bit (
chmod g+sorchmod 2xxx): Ensures new files in/opt/dockerinherit thedeployergroup. Without it, Ansible-created files would belong topbsdeploy's primary group and break group permissions. - Staging-first discipline matters: We accidentally set up production first and had to backtrack. The branch strategy only works if you actually follow it.
pbs-hubPBSII layer is leaving: The override/control page will fold into the existing pbs-hub project, not live in PBSII.
Server Setup Reference
Staging server
- User:
pbsdeploy - Group:
deployer(owns/opt/docker) - Docker group membership: yes
- SSH key:
linode_deploy(fromustest1) - No sudo access, no system config access
ustest1 (runner)
- Runner service:
actions.runner.trucktrav-pbsii.pbsii-install.service - Runner user:
herbyadmin - SSH alias to staging:
spbs-runner - Has
wp-irepo locally - Labels:
self-hosted,ustest1
...sent from Jenny & Travis