Move Discourse to a new server without setting up the web UI first?

Let’s say I want to move my Discourse site from one Amazon EC2 instance (e.g. t2.micro) to a larger instance (e.g. t2.medium), what is the correct procedure for this?

The only option I know about is:

  1. Backup the existing site
  2. Install Discourse on the new server
  3. Configure Discourse using temporary values
  4. Restore the backup

However, I’m thinking that the smart people at Discourse thought about this situation and there’s a way to restore a backup on a new installation without step 3.

Scouring the site, I wasn’t able to find a definitive answer.

I did look at Move your Discourse Instance to a Different Server, but the instructions seem to imply that a generic installation is already active on the target server and that you can log in and immediately perform a restore.

1 Like

I think what you want to know is that you can copy the backup to the new instance and then restore from the command line like

cd /var/discourse
./launcher enter app
discourse enable_restore
discourse restore

The last command will give you a list of available backups and you can copy-and-paste to start the restore.

5 Likes

@pfaffman thank you for helping with this question, there’s one spot where I’m still a bit unclear.

On the new server (assuming the prerequisites are already installed), after cloning the Discourse repository, do I still need to run discourse-setup? I don’t believe it’s possible to issue the commands

until after setup completes. Or am I incorrect? If I am correct, this is the part I’m referring to, you have to essentially provide a set of default values before you are able to perform a restore.

1 Like

Yes, you still need to set up Discourse, but you can just use the same app.yml that you use on the old instance (or type them in to discourse-setup if that’s easier for you). But you have to have all of those values for a running Discourse anyway, so it’s not “temporary” values, but the values.

The command-line restore saves the you time of creating a temporary admin account that you’d use just to restore the backup.

6 Likes

when I use the command line, everything goes well during the restore but at the end I get the following error:
Something went wrong while notifying user.

do you have any idea what I should do?

also is it possible to set up the new server by simply copying /var/discourse/ of the old server into the new one, rather than restoring a backup?

1 Like

Sounds like a bug

Yes. You can do that.

2 Likes

Sorry to re-open an old / solved topic, but I thought this clarification should be in here rather than a new topic.

If I want to re-locate a working stand-alone discourse install from old-server to new-server, and assuming that docker is installed and working on new-server, could it be as simple as:

old-server:

cd /var/discourse
./launcher stop app

new-server:

rsync old-server:/var/discourse /var
cd /var/discourse
./launcher rebuild app

Then change the DNS to point the forum’s domain name to new-server.

???

1 Like

You need to change the before your rebuild. And if you’re going to change the host name it’s easier to backup and restore. Else you need to follow Change the domain name or rename my Discourse?.

You can move the backup with scp and restore from the command line.

1 Like

Hi thanks. There will be no change in the host / domain name. I’m simply moving to a new, bigger server. Will this simple strategy work in that case?

Edit: I’m editing my original post above to try to make clearer that the hostname for the forum won’t be changing - just a new server. Sorry for the confusion.

2 Likes

I see. Perhaps there should be a #howto.

Yes, you can rsync /var/discourse to the new server (and that’ll get the ssl certs), and do a rebuild, and then switch the dns and it should just work.

2 Likes

If you’re changing server specs then you will benefit from running discourse-setup - it handles certain aspects of scaling (unicorn workers and db shared buffers) and will automatically configure the app.yml. Just copying folders across won’t achieve this.

2 Likes

Thanks Stephen,

I plan to hand tweak those parameters in app.yml. I’ll be running discourse in parallel to a few other docker-based apps on the same server (as I am now), and so I have them tuned to a bit lower resource usage level than where setup would put them based on the server specs if discourse were the only app running.

2 Likes