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

**URL:** https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504
**Category:** Self-hosting
**Created:** [20.Декабрь.2017 19:29:16 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504 "2017-12-20T19:29:16Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![ffhaddad](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@ffhaddad](https://meta.discourse.org/u/ffhaddad)
#### Post date: [20.Декабрь.2017 19:29:16 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/1 "2017-12-20T19:29:16Z")

</div>

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](https://meta.discourse.org/t/move-your-discourse-instance-to-a-different-server/15721), 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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [20.Декабрь.2017 20:10:23 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/2 "2017-12-20T20:10:23Z")

</div>

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

```plaintext
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.

---

<div class="post-metadata">

### Author: ![ffhaddad](https://avatars.discourse-cdn.com/v4/letter/f/ccd318/32.png) [@ffhaddad](https://meta.discourse.org/u/ffhaddad)
#### Post date: [20.Декабрь.2017 20:43:13 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/3 "2017-12-20T20:43:13Z")

</div>

@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

> [@pfaffman](#):
>
> ./launcher enter app  
> discourse enable\_restore  
> discourse restore

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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [20.Декабрь.2017 20:45:35 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/4 "2017-12-20T20:45:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [24.Январь.2020 09:39:11 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/5 "2020-01-24T09:39:11Z")

</div>

Когда я использую командную строку, процесс восстановления проходит нормально, но в конце появляется следующая ошибка:  
`Произошла ошибка при уведомлении пользователя.`

Не могли бы вы подсказать, что мне делать?

Также возможно ли настроить новый сервер, просто **скопировав** /var/discourse/ со старого сервера на новый, вместо восстановления из резервной копии?

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [24.Январь.2020 10:59:07 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/6 "2020-01-24T10:59:07Z")

</div>

> [@Pad\_Pors](#):
>
> При уведомлении пользователя произошла ошибка

Похоже на ошибку.

> [@Pad\_Pors](#):
>
> Можно ли настроить новый сервер, просто **скопировав** /var/discourse/ со старого сервера на новый?

Да, вы можете это сделать.

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [03.Сентябрь.2022 10:46:19 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/7 "2022-09-03T10:46:19Z")

</div>

> [@pfaffman](#):
>
> > [@Pad\_Pors](#):
> >
> > Можно ли настроить новый сервер, просто **скопировав** /var/discourse/ со старого сервера на новый?
> 
> Да, можно.

Извините, что возвращаюсь к старой / уже решённой теме, но я подумал, что это уточнение лучше разместить здесь, а не создавать новую тему.

Если я хочу перенести работающую автономную установку Discourse со старого сервера на новый, при условии, что на новом сервере установлен и работает Docker, может ли это быть так просто:

старый сервер:

```plaintext
cd /var/discourse
./launcher stop app

```

новый сервер:

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

```

Затем изменить DNS, чтобы доменное имя форума указывало на новый сервер.

???

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [03.Сентябрь.2022 11:23:11 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/8 "2022-09-03T11:23:11Z")

</div>

Вам нужно изменить это перед пересборкой. И если вы собираетесь изменить имя хоста, проще сделать резервную копию и восстановить её. В противном случае вам нужно следовать инструкции [Как изменить доменное имя или переименовать мой Discourse?](https://meta.discourse.org/t/change-the-domain-name-or-rename-my-discourse/16098).

Вы можете переместить резервную копию с помощью scp и восстановить её из командной строки.

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [03.Сентябрь.2022 11:59:12 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/9 "2022-09-03T11:59:12Z")

</div>

Привет, спасибо. Имя хоста/домена не изменится. Я просто перехожу на новый, более мощный сервер. Сработает ли в этом случае такая простая стратегия?

Редактирование: Я редактирую свой первоначальный пост выше, чтобы прояснить, что имя хоста для форума не изменится — просто новый сервер. Извините за путаницу.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [03.Сентябрь.2022 13:18:22 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/10 "2022-09-03T13:18:22Z")

</div>

Понятно. Возможно, стоит создать раздел #howto.

Да, вы можете использовать rsync для копирования /var/discourse на новый сервер (это перенесёт и SSL-сертификаты), затем выполнить rebuild, переключить DNS, и всё должно заработать.

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [03.Сентябрь.2022 20:51:05 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/11 "2022-09-03T20:51:05Z")

</div>

Если вы меняете характеристики сервера, вам стоит запустить `discourse-setup` — это утилита, которая автоматически настраивает `app.yml` и оптимизирует параметры масштабирования (количество воркеров Unicorn и общие буферы базы данных). Простое копирование папок не обеспечит такой настройки.

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [03.Сентябрь.2022 21:19:54 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/12 "2022-09-03T21:19:54Z")

</div>

Спасибо, Стивен,

Я планирую вручную настроить эти параметры в app.yml. Я буду запускать Discourse параллельно с несколькими другими приложениями на основе Docker на том же сервере (как и сейчас), поэтому я настроил их на чуть более низкий уровень использования ресурсов, чем то, что установка предложила бы исходя из характеристик сервера, если бы Discourse был единственным запущенным приложением.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [08.Июнь.2024 12:36:42 UTC](https://meta.discourse.org/t/move-discourse-to-a-new-server-without-setting-up-the-web-ui-first/76504/13 "2024-06-08T12:36:42Z")

</div>

Эта тема была автоматически закрыта через 2361 день. Новые ответы больше не принимаются.
