# Is there any way to restore your site from backup in the terminal?

**URL:** <https://meta.discourse.org/t/is-there-any-way-to-restore-your-site-from-backup-in-the-terminal/42377>\
**Category:** Support\
**Created:** [2016 年4 月 11 日 06:31 UTC](https://meta.discourse.org/t/is-there-any-way-to-restore-your-site-from-backup-in-the-terminal/42377 "2016-04-11T06:31:25Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

作者： ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
发布日期： [2025 年8 月 15 日 19:02 UTC](https://meta.discourse.org/t/is-there-any-way-to-restore-your-site-from-backup-in-the-terminal/42377/18 "2025-08-15T19:02:41Z")

</div>

很高兴您找到了解决方案。以下是一些能让其他人更容易操作的建议：

如果您在 `app.yml` 中使用 `DISCOURSE_ALLOW_RESTORE: 'true'`，则可以跳过启用恢复。 （同样，您可以将 Google 身份验证放入环境变量中，完全避免将其保存在数据库中。）

如果您同时使用暂存和生产环境，并且它们使用同一个 S3 存储桶，您可以使用以下命令恢复最新的备份：

```plaintext
docker exec ${CONTAINER_NAME} bash -c '$(discourse restore|grep gz|head -1)'

```

如果您需要本地读取，您也可以类似地使用环境变量覆盖站点设置，它将从本地存储中读取最新的备份。

---

_[View the full topic](https://meta.discourse.org/t/is-there-any-way-to-restore-your-site-from-backup-in-the-terminal/42377)._
