How to backup Docker discourse from command-line before rebuilding broken Discourse?

I set up a Discourse site, and a couple days later it suddenly stopped working - tries to load for a couple minutes then “This web page is not available - ERR_CONNECTION_RESET”. It might be a RAM issue.
I am ready to use the launcher scripts to rebuild the container. But if possible I would like to backup the content that was added to the site so far.
Is there a preferred way to backup the DB and/or uploaded files manually from the command line?
I’ve been unable to track down the pgsql credentials in order to do a pgdump.

No need to backup anything, containers are disposable, all important data is stored outside the container

1 Like

You’ll be safe doing a rebuild, or a reboot (except EC2). Get it back running again, then take a backup from /admin/backups.

Is there a way to start a backup from command-line through SSH ?

I haven’t confirmed, but I’d assume there is a backup script just as there is a restore.

1 Like
  • Is there a way to create a backup from SSH Terminal of my forum/site?
  • If my site is half broken (some pages open and some not), should I run the setup again, will my contents will be intact or they’d be thrown away once I run the setup or rebuild the app?

Yes there is. SSH to your server, and run the following:

cd /var/discourse
./launcher enter app
discourse backup

Running ./discourse-setup or ./launcher rebuild app are both safe, neither will throw your data away, they solely modify the application.

4 Likes

This command will create the backup locally, in the server only. In other words, within Ubuntu instance.

  • how can I know backup’s location/path?
  • How can I download this backup to my local pc (so that I could use this backup in another, same type of, instance)?

Backups are by default stored in /var/discourse/shared/standalone/backups/default/.

This isn’t really a Discourse question. You can use any method you like to download the backup off your server. FTP, SCP, upload to a cloud service, etc. Assuming your Discourse site is working, the easiest method is likely to download the backup from within Discourse.

4 Likes

If we create our site backup from frond-end/admin area. And click ‘download backup’ button (which sends us a mail to download the backup data). And then we update the site, run rebuild command and our site breaks down.

And then we want to download the backup file from the link given in our mail. Will we be able to download the same? Given the fact that site has already broken in the mean time after updating the same?

If you update the site via ./launcher rebuild app, there is going to be downtime while that runs. That is expected.

The link provided via email will only work if your Discourse instance is up and running. You’ll need to download the backup before you start the rebuild, or wait until it finishes.

Excuse me, I was not clear enough in my query. Let me repeat it once.

  1. My site is ok and I send my self a link (thru email) to my latest backup.
  2. Then I update my website, along with all themes, plugins etc (thru whatever means). And after this update, after rebuilding command (in SSH Terminal), my website breaks.
  3. Now my question is, can I download that latest backup from my discourse instance from that email link which I had sent myself earlier?

Or, I’ll first have to start my website (by rebuilding from a sample app.yml may be), and only then I can use that email link to download the backup?

And last, can that email link be clicked more than once (in some websites, I’ve seen that you can click/use such links only once).

No. If your instance is down, you cannot use that link.

Correct, you need Discourse to be running. As I previously mentioned, you can download the backup by any other file transfer system you like. If Discourse isn’t working, using something like FTP or SCP would be suggested.

I’m fairly certain this is a one time link. However, Discourse is what tracks usage of the link, so if you click it while your site is completely down, the click should not be counted.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.