How to Migrate a Discourse Site to a New Server

Posted on by Luke Cavanagh | Updated:
Reading Time: 4 minutes

Discourse is open source software for community discussion. An example would be if you wanted to add a place for community discussion for a company. Many well-known companies use Discourse for their community, such as Atlassian, Figma, Asana, New Relic, and Cloudflare.

Discourse is designed for a well-performant community hosting open source software, and it includes many plugins which can be enabled in your community on your site. Discourse software runs in a Docker container and uses Redis for performance as an in-memory data store. This article covers migrating a Discourse site to a new virtual private server (VPS).

Prerequisites

  • VPS on which to run Discourse.
  • SSH access for your VPS.
  • Admin access on your existing Discourse site.
  • Basic command line skills.
  • Ability to use the Command line on your VPS.
  • Ability to edit DNS entries for your Discourse sub-domain.

Migrate Discourse Site to a New Server

Discourse will need to be installed on your VPS plan to migrate your existing DIscourse install. Discourse is a 100% command line install and has a small amount of setup, which is available from the user interface (UI) of the application. 

Step 1

Find your SSH credentials for your VPS plan to login to your server and install the Discourse site. 

During the installation, you will need to know the following information for the Discourse configuration.

Hostname for your Discourse? [discourse.example.com]: 
Email address for admin account(s)? [me@example.com,you@example.com]: 
SMTP server address? [smtp.example.com]: 
SMTP port? [587]: 
SMTP user name? [user@example.com]: 
SMTP password? [pa$$word]: 
Let's Encrypt account email? (ENTER to skip) [me@example.com]: 
Optional Maxmind License key () [xxxxxxxxxxxxxxxx]:

Step 2

Put your existing live Discourse site into read-only mode, meaning new content and users will not add to the site's database while the migration is underway.
Navigate to Admin > Backups and click Enable Read-Only.

Now that your Discourse site is in read-only mode, you can create a site backup from the same section. Once the backup is complete, you will need to download the backup locally for importing into your new install Discourse site.

Step 3

To access the DIscourse new installation when it is complete, you must update the host DNS A record to the new server IP address. How your DNS is updated depends on whose nameservers you use for DNS. If you use Liquid Web’s nameservers, editing the DNS record should be very straightforward. Existing customers can always reach out to the support team for assistance.

Setting the DNS propagation time as short as possible would be recommended to minimize the downtime and total migration time. After the Discourse installation is complete, you can create a new admin user and log in. Confirm the email for the admin user and complete the setup within the browser of the site.

Step 4

It is recommended to update the DIscourse installation to the latest version.

cd /var/discourse
git pull
./launcher rebuild app

Step 5

After logging into the site, you will need to import the existing site’s backup from the application UI. To upload the backup, enable the restore in the admin panel. Navigate to Admin > Settings > Backups and click the checkbox next to allow restore.

Then, navigate to Admin > Backup > Upload to proceed with the upload. The upload time will depend on your internet connection speed and the backup file size. A rough estimate of migration time for a planned Discourse site maintenance might be between 30 and 60 minutes.

Informing your Discourse community well before the site migration makes it less of a surprise when it goes into read-only mode, keeping them informed and aware. You could add an announcement post about the expected scheduled maintenance time to your existing Discourse site and post it on social media for your community to see. You can also create an email communication if your community has email marketing.

Step 6

If your existing Discourse site uses plugins, you need to copy them from app.yml for the existing site and add them into the app.yml file for the new installation. Once completed, update Discourse from the command line.
It is recommended to have a local backup of your app.yml file for your Discourse site so that you can update and rebuild the app as needed. Copying the plugin entries from your local file into the one used on the new installation can be done locally and offline. If you do it this way, replace the app.yml file using your file manager application, or you can edit the server file and then save it with the following command.

cd /var/discourse
./launcher rebuild app

After correctly importing the backup, check that the settings are correct in the admin section of your Discourse site. You do not have to change the subdomain of your Discourse site, and it can stay the same as before.

Final Thoughts

Installation of a new Discourse site and migrating an existing Discourse site is not as complex as it might seem. The longest part of the process is installing the new Discourse install on your VPS plan and the DNS updating process. If you prepare and plan, the complete process can be accomplished within an hour, but your mileage may vary.

Regarding VPS Hosting, Liquid Web has some of the fastest in the industry. Contact our sales team to give your Discourse site the boost it needs.

Avatar for Luke Cavanagh

About the Author: Luke Cavanagh

Product Operations Manager at Liquid Web. Devoted husband and Tween wrangler. Synthwave enthusiast. Jerry Goldsmith fan. Doctor Who fan and related gubbins.

Latest Articles

Blocking IP or whitelisting IP addresses with UFW

Read Article

CentOS Linux 7 end of life migrations

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article