From cbbf62217c8b24bf8d7e227a333c38fb0cab7d9b Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 22 Nov 2026 14:18:36 +0800 Subject: [PATCH] ops(production): the production host is the Hong Kong VPS 83.229.126.99 Owner bought and approved the new host on 2026-11-22 (mainland latency ~44 ms vs ~300 ms on 118.194.235.34). The four production workflows pin the host, so the release SHA must carry the new value. The runbook records the fresh-start sequence (no Supabase import). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8 --- .gitea/workflows/backup-production-daily.yml | 2 +- .gitea/workflows/create-production-recovery.yml | 2 +- .gitea/workflows/deploy-production.yml | 2 +- .gitea/workflows/migrate-production-database.yml | 2 +- AGENTS.md | 2 +- README.md | 2 +- deploy/README.md | 16 ++++++++-------- .../production-server-migration-2026-08.md | 12 +++++++----- frontend/tests/staging-backend-workflows.test.ts | 8 ++++---- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/backup-production-daily.yml b/.gitea/workflows/backup-production-daily.yml index 04913ce3c..65d20be8b 100644 --- a/.gitea/workflows/backup-production-daily.yml +++ b/.gitea/workflows/backup-production-daily.yml @@ -60,7 +60,7 @@ jobs: [ -n "$local_retention" ] || local_retention=7 [[ "$artifact_retention" =~ ^[1-9][0-9]{0,3}$ ]] [[ "$local_retention" =~ ^[1-9][0-9]{0,3}$ ]] - [[ "$DEPLOY_HOST" == "118.194.235.34" ]] + [[ "$DEPLOY_HOST" == "83.229.126.99" ]] [[ "$DEPLOY_PORT" =~ ^[1-9][0-9]{0,4}$ ]] && (( DEPLOY_PORT <= 65535 )) [[ "$DEPLOY_USER" == "deploy" ]] [[ "$DEPLOY_PATH" == "/opt/jyotisha-production" ]] diff --git a/.gitea/workflows/create-production-recovery.yml b/.gitea/workflows/create-production-recovery.yml index 412100f11..8d891799d 100644 --- a/.gitea/workflows/create-production-recovery.yml +++ b/.gitea/workflows/create-production-recovery.yml @@ -79,7 +79,7 @@ jobs: run: | set -euo pipefail set +x - [[ "$DEPLOY_HOST" == "118.194.235.34" ]] + [[ "$DEPLOY_HOST" == "83.229.126.99" ]] [[ "$DEPLOY_PORT" =~ ^[1-9][0-9]{0,4}$ ]] && (( DEPLOY_PORT <= 65535 )) [[ "$DEPLOY_USER" == "deploy" ]] [[ "$DEPLOY_PATH" == "/opt/jyotisha-production" ]] diff --git a/.gitea/workflows/deploy-production.yml b/.gitea/workflows/deploy-production.yml index aa65a3635..b5336d058 100644 --- a/.gitea/workflows/deploy-production.yml +++ b/.gitea/workflows/deploy-production.yml @@ -303,7 +303,7 @@ jobs: VERIFICATION_MODE: ${{ steps.revision.outputs.verification_mode }} run: | set -euo pipefail - [[ "$DEPLOY_HOST" == "118.194.235.34" ]] + [[ "$DEPLOY_HOST" == "83.229.126.99" ]] [[ "$DEPLOY_PORT" =~ ^[1-9][0-9]{0,4}$ ]] && (( DEPLOY_PORT <= 65535 )) [[ "$DEPLOY_USER" == "deploy" ]] [[ "$DEPLOY_PATH" == "/opt/jyotisha-production" ]] diff --git a/.gitea/workflows/migrate-production-database.yml b/.gitea/workflows/migrate-production-database.yml index 87a4c1ff8..2b41e83ca 100644 --- a/.gitea/workflows/migrate-production-database.yml +++ b/.gitea/workflows/migrate-production-database.yml @@ -251,7 +251,7 @@ jobs: RESTORE_VERIFIED: ${{ steps.revision.outputs.restore_verified }} run: | set -euo pipefail - [[ "$DEPLOY_HOST" == "118.194.235.34" ]] + [[ "$DEPLOY_HOST" == "83.229.126.99" ]] [[ "$DEPLOY_PORT" =~ ^[1-9][0-9]{0,4}$ ]] && (( DEPLOY_PORT <= 65535 )) [[ "$DEPLOY_USER" == "deploy" ]] [[ "$DEPLOY_PATH" == "/opt/jyotisha-production" ]] diff --git a/AGENTS.md b/AGENTS.md index 395c96966..4a39465f6 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -24,7 +24,7 @@ - Production domain: `https://jyotisha.chat`;staging: `https://staging.jyotisha.chat` - Primary source and the only CI/CD control plane: `https://git.copse.top/root/Jyotisha.git`(Gitea)。GitHub `https://github.com/jesse-ux/Jyotisha.git` 是只读镜像:无 workflow、Actions 已关闭,不得用它验证交付状态,也没有 GitHub Issues 流程。 -- Production host: Ubuntu VPS `118.194.235.34`,专用 `deploy` 用户,SSH 端口是部署变量;2 vCPU / 4 GB RAM,只跑 digest 固定镜像,不在主机构建。 +- Production host: Ubuntu VPS `83.229.126.99`,专用 `deploy` 用户,SSH 端口是部署变量;2 vCPU / 4 GB RAM,只跑 digest 固定镜像,不在主机构建。 - Runtime: `/opt/jyotisha-production`,Compose project `jyotisha-production`,Compose 文件 `deploy/docker-compose.server.yml`。 - Secrets: `/opt/jyotisha-production/.env.production` 与 `.env.production.database`(`0600`);never print, copy into chat, or commit。 - Public edge: Caddy only;Next.js `3000` 与 Python API `5200` 仅 Docker 内网。 diff --git a/README.md b/README.md index 70f214a94..95268ef23 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ ```text jyotisha.chat -> Spaceship DNS - -> Caddy(生产 VPS 118.194.235.34,唯一公网入口 80/443) + -> Caddy(生产 VPS 83.229.126.99,唯一公网入口 80/443) -> Next.js + Mastra web 容器(3000,仅 Docker 内网) -> Python Jyotish API 容器(5200,仅 Docker 内网) -> Swiss Ephemeris 本地计算引擎 diff --git a/deploy/README.md b/deploy/README.md index 1e77cf7f8..594be4263 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -8,8 +8,8 @@ This file is the operational source of truth for Jyotisha deployment. The produc | --- | --- | | Public domain | `https://jyotisha.chat` | | DNS | Spaceship nameservers (`launch1.spaceship.net`, `launch2.spaceship.net`) | -| Current public host | `118.194.235.34`; production health reports the local business/identity PostgreSQL databases. The old VPS `103.117.123.53` is no longer a deployment target | -| Target host | `118.194.235.34`, Ubuntu x86_64 | +| Current public host | `83.229.126.99`; production health reports the local business/identity PostgreSQL databases. The old VPS `103.117.123.53` is no longer a deployment target | +| Target host | `83.229.126.99`, Ubuntu x86_64 | | Target SSH | dedicated `deploy` user, confirmed variable port, public-key authentication only | | Target capacity | 2 vCPU / 4 GB RAM; no application builds on host | | Target app directory | `/opt/jyotisha-production` | @@ -48,8 +48,8 @@ The API image installs PyJHora for one chapter only: the full-data report's last Final Spaceship resource records (apply only during the approved cutover window): ```text -A @ 118.194.235.34 -A admin 118.194.235.34 +A @ 83.229.126.99 +A admin 83.229.126.99 CNAME www jyotisha.chat ``` @@ -60,7 +60,7 @@ dig +short @launch1.spaceship.net A jyotisha.chat dig +short @launch2.spaceship.net A admin.jyotisha.chat ``` -Both user and admin hosts must return `118.194.235.34`. Caddy provisions and renews HTTPS automatically after DNS resolves. +Both user and admin hosts must return `83.229.126.99`. Caddy provisions and renews HTTPS automatically after DNS resolves. ## Production environment @@ -121,7 +121,7 @@ After changing runtime variables, use the exact-SHA Gitea workflow to recreate s ## Connect and inspect ```bash -ssh -p deploy@118.194.235.34 +ssh -p deploy@83.229.126.99 cd /opt/jyotisha-production COMPOSE='docker compose -p jyotisha-production --env-file .env.production -f deploy/docker-compose.server.yml -f deploy/docker-compose.postgres.yml -f deploy/docker-compose.production.yml' $COMPOSE ps @@ -453,11 +453,11 @@ curl -fsS -o /dev/null -w '%{http_code}\n' https://jyotisha.chat/api/account The second command should return `401` while logged out. Verify the private Python API from inside the web container: ```bash -ssh -p deploy@118.194.235.34 \ +ssh -p deploy@83.229.126.99 \ 'cd /opt/jyotisha-production && docker compose -p jyotisha-production --env-file .env.production -f deploy/docker-compose.server.yml -f deploy/docker-compose.postgres.yml -f deploy/docker-compose.production.yml exec -T web node -e "fetch(\"http://api:5200/api/health\").then(async r=>{console.log(r.status); console.log(await r.text())})"' ``` -Expected: HTTP `200`, `"status": "ok"`, and `"swisseph_available": true`. Public access to `118.194.235.34:5200` and `:5432` must fail. The deployment workflow also executes `SELECT 1` through all four runtime database roles. +Expected: HTTP `200`, `"status": "ok"`, and `"swisseph_available": true`. Public access to `83.229.126.99:5200` and `:5432` must fail. The deployment workflow also executes `SELECT 1` through all four runtime database roles. Do not treat a green app deployment as proof of database migration or data reconciliation. The production deployment refuses pending target migrations but does not apply them. Follow the schema-first ETL and verification gates in the production migration runbook. Supabase remains the read-only rollback source until the retention and reconciliation window closes. diff --git a/docs/operations/production-server-migration-2026-08.md b/docs/operations/production-server-migration-2026-08.md index ea01bd098..d1d59bb42 100644 --- a/docs/operations/production-server-migration-2026-08.md +++ b/docs/operations/production-server-migration-2026-08.md @@ -1,11 +1,13 @@ -# Production migration to 118.194.235.34 +# Production migration to 83.229.126.99 + +> 2026-11-22:生产目标换成香港 VPS `83.229.126.99`(Ubuntu 24.04,AMD 2 核 / 4 GB / 48 GB,国内平均延迟约 44 ms);原目标 `118.194.235.34` 国内平均约 300 ms,不再使用。负责人决定空库上线,不导入旧数据:下文的 Supabase 导入、密文转移和导入演练都跳过,改为「首次部署(内部)→ 建恢复点 → 迁移 → 再部署(内部)→ 切 DNS → 公开部署 → 设 Owner」。 Status: **planned; do not change DNS or retire the old production yet**. This runbook moves production to the current reviewed `staging` release while also changing the persistence and identity layers: - old runtime: VPS + Supabase PostgreSQL + Supabase Auth; -- target runtime: `118.194.235.34` + private PostgreSQL 17 + Better Auth; +- target runtime: `83.229.126.99` + private PostgreSQL 17 + Better Auth; - user site: `https://jyotisha.chat`; - admin site: `https://admin.jyotisha.chat`. @@ -39,7 +41,7 @@ Repository variables: | Name | Required value | | --- | --- | -| `PRODUCTION_HOST` | `118.194.235.34` | +| `PRODUCTION_HOST` | `83.229.126.99` | | `PRODUCTION_PORT` | `22` (confirmed on 2026-08-09) | | `PRODUCTION_USER` | `deploy` | | `PRODUCTION_PATH` | `/opt/jyotisha-production` | @@ -161,8 +163,8 @@ Final records are: | Type | Host | Value | | --- | --- | --- | -| `A` | `@` | `118.194.235.34` | -| `A` | `admin` | `118.194.235.34` | +| `A` | `@` | `83.229.126.99` | +| `A` | `admin` | `83.229.126.99` | | `CNAME` | `www` | `jyotisha.chat` | Both `jyotisha.chat` and `admin.jyotisha.chat` are required. The application rejects unknown identity hosts, and the user domain intentionally hides `/admin` and `/api/admin/*`. diff --git a/frontend/tests/staging-backend-workflows.test.ts b/frontend/tests/staging-backend-workflows.test.ts index 6bf50966b..79ae69ba5 100644 --- a/frontend/tests/staging-backend-workflows.test.ts +++ b/frontend/tests/staging-backend-workflows.test.ts @@ -898,7 +898,7 @@ test("Gitea staging account reset is manual, staging-ref bound, and mutates one workflow, /"sudo -n env DEPLOY_PATH='\$DEPLOY_PATH' EXPECTED_DEPLOY_SHA='\$EXPECTED_DEPLOY_SHA' RESET_EMAIL='\$RESET_EMAIL' RESET_CONFIRMATION='\$RESET_CONFIRMATION' bash -s"[\s\S]*< deploy\/reset-staging-account\.sh/, ); - assert.doesNotMatch(workflow, /PRODUCTION_|jyotisha-production|118\.194\.235\.34|docker compose|psql/); + assert.doesNotMatch(workflow, /PRODUCTION_|jyotisha-production|83\.229\.126\.99|docker compose|psql/); assert.match(script, /\[ "\$RESET_CONFIRMATION" = "RESET \$RESET_EMAIL" \]/); assert.match(script, /\[ "\$DEPLOY_PATH" = "\/opt\/jyotisha-staging" \]/); assert.match(script, /deployed staging revision does not match the approved reset SHA/); @@ -1208,7 +1208,7 @@ test("production deploy is manual-only and consumes the accepted staging artifac assert.doesNotMatch(production, /stale production revision refused/); assert.match(production, /verification_mode:/); assert.match(production, /PRODUCTION_HOST/); - assert.match(production, /118\.194\.235\.34/); + assert.match(production, /83\.229\.126\.99/); assert.match(production, /PRODUCTION_SSH_PRIVATE_KEY/); assert.match(production, /staging-image-manifest-/); assert.match(production, /run-production-deploy\.sh/); @@ -1256,7 +1256,7 @@ test("Gitea production deploy consumes only gate-attested digests under manual c assert.match(workflow, /steps\.images\.outputs\.api_image/); assert.match(workflow, /steps\.images\.outputs\.web_image/); assert.match(workflow, /SSH_PRIVATE_KEY_BASE64: \$\{\{ secrets\.PRODUCTION_SSH_PRIVATE_KEY \}\}/); - assert.match(workflow, /\[\[ "\$DEPLOY_HOST" == "118\.194\.235\.34" \]\]/); + assert.match(workflow, /\[\[ "\$DEPLOY_HOST" == "83\.229\.126\.99" \]\]/); assert.match(workflow, /\[\[ "\$DEPLOY_USER" == "deploy" \]\]/); assert.match(workflow, /\[\[ "\$DEPLOY_PATH" == "\/opt\/jyotisha-production" \]\]/); assert.match(workflow, /bash '\$incoming\/deploy\/run-production-deploy\.sh'/); @@ -1402,7 +1402,7 @@ test("Gitea production schema migration is exact-SHA gated and isolated from ETL assert.match(workflow, /group: production-mutation/); assert.match(workflow, /SSH_PRIVATE_KEY_BASE64: \$\{\{ secrets\.PRODUCTION_SSH_PRIVATE_KEY \}\}/); assert.match(workflow, /PRODUCTION_KNOWN_HOSTS/); - assert.match(workflow, /\[\[ "\$DEPLOY_HOST" == "118\.194\.235\.34" \]\]/); + assert.match(workflow, /\[\[ "\$DEPLOY_HOST" == "83\.229\.126\.99" \]\]/); assert.match(workflow, /\[\[ "\$DEPLOY_USER" == "deploy" \]\]/); assert.match(workflow, /\[\[ "\$DEPLOY_PATH" == "\/opt\/jyotisha-production" \]\]/); assert.match(workflow, /sha256sum --check --status/);