# 从 AWS 迁移到 Digital Ocean，包含 2 个容器、Spaces 和 2 个 CDN

**URL:** https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445
**Category:** Support
**Created:** [2020 年6 月 20 日 18:37 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445 "2020-06-20T18:37:02Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### 作者： ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### 发布日期： [2020 年6 月 20 日 18:37 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/1 "2020-06-20T18:37:02Z")

</div>

我目前将论坛托管在 AWS 上，并计划迁移到 Digital Ocean。

在 AWS 上，我配置了 1 个 CDN，并使用本地存储来存放所有图片。我打算迁移到 Digital Ocean，并对现有架构进行多项“升级”。

在 Digital Ocean 上，我计划进行以下配置：

- 为 Web 和数据分别设置 2 个容器：[Move from standalone container to separate web and data containers](https://meta.discourse.org/t/how-to-move-from-standalone-container-to-separate-web-and-data-containers/29413)
- 将 CDN 迁移至 Faststack
- 在 Spaces 上配置对象存储，并搭配 Faststack 作为 CDN：[Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/using-object-storage-for-uploads-s3-clones/148916)

以下是我的迁移计划：

1. 在 Digital Ocean 上以 [test.example.com](http://test.example.com) 为域名搭建所有服务
2. 确保 AWS 和 Digital Ocean 运行相同版本的 Discourse
3. 在 AWS 上备份 Discourse
4. 更新 DNS 并将 `test.example.com` 重命名为 `live.example.com`，参考：[Change the domain name or rename your Discourse](https://meta.discourse.org/t/change-the-domain-name-or-rename-my-discourse/16098)
5. 将 AWS 的备份恢复到新的 Digital Ocean 服务器上

**问题：**  
I) 这些步骤是否正确？  
II) 恢复备份文件后，Discourse 会自动将图片上传到 Digital Ocean Spaces，还是我需要在恢复后手动运行以下命令？

```
rake s3:upload_assets

```

---

<div class="post-metadata">

### 作者： ![marianord](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/marianord/32/90502_2.png) [@marianord](https://meta.discourse.org/u/marianord)
#### 发布日期： [2020 年6 月 22 日 15:06 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/2 "2020-06-22T15:06:51Z")

</div>

我的理解是，您需要手动将 S3 中的所有资源复制到新的 Spaces，因为上传迁移不会自动完成。

---

<div class="post-metadata">

### 作者： ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### 发布日期： [2020 年9 月 21 日 12:20 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/3 "2020-09-21T12:20:19Z")

</div>

这个周末我终于成功从 AWS 迁移到了 DigitalOcean。以下是我的最终步骤：

1. AWS 地址为 `live.example.com`
2. 在 `live2.example.com` 上设置并运行 DigitalOcean 的 Discourse 实例
3. AWS 和 DigitalOcean 实例均运行相同版本的 Discourse
4. 将 `live.example.com` 设为只读模式，并通过图形界面进行备份
5. 使用 SCP 将备份文件从 AWS 服务器传输到 DigitalOcean 服务器
6. 在 DigitalOcean 服务器上，将 `app.yml` 中的域名更改为 `live.example.com`，然后执行 `./launcher rebuild app`
7. 接着在 DigitalOcean 服务器命令行中恢复备份：[Restore a backup from the command line](https://meta.discourse.org/t/restore-a-backup-from-command-line/108034)
8. 随后更新 DNS 记录，将 `live.example.com` 指向 DigitalOcean 服务器。
9. 至此，您的服务器已正常运行。
10. 然后我按照以下说明配置 S3 上传功能：[Configure an S3 compatible object storage provider for uploads](https://meta.discourse.org/t/using-object-storage-for-uploads-s3-clones/148916)
11. 最后，我按照以下说明配置全站 CDN 加速：[Full site CDN acceleration for Discourse](https://meta.discourse.org/t/full-site-cdn-acceleration-for-discourse/21467)

---

<div class="post-metadata">

### 作者： ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### 发布日期： [2020 年9 月 21 日 13:00 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/4 "2020-09-21T13:00:12Z")

</div>

> [@dfriestedt](#):
>
> 然后我按照这些说明设置了 S3 上传：[使用对象存储进行上传（S3 及克隆）](https://meta.discourse.org/t/using-object-storage-for-uploads-s3-clones/148916)

您是否曾将现有的上传文件从 AWS S3 迁移到 DO Spaces？

---

<div class="post-metadata">

### 作者： ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)
#### 发布日期： [2020 年9 月 21 日 23:17 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/5 "2020-09-21T23:17:24Z")

</div>

在 AWS 上，我将上传文件托管在本地，而不是 S3。迁移到 DigitalOcean 时，我先将数据恢复到本地磁盘，然后迁移到 DO Spaces 和 Stackpath CDN。之后，我需要运行上传和 rake 命令，将图片推送到 S3。

---

<div class="post-metadata">

### 作者： ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### 发布日期： [2020 年9 月 22 日 06:51 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/6 "2020-09-22T06:51:52Z")

</div>

抱歉，我误解了您的第一条帖子。

---

<div class="post-metadata">

### 作者： ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### 发布日期： [2020 年10 月 22 日 06:57 UTC](https://meta.discourse.org/t/migrate-from-aws-to-digital-ocean-with-2-containers-spaces-and-2-cdns/155445/7 "2020-10-22T06:57:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
