Wrote a script to update Google Cloud Micro Instances

I was having challenges updating Ghost on a resource constrained free-tier micro instance. So, I wrote a script to help automate it and described it on my blog.

It creates a machine image of your active Ghost instance on Google Cloud, spins up a new VM from that and updates Ghost on it and then offers to move your static IP from your old VM to your new VM so you can cut over to it with minimal downtime.

There are screenshots and a video showing the script works.

Anyways, figured I’d share since self-hosting is a bit time consuming!

1 Like

Refactored the code last night making it much easier to read and understand. Also, introduced a feature to reboot the new VM after updating system packages before updating NPM and Ghost. And, created an option (that’s commented out by default) to update on a beefier machine to speed things along a tiny bit. It’s pretty nifty.