This is a guide for moving your Discourse instance from one server to another, including all settings and data. This guide applies to self-hosted Discourse instances using Docker.
Required user level: System Administrator
This procedure involves domain and DNS changes. Ensure you have access to both the source and destination servers.
This guide walks you through the process of migrating your Discourse instance from one server to another, ensuring your data, settings, and configuration are preserved.
Summary
You will perform the following key steps in this guide:
- Back up your current Discourse instance (source server).
- Transfer the backup file to your target Discourse instance (destination server).
- Restore the backup on the destination server.
- Update DNS settings (if applicable).
Adjusting DNS settings (when required)
If you’re using the same domain for the new server, reduce the TTL (time to live) on your DNS entry in advance. This ensures minimal downtime during propagation of the updated DNS records. If you’ll use a new domain, this step can be skipped.
Logging in and preparing the source server
- Log in to your source Discourse instance with an account that has administrator permissions.
- Ensure both the source and destination servers are using:
- The same Discourse version.
- The same set of plugins.
- Upgrade the Discourse version on both servers by visiting
/admin/upgrade
.
Avoid restoring a newer backup onto an older Discourse version, or incompatible PostgreSQL versions, as this may result in errors.
Creating and downloading the backup
- Navigate to
/admin/backups
on your source Discourse instance. - Click the Backup button to create a backup:
- When prompted, confirm by clicking Yes.
- Once the backup is complete, return to the Backups tab, and locate the newly created backup.
- Click Download to save the file locally:
Before proceeding, review your
app.yml
file to ensure any optional settings, such as CDN configurations, installed plugins, or HTTPS support, are consistent between the source and destination servers.
Restoring the backup on the destination server
To restore the backup via the command line, refer to the relevant documentation.
- Sign in as an administrator to your destination Discourse instance.
- Navigate to
/admin/site_settings
, and search forrestore
. Enable theallow restore
setting. - Go to
/admin/backups
and upload the backup file you downloaded earlier by clicking the Upload button:
- After the upload completes, click the Restore button for the uploaded backup:
- Confirm by clicking Yes when prompted.
The restoration process will begin. This may take some time depending on your database size. After the process completes, you’ll be logged out automatically.
Finishing up and logging in
- Log into your destination Discourse instance with your admin credentials.
- If the site was backed up using HTTPS, ensure HTTPS is enabled on the new server. If not properly configured, use the Rails console to disable the “force https” setting temporarily.
- Re-enable any optional configurations by editing the
app.yml
file and rebuilding your instance. This may include:- Enabling CDN support.
- Installing additional plugins.
- Setting HTTPS configurations.
Common issues and solutions
Backup file is not restoring
- Check that the Discourse and PostgreSQL versions match between the source and destination servers.
Unable to log in after restoration (with HTTPS enabled)
- Use the Rails console to disable
force https
temporarily by running:SiteSetting.force_https = false
Last edited by @SaraDev 2024-11-21T00:47:52Z
Check document
Perform check on document: