Move Discourse Between Subdomains - Will This Work?

AI-generated summary

A user seeks advice on moving a Discourse instance from one subdomain to another across different servers. The proposed method—backing up from the source server and restoring on the target server—works, but requires running script/discourse remap to update URLs. Initially, the remap command failed due to a missing thor gem, which was resolved by executing it as the discourse user. Avatars did not transfer during the restore, even with image inclusion in the backup, but were successfully recovered by manually copying the uploads/defaults directory from the source to the target server.

Situation:

Note: Both instances below (server 1 and 2) running in docker containers on two different servers. Both servers running on both HTTP and HTTPS (ports 80 and 443) with Let’s Encrypt certs:

  1. Discourse fully running on server 1 with IP address 1, both HTTP and HTTPS: discourse-test.example-domain.com
  2. Discourse initialized and running (no additional posts or topics yet) on server 2 with IP address 2, both HTTP and HTTPS: talktime.example-domain.com

Goal:

Move all from server 1 (testing) to server 2 (production) changing domain from discourse-test.example-domain.com to talktime.example-domain.com

Proposed Approach:

  1. Take a backup of Discourse on server 1
  2. Restore backup of Discourse (from server 1) on server 2

This should work flawlessly?

Or is there some gotacha’ to look out for?

Thanks for any pointers.

That should work. Do a

script/discourse remap //discourse-test.example-domain.com //talktime.example-domain.com

after the restore.

Update:

Worked… thanks.

But the avatars and did not restore, for some reason.

Maybe because this fails ?

script/discourse remap //discourse-test.example-domain.com //talktime.example-domain.com

Traceback (most recent call last):

2: from script/discourse:4:in `<main>'

1: from /usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'

/usr/local/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- thor (LoadError)

This worked:

su discourse -c 'bundle exec script/discourse remap //discourse-test.example-domain.com //talktime.example-domain.com

… and ran OK…

But the avatars not did port over in this restore process (we selected include images in the backup).

Update:

We got the avatars to work by porting over the images from server 1 to server 2 from here:

/var/discourse/shared/standalone/uploads/defaults