docs(release): add runtime build host runbook
CI/CD Pipeline / Validate Code Quality And Tests (push) Has been cancelled
Deploy / Deploy Staging (push) Has been cancelled
Deploy / Deploy Production (push) Has been cancelled

This commit is contained in:
Xiaoxia AI
2026-06-22 15:14:44 +08:00
parent 7716371c8d
commit 8a4cab3cc7
2 changed files with 101 additions and 0 deletions
+91
View File
@@ -0,0 +1,91 @@
# Runtime Image Build Host Runbook
> Purpose: build API/Worker runtime image artifacts outside the production host.
## Why
Production host currently runs Gitea, Gitea Actions runner, Web/API/Worker/Postgres/Redis. It has about 2 CPU and 1.7GiB memory. Building API/Worker images there can make SSH/Web/API unstable, so production must only load prebuilt images and restart containers.
## Allowed build hosts
Use one of:
1. Dedicated Gitea runner on a separate machine.
2. Local developer machine with Docker installed.
3. Temporary cloud build VM that is destroyed after artifact upload.
Do not use the production host unless an emergency exception is explicitly approved with `ALLOW_SHARED_PRODUCTION_BUILD_HOST=true`.
## Build steps
From a clean checkout of the target release commit:
```bash
git checkout develop
git pull --ff-only origin develop
scripts/build_release_images.sh v0.1.5
```
The script writes:
```text
dist/release-images/xiaoxia-runtime-images-v0.1.5.tar
```
## Upload artifact
Upload to production:
```bash
scp dist/release-images/xiaoxia-runtime-images-v0.1.5.tar \
xiaoxia-server:/var/lib/xiaoxia-saas-production/runtime-images-v0.1.5.tar
```
## Release tag
After the runtime image tar exists on production:
```bash
git tag -a v0.1.5 -m "Release v0.1.5"
git push origin v0.1.5
```
The Gitea production deploy passes `RELEASE_VERSION=v0.1.5` to `infra/docker/deploy-production.sh`. The deploy must fail if the runtime image tar is missing.
## Manual production deploy fallback
If tag deploy is unavailable but the runtime image tar has been uploaded:
```bash
ssh xiaoxia-server \
"HOST_PREFIX= RELEASE_VERSION=v0.1.5 \
RUNTIME_IMAGE_TAR=/var/lib/xiaoxia-saas-production/runtime-images-v0.1.5.tar \
/var/lib/xiaoxia-saas-production/repo/infra/docker/deploy-production.sh"
```
## Verification
Run from local repo after deploy:
```bash
python scripts/smoke_public_auth_flow.py
python scripts/smoke_public_upload_flow.py
```
Then verify project detail endpoint:
```bash
curl -fsS https://saas.xiaoxiajianji.com/api/v1/projects/<project_id>
```
## Required release notes
Record:
- tag
- commit
- runtime image tar path
- public auth smoke result
- public upload smoke result
- production API image tag
- production Worker image tag
+10
View File
@@ -154,6 +154,16 @@ def test_subscription_api_is_not_wired_to_ui_until_backend_exists():
assert importers == []
def test_build_host_runbook_requires_off_production_runtime_builds():
runbook = Path("docs/BUILD-HOST-RUNBOOK.md").read_text(encoding="utf-8")
assert "Production host currently runs Gitea" in runbook
assert "scripts/build_release_images.sh v0.1.5" in runbook
assert "runtime-images-v0.1.5.tar" in runbook
assert "The deploy must fail if the runtime image tar is missing" in runbook
assert "python scripts/smoke_public_upload_flow.py" in runbook
def test_deployment_docs_forbid_production_runtime_builds():
docs = Path("docs/DEPLOYMENT.md").read_text(encoding="utf-8")