CI/CD Improvements for All 3 Environments #72
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current State
migrate.dev.projectmycelium.com):deploy-dev.ymldeploys on push todevelopmentvia rsync + SSH to 185.69.166.168. Works but uses old pattern.migrate.test.projectmycelium.com): No CI/CD. Manualdocker compose pull && upon 46.225.220.102.migrate.projectmycelium.com): Two overlapping workflows (deploy-production.ymlon push tomain,build-container.ymlon tag push) both deploy to the same k3s cluster — redundant and potentially conflicting.Since v0.1.14,
HEROLEDGER_NETWORKis a runtime env var. One image works for all environments — just setHEROLEDGER_NETWORK=dev/test/mainat container start. No separate Dockerfile per network needed.Option A: Tag-Based Promotion
Each environment has its own trigger:
developmentbranch for dev,-rctags for testnet, release tags for production.Workflows
deploy-dev.ymldevelopment:devdeploy-testnet.ymlv*-rc*:<version>(e.g.:0.1.15-rc1)deploy-production.ymlv*(not-rc):<version>+:latestFlow
Pros
kubectl set image portal=...:0.1.14Cons
-rc2,-rc3)Option B: Single Build, Promote to Production
One build on push to
developmentdeploys to both dev and testnet. Production promotion is a tag that re-tags the existing image (no rebuild).Workflows
build.ymldevelopment:dev+:<short-sha>→ deploy to dev VM → deploy to testnet VMrelease.ymlv*:devas:<version>+:latest→ deploy to k3s → create releaseFlow
Pros
-rctags needed)Cons
developmentdeploys to bothRecommendation
Both options work. The choice depends on how the team uses testnet:
Either way, the existing
deploy-production.yml(push tomain) andbuild-container.ymlshould be consolidated to avoid two workflows deploying to the same k3s cluster.Shared requirements for both options
Secrets needed in repo:
REGISTRY_USERNAME+REGISTRY_TOKEN— Forgejo registry (already configured)KUBE_CONFIG— base64 kubeconfig for k3s ci-deployer (already configured)TESTNET_SSH_KEY— SSH key for testnet VM (46.225.220.102, port 34022, not yet configured)OURWORLD_IT_SECRETS_SSH_KEY— SSH key for dev VM (already configured)Testnet VM docker-compose.yml already uses registry image with
HEROLEDGER_NETWORK=test— just needsdocker compose pull && docker compose up -dDev VM stays as native binary via rsync (no Docker)
Implemented Option A (Tag-Based Promotion) in branch
feature/cicd-option-a— PR #73 pending merge todevelopment.What changed
deploy-testnet.ymlv*-rc*tags, builds image, pushes to registry, SSH to testnet VM,docker compose pull && up, health check + smoke testsdeploy-production.ymlbuild-container.yml— keeps the existing working production logic, adds-rctag exclusion so RC tags only go to testnetbuild-container.ymldeploy-production.ymldeploy-dev.ymltest.ymlCI/CD flow after merge
Action required
Add
TESTNET_SSH_KEYsecret to the repo settings.@peter Nice cleanup!
The per-environment separation is much clearer than the old overlapping workflows.
One concern with Option A: both testnet and production trigger fresh Docker builds from different tags. Docker builds aren't reproducible, floating base images (node:20-alpine), apt-get update, and npm ci can all pull different versions between builds. So the image tested on testnet isn't guaranteed to be the same binary that goes to production.
My suggestion is build once, promote by retagging:
This gives you: