last1.app production deploy (git-based)¶
Git is the source of truth. Prod runs an image built from a commit. Ryan and Robert run the same script on the same SHA.
Do not rsync a laptop tree to /opt/last1app/src. Do not git pull in that directory. That tree is an archive.
Host¶
- VM:
last1app-app(192.168.1.104) - Script:
/opt/last1app/scripts/deploy-from-git.sh(same file asscripts/deploy-from-git.shin this repo) - Runtime secrets:
/opt/last1app/.envonly. Not in git. Not in the image tag. - Git mirror:
/opt/last1app/repo.git(read-only deploy keylast1app-app-prod) - Release trees:
/opt/last1app/releases/<sha>/ - Live container:
last1app-appon192.168.1.104:5000 - Staging:
last1app-stagingon:5001. Leave it alone. - Candidate probes:
:5002
Deploy¶
ssh ryan@192.168.1.104
# SHA is origin/main, a tag, or a full commit.
bash /opt/last1app/scripts/deploy-from-git.sh origin/main
# or
bash /opt/last1app/scripts/deploy-from-git.sh 35e9f367108681769256a587fabdcffc5916bccb
What it does:
git fetchthe mirror. Archive that SHA into a new directory. Never touches/opt/last1app/src.- Builds
last1app-app:<sha>from that tree. - Tags the currently running image
last1app-app:prod-prev. The live container stays up. - Starts
last1app-app-candidateon:5002. Probes/,/api/auth/user,/api/public/templates. - If probes fail: removes the candidate.
:5000is unchanged. - If probes pass: stops the old container (does not remove it, renames it
last1app-app-prev), starts the new image on:5000, probes again. Auto-rollback if that probe fails.
Rollback¶
Stops last1app-app and starts last1app-app-prev (last1app-app:prod-prev). The new container stays stopped.
Puts the new container back on :5000 after a rollback test.
Team¶
- Commit and push to
origin/main. - Anyone with SSH to
last1app-appruns the script with that SHA. - Do not deploy from a dirty laptop checkout.
Retired path¶
/opt/last1app/src and deploy-last1app-app.sh are the old rsync-from-tree workaround. Do not use them.