ci: deploy published Planet releases by image digest
This commit is contained in:
1 parent
e53c3af355
commit
1e9508f2f1
12 files changed
+1296
-51
No files matched your search
@@ -473,6 +473,44 @@ uv run pytest backend/tests/test_otp_service.py
|
||||
5. After deployment, open Earth, enable "Border Lines", and inspect China's southeast coast, Taiwan, Hainan, the South China Sea, Zangnan, Kosovo, and Gaza for hover behavior and boundary policy.
|
||||
6. If no high-precision manifest/PMTiles exists locally, Earth uses the bundled `frontend/public/earth/data/countries-admin0.min.geojson` fallback. If high-precision assets exist but tile requests fail, troubleshoot PMTiles range requests, manifest provider, Nginx `.pmtiles` static serving, and sha256 consistency.
|
||||
|
||||
## Publish locally and deploy production releases automatically
|
||||
|
||||
Push the stable version tag to Gitea. On a new publishing workstation, sign in to the dedicated Docker configuration with a Gitea token scoped to `write:package`. Git release credentials and the package writer credential are stored separately.
|
||||
|
||||
```bash
|
||||
docker --config "${XDG_CONFIG_HOME:-$HOME/.config}/planet/registry" login gitea.rclaw.top --username linkong
|
||||
```
|
||||
|
||||
Run the following command from the tagged commit.
|
||||
|
||||
```bash
|
||||
python3 scripts/release_publish.py --tag "$(git describe --tags --exact-match)" --use-git-credential
|
||||
```
|
||||
|
||||
The publisher builds Linux amd64 images for `admin`, `backend`, and `aiprovider` from the tag, then verifies their revisions and digests in Gitea. Admin uses the lightweight build target. Desktop packages are built from the same commit by default. Pass `--assets-dir client/release` to reuse complete packages and a hotfix built for that tag. Repeat the same command after an interrupted upload to reuse the original build and verified attachments. The workstation can go offline once publication succeeds.
|
||||
|
||||
The production host checks the latest stable Gitea Release approximately every two minutes using `planet-release-deploy.timer`. Once all three images and the hotfix checksum are available, it pulls the images by digest, backs up PostgreSQL, updates AI Provider, backend, and Admin in order, verifies their endpoints, publishes the Earth hotfix, and downloads it to verify its checksum. The host retains its Compose configuration, memory limits, and data volumes. Apply the release-specific infrastructure migration first when a release requires new mounts, services, or incompatible database changes.
|
||||
|
||||
A failed rollout restores the previous application images and hotfix manifest while preserving database writes. An interrupted rollout resumes recovery on the next check. A failed version waits for an explicit retry or a newer release. The most recent pre-change database backups and version records are under `/var/lib/planet-release-deploy/last-success/` and `last-failed/`. Retry after resolving the underlying error.
|
||||
|
||||
```bash
|
||||
systemctl list-timers planet-release-deploy.timer
|
||||
journalctl -u planet-release-deploy.service -n 40
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --check
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --retry
|
||||
```
|
||||
|
||||
To provision a replacement host, restore `/etc/planet/deploy.env`, `/opt/planet/current`, and the production volumes. Install the controller from a trusted checkout and verify the current deployment before enabling its timer.
|
||||
|
||||
```bash
|
||||
sudo install -d /usr/local/lib/planet-release
|
||||
sudo install -m 0644 scripts/{production_deploy,production_registry,release_publish}.py /usr/local/lib/planet-release/
|
||||
sudo install -m 0644 deploy/systemd/planet-release-deploy.{service,timer} /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --check
|
||||
sudo systemctl enable --now planet-release-deploy.timer
|
||||
```
|
||||
|
||||
## Related Docs
|
||||
|
||||
- [planet.sh Startup Mechanism](/home/ray/dev/linkong/planet/docs/technical/en/ops-planet-sh-startup.md)
|
||||
|
||||
@@ -473,6 +473,44 @@ uv run pytest backend/tests/test_otp_service.py
|
||||
5. 部署后打开智能星球,开启“国界线”,放大中国东南海岸、台湾、海南、南海、藏南、科索沃、加沙等区域验证 hover 和边界口径。
|
||||
6. 如果本地没有高精 manifest/PMTiles,Earth 会使用 `frontend/public/earth/data/countries-admin0.min.geojson` 低精度 fallback;如果高精产物存在但瓦片请求失败,按 PMTiles range 请求、manifest provider、Nginx `.pmtiles` 静态返回和 sha256 一致性排查。
|
||||
|
||||
## 在本机发版,生产机自动部署
|
||||
|
||||
把正式版本标签推送到 Gitea 后,在发版机的 Planet 仓库执行以下命令。首次配置发版机时,使用具有 `write:package` 权限的 Gitea 令牌登录专用 Docker 配置目录。Git 发布凭据与镜像推送凭据分别保存。
|
||||
|
||||
```bash
|
||||
docker --config "${XDG_CONFIG_HOME:-$HOME/.config}/planet/registry" login gitea.rclaw.top --username linkong
|
||||
```
|
||||
|
||||
日常发版时在已打标签的提交上执行以下命令。
|
||||
|
||||
```bash
|
||||
python3 scripts/release_publish.py --tag "$(git describe --tags --exact-match)" --use-git-credential
|
||||
```
|
||||
|
||||
发布器从标签提交构建 Linux amd64 的 `admin`、`backend`、`aiprovider` 镜像,并核验仓库中的提交标签与摘要。Admin 使用轻量构建目标。默认从同一提交打包桌面客户端。已经备好该标签的各平台安装包和热更新包时可加 `--assets-dir client/release`。上传中断后重复同一命令即可复用已构建的镜像和已校验的附件。发布命令成功后可以关闭本机。
|
||||
|
||||
生产机的 `planet-release-deploy.timer` 约每两分钟读取 Gitea 最新正式 Release。新版本的三个镜像和热更新校验文件齐全后,服务按不可变摘要拉取镜像,备份 PostgreSQL,依次更新 AI Provider、后端和 Admin,再验证接口、发布并回读 Earth 热更新包。主机沿用当前生产 Compose、内存限制和数据卷。需要新增挂载、服务或数据库不兼容变更时,先按该版本的迁移方案调整主机配置。
|
||||
|
||||
上线失败时,服务恢复上一版的镜像摘要和热更新清单,保留数据库里的业务写入。事务记录在重启后仍可恢复。失败的版本会暂停自动重试,较新的正式版仍可上线。`/var/lib/planet-release-deploy/last-success/` 和 `last-failed/` 分别保留最近一次成功或失败切换前的数据库备份和版本信息。确认故障已排除后可以单独重试该版本。
|
||||
|
||||
```bash
|
||||
systemctl list-timers planet-release-deploy.timer
|
||||
journalctl -u planet-release-deploy.service -n 40
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --check
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --retry
|
||||
```
|
||||
|
||||
替换部署主机时,从受信任的运维检出中安装控制程序和定时器。先恢复 `/etc/planet/deploy.env`、`/opt/planet/current` 及当前生产数据卷,再校验当前版本并启用定时器。
|
||||
|
||||
```bash
|
||||
sudo install -d /usr/local/lib/planet-release
|
||||
sudo install -m 0644 scripts/{production_deploy,production_registry,release_publish}.py /usr/local/lib/planet-release/
|
||||
sudo install -m 0644 deploy/systemd/planet-release-deploy.{service,timer} /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo python3 /usr/local/lib/planet-release/production_deploy.py --check
|
||||
sudo systemctl enable --now planet-release-deploy.timer
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [planet.sh 启动机制](/home/ray/dev/linkong/planet/docs/technical/zh/ops-planet-sh-startup.md)
|
||||
|
||||
Reference in new issue
Block a user