Enable beta builds: auto-deploy beta on master, manual prod button + Tianji beta ID #35

Closed
opened 2026-07-27 04:18:35 -07:00 by westfarn · 1 comment
Owner

Summary

Enable beta deploys for chat_web_app, matching dta_webapp:

  • Merge/push to master → auto-deploy beta
  • Manual Gitea "Run workflow" button (workflow_dispatch) → deploy prod

Today this is inverted:

  • deploy-prod.yml auto-deploys prod after Unit Tests on master
  • deploy-beta.yml is workflow_dispatch only

Also add Tianji tracking for beta builds: separate Tianji website ID (like dta_webapp prod vs beta), so beta traffic does not pollute prod analytics.

Infra half: server-infra#7.
Companion backend: chat_backend beta workflow ticket.


Current state

  • npm run build:prod / build:beta already write /var/www/{prod,beta}.chat.aimloperations/html
  • .env.beta points API/WS at https://beta.chatbackend.aimloperations.com
  • Tracker.tsx loads Tianji only when NODE_ENV === 'production' with a single website id (cm7x7m52m03kbddswbswrt17y) — no beta distinction
  • Workflows wrong way around vs DTA

Target workflow (mirror dta_webapp)

Workflow Trigger Deploy
deploy-beta.yml push to master (after unit tests) --env beta
deploy-prod.yml workflow_dispatch only --env prod

Remove auto-prod-on-master (workflow_run → prod). Prod = intentional button press.


Work

1. Flip Gitea workflows

  • deploy-beta.yml: on push to master → unit tests → deploy.sh --app chat_web_app --env beta --ref <sha>
  • deploy-prod.yml: workflow_dispatch: {} → unit tests → deploy.sh --app chat_web_app --env prod --ref <sha>
  • Keep test gate; update README deploy docs

2. Tianji tracking for beta builds

Mirror dta_webapp Tracker.tsx:

  • Create a new Tianji website for Hesychia beta (prod keeps existing id unless we also re-key)
  • Update Tracker.tsx to pick website ID by build mode / env:
    • prod build → current (or confirmed) prod website ID
    • beta build → new beta website ID
  • Ensure beta builds actually load the tracker (today anything with NODE_ENV=production shares one ID — build:beta uses NODE_ENV=production, so it already loads prod ID; must switch on CRA env file / custom REACT_APP_* / explicit beta flag, not only NODE_ENV)
  • Prefer env vars e.g. REACT_APP_TIANJI_WEBSITE_ID in .env.production / .env.beta so IDs are not hardcoded only in one place
  • Script URL remains https://tianji.aimloperations.com/tracker.js

Custom events, cookie consent banner, notifications page, and public ToS polish are follow-on tickets.

3. Env sanity

  • Confirm .env.beta REST/WS URLs match NPM beta backend
  • Confirm beta static build lands in /var/www/beta.chat.aimloperations/html via server-infra deploy

Coordination

  • Depends on / pairs with: server-infra#7
  • Companion: chat_backend beta workflow + beta CORS/hosts

Acceptance criteria

  • Push/merge to master deploys beta only
  • Prod deploy is manual workflow_dispatch button (like dta_webapp)
  • Beta site served on port 8083 / beta NPM domain
  • Beta build uses a distinct Tianji data-website-id from prod
  • Prod Tianji ID unchanged (or intentionally migrated and documented)
  • Page views appear under the beta Tianji website when hitting beta
  • README documents beta auto / prod button

References

