在不先设置Web UI的情况下,将Discourse迁移到新服务器?

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 个赞

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 个赞

@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 个赞

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 个赞

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 个赞

Sounds like a bug

Yes. You can do that.

2 个赞

抱歉重新开启一个已解决的主题,但我认为这个澄清应该放在这里,而不是新开一个主题。

如果我想将一个独立的、正在运行的 discourse 安装从旧服务器迁移到新服务器,并且假设新服务器上已安装并运行了 docker,是否可以简单地执行以下操作:

旧服务器:

cd /var/discourse
./launcher stop app

新服务器:

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

然后更改 DNS,将论坛的域名指向新服务器。

???

1 个赞

在重建之前,你需要更改。如果你要更改主机名,备份和恢复会更简单。否则,你需要遵循更改域名或重命名 Discourse?

你可以使用 scp 移动备份,并从命令行进行恢复。

1 个赞

您好,谢谢。主机/域名名称将保持不变。我只是要迁移到一个更大、更新的服务器。在这种情况下,这个简单的策略是否可行?

编辑:我正在编辑上面的原始帖子,以更清楚地说明论坛的主机名不会改变——只是更换服务器。抱歉造成混淆。

2 个赞

明白了。也许应该有一个 #howto。

是的,您可以 rsync /var/discourse 到新服务器(这样可以获取 ssl 证书),然后重建,接着切换 DNS,这样应该就能正常工作了。

2 个赞

如果您正在更改服务器规格,那么运行 discourse-setup 将会使您受益,它会处理某些方面的扩展(unicorn workers 和 db shared buffers)并自动配置 app.yml。仅仅复制文件夹是无法实现这一点的。

2 个赞

谢谢 Stephen,

我计划在 app.yml 中手动调整这些参数。我将与现在一样,在同一台服务器上将 discourse 与其他几个基于 docker 的应用程序并行运行,因此我已将它们的资源使用量调整到比 discourse 是唯一运行的应用程序时设置会根据服务器规格设定的值稍低一些的水平。

2 个赞

此主题已在 2361 天后自动关闭。不再允许回复。