Ghost backup CLI questions

Hi,

Firstly I’d just like to say i’ve spent the last few days migrating some of our content from Medium to Ghost and I love it. Its sooo much nicer. Great job.

We are self hosting for a bunch of reasons, but if you have a patreon or some other way of supporting the project that doesn’t need us to host with you I’d be interested in knowing how.

I’m trying to setup an automated backup on my ghost site (running on our own server)

There are a lot of scripts and posts on the internet about how to do that but many of these seem quite outdated? I’m trying to do this based on using the ghost backup command.

Unfortunately this seems to be quite interactive? I see one example that uses the linux tool expect to solve this but that isn’t quite working for me. For one it doesn’t actually seem to account for the fact that ghost backup will ask for the sudo password. (see here for the script i’m referring to: Backing Up Ghost Blog in 5 Steps)

Anyway… more importantly though ghost backup --help shows --no-prompt as an option. However, if using that option, I can’t see how to pass in the Ghost admin username and password? The help output doesn’t seem to show any options to do that?

Could someone explain what the --no-prompt option will do? What is the recommended way to automate/schedule backups using “ghost backup”?

Thanks for all your input!

If you’re looking for help, please provide information about your environment. If you delete this template and don’t provide any information, your topic will be automatically closed.

If you aren’t running the latest version of Ghost, the first thing we’ll ask you to do is update to the latest version of Ghost.

  • What’s your URL? This is the easiest way for others to help you - https://cloudhpc.news
  • What version of Ghost are you using? If it’s not the latest, please update Ghost first before opening your topic

Ghost-CLI version: 1.25.3
Ghost version: 5.80.2

And

  • How was Ghost installed and configured? - Using the Ghost Install guide for Ubuntu
  • What Node version, database, OS & browser are you using?
    Node: v18
    DB: MySql
    OS: Ubuntu 22.04 LTS
  • What errors or information do you see in the console?
  • What steps could someone else take to reproduce the issue you’re having?

Just to be clear running ;

ghost backup --no-prompt

results in this ouput:

ghost backup --no-prompt

Love open source? We’re hiring JavaScript Engineers to work on Ghost full-time.

  • sudo systemctl is-active ghost_cloudhpc-news
    /usr/lib/node_modules/ghost-cli/lib/ui/index.js:148
    throw new errors.SystemError(‘Prompts have been disabled, all options must be provided via command line flags’);
    ^

SystemError: Prompts have been disabled, all options must be provided via command line flags
at UI.prompt (/usr/lib/node_modules/ghost-cli/lib/ui/index.js:148:19)
at Socket. (/usr/lib/node_modules/ghost-cli/lib/ui/index.js:248:22)
at Socket.emit (node:events:529:35)
at addChunk (node:internal/streams/readable:368:12)
at readableAddChunk (node:internal/streams/readable:341:9)
at Readable.push (node:internal/streams/readable:278:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23) {
options: {
message: ‘Prompts have been disabled, all options must be provided via command line flags’
},
logMessageOnly: undefined,
help: ‘You can always refer to Ghost-CLI - A fully loaded tool for installation and configuration for troubleshooting.’,
err: {}
}

Node.js v18.19.1

However I’m not clear on what the other command line flags are to provide the required inputs.

ghost backup --help doesn’t provide any indication what they might be:

ghost backup

Backup content & files

Global Options:
–help Show help [boolean]
-d, --dir Folder to run command in
-D, --development Run in development mode [boolean]
-V, --verbose Enable verbose output [boolean]
–prompt [–no-prompt] Allow/Disallow UI prompting [boolean] [default: true]
–color [–no-color] Allow/Disallow colorful logging [boolean] [default: true]
–auto Automatically run as much as possible [boolean] [default: false]

For more information, see our docs at Ghost-CLI - A fully loaded tool for installation and configuration

and neither does the link it provides

As an alternative to builtin Ghost backup I’ve created a backup script:

Which does the same.

Are you hosting on your hardware or in the cloud?