Restore a backup from the command line

Here’s how to restore a Discourse backup from the command line, without ever booting the Discourse web UI. This is handy when you’re moving servers.


  • Download the latest backup file from source Discourse instance.
  • The destination discourse needs to be bootstrapped (run ./discourse-setup or copy your existing app.yml)
  • Make sure that the destination Discourse instance is on the latest version. Update it if necessary.

Transfer the backup

SSH into the destination server, or otherwise create the backup folder there:

mkdir -p /var/discourse/shared/standalone/backups/default

Upload your backup file to the destination server.

scp /path/to/backup/backup.tar.gz root@

Of course, replace the above paths, filenames, and server names with the ones you are using – but you do want the backup file to end up in


:mega: You can also upload and download your Discourse backup file from popular web storage sites such as Google Drive, Dropbox, OneDrive, etc – you’ll need to look up the specific command line instructions based on your preferred web storage provider.

:warning: DO NOT CHANGE THE FILENAME OF THE BACKUP! Discourse treats the backup filename as metadata, so if you change the filename, restoring will not work. Stick with the original file name.

Replace /path/to/backup/discourse-xyz.tar.gz with the local path of your backup file, and replace <server_ip_address> with the IP address of destination server.

:bulb: If Nginx is used as reverse proxy make sure all paths to the backup are readable by the container and Nginx can read the .sock file.

Restore the backup

Access your destination server and go to the Discourse folder

cd /var/discourse

Enter the Discourse Docker app container

./launcher enter app

From inside the Docker container, enable restores via

discourse enable_restore

Restore the backup file

discourse restore sitename-2019-02-03-042252-v20190130013015.tar.gz

Exit the Discourse Docker app container



After the restore process is complete rebuild the destination instance.

:mega: Now is a good time to update /var/discourse/containers/app.yml with full HTTPS, additional plugins or CDN configuration. Compare the app.yml configuration of both instances to make sure!

cd /var/discourse
./launcher rebuild app

:tada: That’s it. Your destination server is successfully restored.

Last Reviewed by @AlexDev on 2022-07-12T00:00:00Z

Move your Discourse Instance to a Different Server
How easy is it to move to another server?
Any other way to take backup and restore?
HELP! My Discourse just deleted everything?
Best Practices for Backups
Problem upgrading Discourse
Quick question about site backups
Is there any way to restore your site from backup in the terminal?
How to migrate Discourse from one server to another with the same DNS name
Restore backup is broken
Migrating Discourse from one DigitalOcean droplet to another without downtime
How to download the backup file without SMTP function?
Index_users_on_username_lower error during database restore: import failed
Redis Problems? (Forum broken after upgrade)
Can't upload backup
Can't upload backup
Can't upload backup
Unable to migrate to S3, therefore unable to restore from backup
Rate limiter issues when uploading a backup file / can't disable rate limiter
Help restoring - system hung at midnight
Help restoring - system hung at midnight
Uploads missing after restore
Issues Rebuilding After Upgrade to Ubuntu 22.04
"EXCEPTION: psql failed: DETAIL: Key (post_id)=(36946) is duplicated."
I'm trying to migrate an old discourse by creating a new discourse, but I'm having trouble
Set up file and image uploads to S3
Migrate from another forum to Discourse
2FA with OTP broken after restoring from Backup
Recover from filesystem backup: can't rebuild nor start
Error: Can't notify admin while restoring backup during a migration to a fresh install
MKJ's Opinionated Discourse Deployment Configuration
Migrate from AWS to Digital Ocean with 2 containers, spaces and 2 CDNs
Restore Failure - S3 (compatible) backup
Cannot restore database: sql key is duplicated
Restore backup right away after installing Discourse
Finding UI generated backup and restoring site