## Summary Enable **beta** deploys for `chat_web_app`, matching `dta_webapp`: - **Merge/push to `master`** → auto-deploy **beta** - **Manual Gitea "Run workflow" button** (`workflow_dispatch`) → deploy **prod** Today this is **inverted**: - `deploy-prod.yml` auto-deploys prod after Unit Tests on `master` - `deploy-beta.yml` is `workflow_dispatch` only Also add **Tianji tracking for beta builds**: separate Tianji website ID (like `dta_webapp` prod vs beta), so beta traffic does not pollute prod analytics. Infra half: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7). Companion backend: `chat_backend` beta workflow ticket. --- ## Current state - `npm run build:prod` / `build:beta` already write `/var/www/{prod,beta}.chat.aimloperations/html` - `.env.beta` points API/WS at `https://beta.chatbackend.aimloperations.com` - `Tracker.tsx` loads Tianji only when `NODE_ENV === 'production'` with a **single** website id (`cm7x7m52m03kbddswbswrt17y`) — no beta distinction - Workflows wrong way around vs DTA ## Target workflow (mirror `dta_webapp`) | Workflow | Trigger | Deploy | |----------|---------|--------| | `deploy-beta.yml` | `push` to `master` (after unit tests) | `--env beta` | | `deploy-prod.yml` | `workflow_dispatch` only | `--env prod` | Remove auto-prod-on-master (`workflow_run` → prod). Prod = intentional button press. --- ## Work ### 1. Flip Gitea workflows - `deploy-beta.yml`: on push to `master` → unit tests → `deploy.sh --app chat_web_app --env beta --ref <sha>` - `deploy-prod.yml`: `workflow_dispatch: {}` → unit tests → `deploy.sh --app chat_web_app --env prod --ref <sha>` - Keep test gate; update README deploy docs ### 2. Tianji tracking for beta builds Mirror `dta_webapp` `Tracker.tsx`: - Create a **new Tianji website** for Hesychia **beta** (prod keeps existing id unless we also re-key) - Update `Tracker.tsx` to pick website ID by build mode / env: - prod build → current (or confirmed) prod website ID - beta build → new beta website ID - Ensure beta builds actually load the tracker (today anything with `NODE_ENV=production` shares one ID — `build:beta` uses `NODE_ENV=production`, so it already loads prod ID; must switch on CRA env file / custom `REACT_APP_*` / explicit beta flag, not only `NODE_ENV`) - Prefer env vars e.g. `REACT_APP_TIANJI_WEBSITE_ID` in `.env.production` / `.env.beta` so IDs are not hardcoded only in one place - Script URL remains `https://tianji.aimloperations.com/tracker.js` Custom events, cookie consent banner, notifications page, and public ToS polish are **follow-on** tickets. ### 3. Env sanity - Confirm `.env.beta` REST/WS URLs match NPM beta backend - Confirm beta static build lands in `/var/www/beta.chat.aimloperations/html` via server-infra deploy --- ## Coordination - Depends on / pairs with: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7) - Companion: `chat_backend` beta workflow + beta CORS/hosts ## Acceptance criteria - [ ] Push/merge to `master` deploys **beta** only - [ ] Prod deploy is manual `workflow_dispatch` button (like `dta_webapp`) - [ ] Beta site served on port **8083** / beta NPM domain - [ ] Beta build uses a **distinct** Tianji `data-website-id` from prod - [ ] Prod Tianji ID unchanged (or intentionally migrated and documented) - [ ] Page views appear under the beta Tianji website when hitting beta - [ ] README documents beta auto / prod button ## References - `dta_webapp` `.gitea/workflows/deploy-beta.yml` + `deploy-prod.yml` - `dta_webapp` `src/components/Tracker.tsx` (prod vs beta website IDs) - Prior deploy: #13 - server-infra#7
westfarn self-assigned this 2026-07-27 04:18:35 -07:00
Author
Owner

Links

Follow-ons

  • #36 Tianji custom event tracking
  • #37 Cookie / analytics consent banner
  • #38 Notifications page
  • #39 Terms of Service page
## Links - Infra: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7) - Backend companion: [chat_backend#26](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/26) ## Follow-ons - #36 Tianji custom event tracking - #37 Cookie / analytics consent banner - #38 Notifications page - #39 Terms of Service page
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ai_ml_operations/chat_web_app#35