Fork me on GitHub

Ghost backup script


A helpful tool for the lazy, this python scripts allows an easier backup of your Ghost blog(s) database. Check out the Github page for the code, my blog post for some insights or just read the instructions below.


Download

How to use it

After you download the archive from Github or just the backup script itself, you have to configure the config.json file, entering your blog(s) details as well as some optional backup settings.
Alternatively, you can use the form provided on this page. Its code is entirely client-side so your password(s) will not be saved anywhere else but feel free to use a mock one and edit at the end just to be on the safe side :)

Settings

This is how the config file looks like:

            {
    "settings": {
        "output_path": "output",
        "max_backup_files": 5
    },
    "blogs": [
        {
            "url": "http://blog.domain/",
            "client_secret": "client_secret",
            "username": "admin_username",
            "password": "admin_password"
        }
    ]
    }
        

Running the script

Open a terminal window and navigate to the location of the backup.py file. Then run python backup.py and watch the magic happen!
ghost backup script screenshot

Running the script with a cron job

I will update this as soon as I find a solution!

How to find your client secret

Go to the blog's login page, open the browser's Developer Tools and go to the Network tab.

finding the client secret

After you log in, look for the token request, select it and scroll down to see the form data. The client secret will be there.

finding the client secret

Generate your config file

Use the form below to get the code for your config.json file.

Script settings


Blog(s) settings




Config file

Click on "Generate" to create your custom config file and then copy the code to config.json.