fix: CI/CD blue-green deployment path bug causing stale production content
All checks were successful
Deploy to Staging / Build Images (push) Successful in 23s
Deploy to Staging / Deploy to Staging (push) Successful in 26s
Deploy to Staging / Verify Staging (push) Successful in 5s
Deploy to Staging / Notify Staging Ready (push) Successful in 5s
Deploy to Staging / Notify Staging Failure (push) Has been skipped

Root cause: switch-traffic.sh was modifying Traefik config in the CI checkout
directory ($GITHUB_WORKSPACE) instead of the deployment directory ($DEPLOY_PATH).
Additionally, the sed patterns didn't work with multi-line YAML structure.

Changes:
- Add DEPLOY_PATH environment variable support to all CI scripts
- Add --force-recreate flag to ensure containers are recreated with new images
- Fix weight update to use awk for reliable multi-line YAML editing
- Add scripts/ directory to rsync so SREs can run scripts from /opt/motovaultpro
- Add image verification step to confirm containers use expected images
- Add weight verification to confirm Traefik routing was updated
- Add routing validation step to verify traffic switch succeeded

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Eric Gullickson
2025-12-31 10:39:27 -06:00
parent 13abbc16d7
commit c57a05daa5
4 changed files with 46 additions and 18 deletions

View File

@@ -44,22 +44,43 @@ You are a senior software engineer specializsing in NodeJS, Typescript, front en
- Make no assumptions.
- Ask clarifying questions.
- Ultrathink
- This application is ready to go into production.
- Debug why staging and production websites dont' match even though the docker image ID's match
- Analysis needs to be done on the CI/CD pipeline
*** CONTEXT ***
- Read README.md CLAUDE.md and AI-INDEX.md and follow relevant instructions to understand this code repository in the context of this change.
- The current deployment does not take into account no downtime or miniimal downtime updates.
- The same runner's build the software that run the software
- There needs to be a balance of uptime and complexity
- production will run on a single server to start
- The staging site runs on staging.motovaultpro.com and production runs on motovaultpro.com
- These sites are local so use an MCP that will work with local sites to gather a snapshot.
- Example: Staging has the correct title in About Us "Built by enthusiasts. Made for your collection."
- Exaxmple: Production has the old title in About us "Overall, our goal is to meet each individual's needs with quality, passion, and professionalism."
*** ACTION - CHANGES TO IMPLEMENT ***
- Research this code base and ask iterative questions to compile a complete plan.
- We will pair plan this. Ask me for options for various levels of redundancy and automation
*** STAGING CONTAINER IMAGES ***
egullickson@mvp-build:~$ sudo docker image ls
i Info → U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
git.motovaultpro.com/egullickson/backend:3321d82 67b2480ddac5 485MB 76.3MB U
git.motovaultpro.com/egullickson/frontend:3321d82 e3e1ee18df42 96.1MB 28.7MB U
git.motovaultpro.com/egullickson/mirrors/postgres:18-alpine 6723ec6d445f 402MB 112MB U
git.motovaultpro.com/egullickson/mirrors/redis:8.4-alpine 8360960f5fb5 130MB 33.4MB U
git.motovaultpro.com/egullickson/mirrors/traefik:v3.6 13e903c820df 239MB 52MB U
egullickson@mvp-build:~$
*** PRODUCTION CONTAINER IMAGES ***
egullickson@mvp-prod:~$ sudo docker image ls
i Info → U In Use
IMAGE ID DISK USAGE CONTENT SIZE EXTRA
git.motovaultpro.com/egullickson/backend:latest 67b2480ddac5 485MB 76.3MB U
git.motovaultpro.com/egullickson/frontend:latest e3e1ee18df42 96.1MB 28.7MB U
git.motovaultpro.com/egullickson/mirrors/postgres:18-alpine 6723ec6d445f 402MB 112MB U
git.motovaultpro.com/egullickson/mirrors/redis:8.4-alpine 8360960f5fb5 130MB 33.4MB U
git.motovaultpro.com/egullickson/mirrors/traefik:v3.6 13e903c820df 239MB 52MB U
egullickson@mvp-prod:~$