Chuyển Discourse sang Server mới

Chuyển Discourse sang Server mới
0

In this guide we’ll move an existing Discourse instance on Linode (source) to a new Discourse instance on Digital Ocean (destination), but of course these steps will work on any other cloud providers that support Docker.

:bell: If you are using the same domain name and moving servers, you should set the TTL (time to live) on your DNS entry to a very low value in advance of the change. If you are using different domain names, this won’t matter.

Log In and Update

Only admins can perform backups, so sign in as an account with admin access on your source Discourse instance.

Ideally, both the new and old Discourses should be on the same version, to ensure proper backup/export. What you want to avoid is restoring a newer backup on an older version (the same goes for the Postgres version). That won’t work. Visit /admin/upgrade to upgrade the destination instance for sure, both instances if you can.

Create and Download Your Backup

Visit /admin/backups and click Backup button.

33

You will be prompted for confirmation, press Yes . You will see the log of backup processing. Once processing is finished, switch back to Backups tab.

Now you will see the newly created backup file. Click Download button and save the file.

45

:bell: Before you switch over to the new server, review your app.yml for any optional settings such as CDN, installed plugins, and HTTPS support between the two Discourse instances. It’s easier to make sure the two instances are identical before you begin restoring the backup.

Log In and Restore Backup

:bulb: Don’t want to deal with the web UI yet? Follow these steps to restore a backup at the command line.

Sign up and login on your destination Discourse instance.

Under /admin/site_settings search for restore and enable the allow restore setting.

Browse to /admin/backups and click Upload button, select the backup file you downloaded previously from your source Discourse instance (filename ends with .tar.gz ):

04

Once the file is uploaded it will be listed as shown below, click Restore button:

50

Press Yes when prompted for confirmation. You will see restore process log, it may take some time but it’s automagically importing all your source Discourse instance data.

Once the Restore process finishes, you will be logged out.

Log In and You’re Done

:warning: If you are logging in to a backup that was taken with HTTPS, the site setting “force https” will be enabled. You either need to turn that off via the Rails console, or ensure that your restore is also properly running under HTTPS.

Once the restore process finishes, all the data from your source Discourse instance on Linode server will be imported in your destination Discourse instance on Digital Ocean, sign in with your Admin account and you are good to go!

:bell: Don’t forget to enable any optional configuration settings that require editing the app.yml and rebuilding, such as CDN, plugins, and HTTPS support.