> For the complete documentation index, see [llms.txt](https://ayakaleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/wei-hu/upgrading-your-deployment.md).

# 升级您的部署

{% hint style="danger" %}
重要的是要确保你进行 [一致性备份](/on-premises/zh-cn/wei-hu/data-and-backups.md#performing-a-consistent-backup) **之前** 在每次主版本升级时，以便在需要时能够回滚。
{% endhint %}

该 [Overleaf Toolkit↗](https://github.com/overleaf/toolkit) 是一个 git 仓库，因此很容易获得新的 Toolkit 功能。只需运行 `bin/upgrade` 命令并按照屏幕上的提示操作。

值得注意的是，Docker 镜像版本（在 `config/version`）是与 Toolkit 代码更新分开管理的。更新 Toolkit 代码将 **不要** 自动更改你正在运行的 Docker 镜像版本。这意味着在大多数情况下，你可以在不升级部署的情况下升级 Toolkit 版本。

#### 该 `bin/upgrade` 脚本

当你运行 `bin/upgrade` 命令后，脚本将检查 Toolkit 代码是否有可用更新，并提示你更新 Toolkit。你始终可以拒绝此次升级，且不会有任何变化。

如果你确实选择更新 Toolkit 代码，脚本随后将检查 *默认* Docker 镜像版本是否已更改，并建议升级你的本地版本文件（位于 `config/version`）以匹配新的默认值。

如果你确实选择切换版本，脚本将引导你完成关闭 Docker 服务、创建备份并重新启动 Docker 服务的过程。你的旧版本文件将自动复制到 `config/__old-version`，以防你需要回滚到该 Docker 镜像版本。

{% hint style="danger" %}
在执行 Server CE/Pro 升级时，我们建议先升级到已部署主版本的最新发布版 **之前** 再升级到 **下一个** 主版本的最新发布版。如果你的部署比最新版本落后超过一个主版本，则需要执行多步骤升级。

例如，如果你运行的是 3.5.10，则需要升级到 3.5.13 -> 执行完整项目历史迁移 -> 4.2.9 -> 5.5.4。

你应该 **绝不** 跳过主版本（3.5.10 -> 5.5.4）。如果你使用 Toolkit，且比最新版本落后超过一个主版本，你必须 **不要** 使用 `bin/upgrade` 该脚本，因为你将需要执行手动的多步骤升级。
{% endhint %}

{% hint style="info" %}
对于手动导入 Docker 镜像的空气隔离设置，请设置 `PULL_BEFORE_UPGRADE=false` 在你的 `config/overleaf.rc` 文件。

请查看 [这里](/on-premises/zh-cn/an-zhuang/air-gapped-offline-deployments.md) 以获取有关在空气隔离/离线环境中部署的更多信息。
{% endhint %}

### 升级路径 <a href="#upgrade-path" id="upgrade-path"></a>

该 `bin/upgrade` 命令将始终选择当时可用的最新 Server Pro/CE 版本。如果你的升级周期不频繁，这可能会导致跳过主要版本，并有可能升级到你未预期的版本。

在执行升级时，我们建议先升级到当前主版本的最新发布版，再升级到下一个主版本的最新发布版。例如，如果你当前运行的是 3.3.2，而可用的最新版本是 5.3.1，那么正确的升级路径应为：

* 3.3.2 -> 3.5.13
* 3.5.13 -> 4.2.9
* 4.2.9 -> 5.5.1

为避免任何升级问题，我们建议你查阅我们的 [发行说明](https://docs.overleaf.com/on-premises/release-notes) ，然后再执行任何升级，因为某些版本可能需要额外步骤，例如手动修改 Toolkit、升级数据库或运行迁移脚本。

如果你还没有这样做，请订阅我们的 [邮件列表](https://mailchi.mp/overleaf.com/community-edition-and-server-pro) ，以便在发布新版本/更新时收到通知。这将使你能够安排与我们发布计划紧密配合的定期维护窗口。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://ayakaleaf-pro.ayaka.space/on-premises/zh-cn/wei-hu/upgrading-your-deployment.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
