This bash script helps automate the update process for Ghost running on a VM in Google Cloud. It was inspired by Amazon rolling deployment and designed because the author is running a micro instance which is very resource limited. It creates a machine image backup, starts a new VM, updates Ghost to the latest version, and offers to reassign your external IP. The script includes native macOS notifications to keep you informed of progress and important decisions so you can run in the background without forgetting about it.
Although not required, this script is compatible with httpPing and RestartVMService to facilitate restarting your VM if the URL it's hosting appears to be offline.
- Client side:
- Google Cloud CLI
- jq
- curl
- expect
- ssh-keygen
- ssh-keyscan
- macOS (for notifications)
- Server side:
- Ghost v5 with Ghost CLI
- Ubuntu 22.04 on Google Cloud
- Setup an SSH key for your service account (with access to the private key on your client machine running the script)
- Added your service account SSH key to your VM
- Checks for client side pre-requisites
- Lists your Google Cloud VMs if you have more than one
- Creates a machine image backup
- Starts a new VM named after the latest Ghost release
- Temporarily stops Ghost to free up RAM
- Updates Ghost and restarts it
- Offers to reassign your static IP to the new VM
- Provides notifications throughout the process


- Standard update:
./update.sh
- Shows progress notifications
- Interactive prompts for key decisions
- Final notification with VM IPs
- Fast update:
./update.sh speedy
- Temporarily upgrades VM for faster updates
- Auto-downgrades after completion
- Test notifications:
./update.sh test-notification
- Verifies notification system works
- Debug mode:
./update.sh debug
- For troubleshooting version checks
- Run Ghost backup (instead, this creates a machine image)
- Delete old VMs or Machine Images
- Support multi-server setups with load balancers
- Make it easy to run only certain commands with parameters
- Enable running without interactive prompts
- Cron for auto-update checks
- Offer to cleanup machine image backups and terminated VMs
- Offer to setup service_account SSH keys
The script was written quickly and has not been tested by anyone else or on a non macOS device. While I took precautions to generalize the script and avoid data loss I'd advise that you still use it at your own risk.