A simple utility Bash script to backup Ghost publishing platform.
💡 Tip: run
make helpto display help message.Check out the Makefile
Getting started with Ghost is easy. You would pick between:
Using managed version will most likely save you a bunch of headaches (and time) that come along with self-hosting any other sites:
- Backups
- Maintenance
- Downtime recovery
- Security, etc.
In short, you’d sleep easy at night while they stay awake.
Having that said, if you want to take on the challenge of self-hosting your own Ghost site, here's a tiny script to help with your backups.
graph LR
1(["start"]) --> 2["run checks"] --> 3["tar content/"] --> 4["run mysqldump"] --> 5["rclone zip files to cloud storage"] --> 6["clean up"] --> 7(["end"])
💡 Tip: run
make checkto check if all requirements are installed.
A list of CLI needed to be installed:
💡 Tip: run
make setup.
Note Install
rcloneusingcurl -s https://rclone.org/install.sh | bashAn example to configure Rclone with Google Drive (reference):
- Run
rclone config - Name your remote
remote - Follow rlcone.org/drive
- If you're working on a remote machine without a browser (e.g. Digital Ocean Droplet via SSH), say
Nfor the auto config prompt. Follow through the instructions - Run
rclone lsd remote:/to check your connection
Note Switch to the
ghost-mgruser to manage Ghost usingsudo -i -u ghost-mgr
- SSH into your VPS where you host your Ghost site
- Set up Rclone
- Clone this repository
- Run
./backup.shfrom the repository directory
Reference: crontab.guru
- Add a
crontab -eitem - For this example, we will back up the data every week:
0 0 * * 0 cd /$HOME/wraith/ && ./backup.sh
Backups are not backups unless you have tested restoring from them.
Let's test our backup locally using Docker.
- At a new directory, copy your
ghost_content_YYYY_MM_DD_HHMM.tar.gzbackup file there. Decompress the backup files usingtar -xvf - Run Ghost locally using
docker run -d --name some-ghost -e url=http://localhost:3001 -p 3001:2368 -v /path/to/images:/var/lib/ghost/content/images ghostto restore the blog images - Visit
localhost:3001/ghostto create an admin account - From the Ghost Admin interface (
localhost:3001/ghost/#/settings/labs), import your JSON Ghost blog content from decompresseddata/ - You can import your members CSV from the Members page too
Tip: run bash within your Ghost Docker container using docker exec -it some-ghost bash
See FAQ.md.
See CONTRIBUTING.md.