Some checks failed
App Prod-Parity E2E Dispatch / dispatch (push) Failing after 10s
CD Storybook UI / build (push) Failing after 3m25s
CD Storybook UI / dispatch (push) Has been skipped
CD deploy main / website-changed-files (push) Successful in 18m8s
CI Agent Skills / changed-files-check (push) Successful in 18m9s
CI Create App E2E minimal / changed-files-check (push) Successful in 24s
CI Create App / changed-files-check (push) Successful in 26s
CI Docs / changed-files-check (push) Successful in 26s
CI Emails / changed-files-check (push) Successful in 28s
CI Example App Hello World / changed-files-check (push) Successful in 23s
CI Front / changed-files-check (push) Has been skipped
CI Example App Postcard / changed-files-check (push) Successful in 27s
CI UI / changed-files-check (push) Has been skipped
CI Utils Test / changed-files-check (push) Successful in 45s
CI Twenty Apps / discover (push) Successful in 1m3s
CD deploy main / deploy-main (push) Failing after 3s
CI Agent Skills / agent-skills-validate (push) Has been skipped
CI Create App / create-app-test (lint) (push) Has been skipped
CI Emails / emails-test (push) Has been skipped
CI Front / front-task (lingui:compile) (push) Has been skipped
CI Front / front-task (lint) (push) Has been skipped
CI Example App Postcard / example-app-postcard (push) Has been skipped
CI UI / ui-task (lint) (push) Has been skipped
CI UI / ui-task (pack-size) (push) Has been skipped
CI UI / ui-task (size) (push) Has been skipped
CI UI / ui-task (test) (push) Has been skipped
CI UI / ui-task (typecheck) (push) Has been skipped
CI Utils Test / utils-test (push) Has been skipped
CI Twenty Apps / ${{ matrix.app.name }} (push) Has been skipped
CI Emails / ci-emails-status-check (push) Successful in 2s
CI Example App Hello World / ci-example-app-hello-world-status-check (push) Successful in 2s
CI Example App Postcard / ci-example-app-postcard-status-check (push) Successful in 3s
CI UI / ui-sb-test (push) Has been skipped
CI Utils Test / ci-utils-test-status-check (push) Successful in 2s
CI Twenty Apps / ci-twenty-apps-status-check (push) Successful in 2s
CI UI / ci-ui-status-check (push) Successful in 2s
CI Desktop / desktop (push) Failing after 1m8s
Push docs to Crowdin / Push documentation to Crowdin (push) Failing after 55s
Push translations to Crowdin / Extract and upload translations (push) Failing after 5s
Push website translations to Crowdin / Extract and upload website translations (push) Failing after 5s
CI Create App / create-app-test (test) (push) Has been skipped
CI Create App / create-app-test (typecheck) (push) Has been skipped
CI Docs / docs-lint (push) Has been skipped
CI Example App Hello World / example-app-hello-world (push) Has been skipped
CI Front / front-task (lingui:extract) (push) Has been skipped
CI Front / front-task (test) (push) Has been skipped
CI Front / front-task (typecheck) (push) Has been skipped
CI UI / ui-sb-build (push) Failing after 1m32s
CI Twenty Apps / ${{ matrix.app.name }} (${{ matrix.server-source }}) (push) Has been skipped
CI Agent Skills / agent-skills-publish (push) Has been skipped
CI Create App / ci-create-app-status-check (push) Successful in 2s
CI Agent Skills / agent-skills-remote-source (push) Has been skipped
CI Create App E2E minimal / create-app-e2e-minimal (push) Has been cancelled
CI E2E Main / e2e-test (push) Has been cancelled
CI Front / front-sb-build (push) Has been cancelled
CI Front / front-build (push) Has been cancelled
CI Create App E2E minimal / ci-create-app-e2e-minimal-status-check (push) Has been cancelled
CI E2E Main / ci-e2e-main-status-check (push) Has been cancelled
CI E2E Main / notify-main-ci-failure (push) Has been cancelled
CI E2E Main / qa-scout-comment (push) Has been cancelled
CI Front / front-sb-test (push) Has been cancelled
CI Front / front-sb-screenshots (push) Has been cancelled
CI Front / ci-front-status-check (push) Has been cancelled
DPA Sub-Processor Sync / sync-subprocessors (push) Failing after 3s
AI Catalog Sync / sync-catalog (push) Failing after 2s
107 lines
4.2 KiB
Plaintext
107 lines
4.2 KiB
Plaintext
---
|
||
title: 升级指南
|
||
icon: arrow-up-right-dots
|
||
---
|
||
|
||
## 通用指南
|
||
|
||
**在开始升级流程之前务必备份数据库**,运行:
|
||
|
||
```bash
|
||
docker exec -it {db_container_name_or_id} pg_dumpall -U {postgres_user} > databases_backup.sql
|
||
```
|
||
|
||
从备份恢复:
|
||
|
||
```bash
|
||
cat databases_backup.sql | docker exec -i {db_container_name_or_id} psql -U {postgres_user}
|
||
```
|
||
|
||
如果您使用 Docker Compose,请按照以下步骤操作:
|
||
|
||
1. 停止 Twenty:`docker compose down`
|
||
2. 在与 `docker-compose.yml` 同目录的 `.env` 文件中更改 `TAG` 值
|
||
3. 启动 Twenty:`docker compose up -d`
|
||
|
||
服务器在启动时会自动运行所有所需的升级迁移。 无需手动执行任何命令。
|
||
|
||
## 升级到 v2.34+ — 最低要求 PostgreSQL 15
|
||
|
||
Twenty v2.34 要求 PostgreSQL 15 或更高版本。 官方 Docker Compose 配置使用 PostgreSQL 16。 如果您的实例连接到外部托管的数据库,请在启动 v2.34 服务器之前对其进行升级。
|
||
|
||
## 跨版本升级(v1.23+)
|
||
|
||
自 **v1.23** 起,Twenty 支持跨版本升级。 您可以从任意受支持的版本直接跳到最新版本,而无需逐一经过每个中间版本。
|
||
|
||
例如,从 v1.23 直接升级到 v2.0 完全受支持。
|
||
|
||
## 升级到 v2.5+ — 静态数据加密信封
|
||
|
||
从 **v2.5** 开始,Twenty 会将静态存储的机密(OAuth 令牌、应用程序变量、签名密钥的私钥、敏感配置值、TOTP 机密)存储在带版本的 `enc:v2:` 加密信封中,并使用 `ENCRYPTION_KEY`(如果未设置 `ENCRYPTION_KEY`,则使用 `APP_SECRET`)进行加密。
|
||
|
||
在 v2.5 的首次启动时会运行较慢的升级命令,将现有行**回填**到新的加密信封中。 这些命令是幂等的——中断并重新启动服务器后会从上次停止的位置恢复——但在大型数据库上可能需要一段时间才能完成。 你可以使用 `upgrade:status` 来监控进度。
|
||
|
||
你应该在 v2.5 升级**之前**设置专用的 `ENCRYPTION_KEY`,这样回填从一开始就会在该密钥下写入行。 在回填完成后再更换密钥,则需要进行一次[轮换](/l/zh/developers/self-host/capabilities/key-rotation)。
|
||
|
||
## 轮换机密和签名密钥
|
||
|
||
对于日常运维任务,例如轮换 `ENCRYPTION_KEY`、轮换 JWT 签名密钥或吊销泄露的签名密钥,请参阅专门的[密钥轮换指南](/l/zh/developers/self-host/capabilities/key-rotation)。
|
||
|
||
## 检查升级状态
|
||
|
||
`upgrade:status` 命令可用于查看您的实例和工作区迁移的当前状态。 这在调试升级问题或提交支持请求时非常有用。
|
||
|
||
在服务器容器中运行:
|
||
|
||
```bash
|
||
docker exec -it {server_container_name_or_id} yarn command:prod upgrade:status
|
||
```
|
||
|
||
示例输出:
|
||
|
||
```sh
|
||
APP_VERSION: v1.23.0
|
||
|
||
Instance
|
||
Inferred version: 1.23.0
|
||
Latest command: 1.23.0_DropWorkspaceVersionColumnFastInstanceCommand_1785000000000
|
||
Status: Up to date
|
||
Executed by: v1.23.0
|
||
At: 2026-04-16T11:43:58.823Z
|
||
|
||
Workspace
|
||
Apple (20202020-1c25-4d02-bf25-6aeccf7ea419)
|
||
Inferred version: 1.23.0
|
||
Latest command: 1.23.0_UpdateGlobalObjectContextCommandMenuItemsCommand_1780000005000
|
||
Status: Up to date
|
||
Executed by: v1.23.0
|
||
At: 2026-04-16T11:44:09.361Z
|
||
|
||
Summary
|
||
Instance: Up to date
|
||
Workspaces: 1 up to date, 0 behind, 0 failed (1 total)
|
||
```
|
||
|
||
### 选项
|
||
|
||
| 标志 | 描述 |
|
||
| ------------------------- | ----------------------- |
|
||
| `-w, --workspace-id <id>` | 筛选特定工作区。 可多次传递。 |
|
||
| `-f, --failed-only` | 隐藏已是最新的工作区,仅显示落后和失败的条目。 |
|
||
|
||
## 故障排除
|
||
|
||
如果某些工作区的升级失败,服务器将不会越过失败的步骤继续进行。 重启服务器(`docker compose up -d`)将从中断处重试升级。
|
||
|
||
要快速定位问题,运行:
|
||
|
||
```bash
|
||
docker exec -it {server_container_name_or_id} yarn command:prod upgrade:status --failed-only
|
||
```
|
||
|
||
这将仅显示落后或失败的工作区,并附上每个失败的错误信息。
|
||
|
||
## v1.23 之前
|
||
|
||
如果您的实例早于 v1.23,您必须按顺序逐步升级经过每个主要标记版本(从 v1.6 到 v1.7,再从 v1.7 到 v1.8,依此类推),直到达到 v1.23。 届时,您可以直接跳到最新版本。
|