Details
Zero Downtime Deployment
I have no idea what to do with this
But I'm gonna save it anyways because it seems important
In reality
ssh into server
Cd into project directory
Git pull and rebase
Check the current port of the active container
Pick a port to use (usually alternate between 2 ports)
backup dockerfile and env files
Delete env file to avoid conflicts
Create new one and add new env
Build new container with a -new prefix
Once built
Do a curl in the action to make health checks every few seconds until I get a 200
Timeout in 1 min and rollback if I never get a 200
If I get a 200
Proceed to Nginx config file
Replace :port with new port
Reload nginx
Traffic now on new container
Wait 1 minute
Delete old container
Rename new container (remove -new) on it
Action ends
Gist URL: https://gist.github.com/1finedev/30fdb170f4f12e11de558f146771f9cb
CREDIT: OLA PENG @JavaScripters