Today .gitea/workflows/deploy.yml auto-deploys prod on successful Unit Tests on master. Flip that so day-to-day merges land on beta; prod is intentional.
Also wire beta Django env (hosts, CSRF, CORS, secrets) and coordinate Tianji beta website tracking with the frontend (companion chat_web_app beta ticket).
DJANGO_ALLOWED_HOSTS / DJANGO_CSRF_TRUSTED_ORIGINS include beta.chatbackend.aimloperations.com
CORS / Capacitor / SPA origins allow the beta frontend origin(s) (whatever NPM domain is used for beta chat UI)
Distinct secret + DB via control-node chat_backend_beta.env (created in server-infra#7)
Document any new env vars in .env.prod.example / README
Tianji (beta builds)
Backend does not load tracker.js, but beta builds must work with frontend analytics:
Ensure beta API allows requests from the beta SPA origin used by Tianji-instrumented pages
If/when UTM or analytics ingest endpoints exist, they must work on beta the same as prod
Create / register a separate Tianji website for Hesychia beta in Tianji UI (coordinate ID with chat_web_app Tracker — frontend ticket owns wiring data-website-id)
Call out the beta website ID in PR notes so FE + infra stay aligned
Custom event tracking, cookie consent, and a notifications page are follow-on tickets (not this one).
## Summary
Enable **beta** deploys for `chat_backend`, matching `dta_service`:
- **Merge/push to `master`** → auto-deploy **beta**
- **Manual Gitea "Run workflow" button** (`workflow_dispatch`) → deploy **prod**
Today `.gitea/workflows/deploy.yml` auto-deploys **prod** on successful Unit Tests on `master`. Flip that so day-to-day merges land on beta; prod is intentional.
Also wire beta Django env (hosts, CSRF, CORS, secrets) and coordinate Tianji beta website tracking with the frontend (companion `chat_web_app` beta ticket).
Infra half: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7).
---
## Current state
- Single deploy workflow: after Unit Tests success on `master` → `deploy.sh --app chat_backend --env prod`
- No `deploy-beta.yml` / `deploy-prod.yml` split
- `.env.prod.example` already documents beta overrides (`DJANGO_ENV=beta`, `beta.chatbackend.aimloperations.com`, `chat_backend_beta` DB, `WEB_PORT=8013`) — secrets/host_apps still optional in infra
## Target workflow (mirror `dta_service`)
| Workflow | Trigger | Deploy |
|----------|---------|--------|
| `deploy-beta.yml` | `push` to `master` (after tests / docker job as appropriate) | `--env beta` |
| `deploy-prod.yml` | `workflow_dispatch` only | `--env prod` |
Keep unit tests gating deploys (same quality bar as today). Do **not** auto-deploy prod on every master merge.
### Suggested layout
1. Replace/split `.gitea/workflows/deploy.yml` into:
- `deploy-beta.yml` — push to `master` → tests → `deploy.sh --app chat_backend --env beta --ref <sha>`
- `deploy-prod.yml` — `workflow_dispatch: {}` → tests → `deploy.sh --app chat_backend --env prod --ref <sha>`
2. Follow `dta_service` job structure (unit tests + docker compose tests + deploy) where practical.
---
## App / config work
### Beta env readiness
- Confirm settings honor `DJANGO_ENV=beta` (debug off, correct hosts)
- `DJANGO_ALLOWED_HOSTS` / `DJANGO_CSRF_TRUSTED_ORIGINS` include `beta.chatbackend.aimloperations.com`
- CORS / Capacitor / SPA origins allow the **beta frontend** origin(s) (whatever NPM domain is used for beta chat UI)
- Distinct secret + DB via control-node `chat_backend_beta.env` (created in server-infra#7)
- Document any new env vars in `.env.prod.example` / README
### Tianji (beta builds)
Backend does not load `tracker.js`, but beta builds must work with frontend analytics:
- Ensure beta API allows requests from the beta SPA origin used by Tianji-instrumented pages
- If/when UTM or analytics ingest endpoints exist, they must work on beta the same as prod
- **Create / register a separate Tianji website for Hesychia beta** in Tianji UI (coordinate ID with `chat_web_app` Tracker — frontend ticket owns wiring `data-website-id`)
- Call out the beta website ID in PR notes so FE + infra stay aligned
Custom event tracking, cookie consent, and a notifications page are **follow-on** tickets (not this one).
---
## Coordination
- Blocked on / pairs with: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7) (host_apps beta, Postgres, secret, NPM)
- Companion: `chat_web_app` beta workflows + Tianji beta website ID in Tracker
## Acceptance criteria
- [ ] Push/merge to `master` deploys **beta** only (not prod)
- [ ] Prod deploy is manual via Gitea Actions `workflow_dispatch` button
- [ ] Beta container healthy on port **8013** with `chat_backend_beta` DB
- [ ] Beta hosts / CSRF / CORS allow beta frontend
- [ ] Tianji beta website created (or ID agreed); FE ticket can wire it
- [ ] Prod workflow still deploys `--env prod` successfully when run manually
- [ ] README notes the beta-vs-prod deploy buttons
## References
- `dta_service` `.gitea/workflows/deploy-beta.yml` + `deploy-prod.yml`
- Prior docker/deploy: #6
- server-infra#7
westfarn
self-assigned this 2026-07-27 04:18:35 -07:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Enable beta deploys for
chat_backend, matchingdta_service:master→ auto-deploy betaworkflow_dispatch) → deploy prodToday
.gitea/workflows/deploy.ymlauto-deploys prod on successful Unit Tests onmaster. Flip that so day-to-day merges land on beta; prod is intentional.Also wire beta Django env (hosts, CSRF, CORS, secrets) and coordinate Tianji beta website tracking with the frontend (companion
chat_web_appbeta ticket).Infra half: server-infra#7.
Current state
master→deploy.sh --app chat_backend --env proddeploy-beta.yml/deploy-prod.ymlsplit.env.prod.examplealready documents beta overrides (DJANGO_ENV=beta,beta.chatbackend.aimloperations.com,chat_backend_betaDB,WEB_PORT=8013) — secrets/host_apps still optional in infraTarget workflow (mirror
dta_service)deploy-beta.ymlpushtomaster(after tests / docker job as appropriate)--env betadeploy-prod.ymlworkflow_dispatchonly--env prodKeep unit tests gating deploys (same quality bar as today). Do not auto-deploy prod on every master merge.
Suggested layout
.gitea/workflows/deploy.ymlinto:deploy-beta.yml— push tomaster→ tests →deploy.sh --app chat_backend --env beta --ref <sha>deploy-prod.yml—workflow_dispatch: {}→ tests →deploy.sh --app chat_backend --env prod --ref <sha>dta_servicejob structure (unit tests + docker compose tests + deploy) where practical.App / config work
Beta env readiness
DJANGO_ENV=beta(debug off, correct hosts)DJANGO_ALLOWED_HOSTS/DJANGO_CSRF_TRUSTED_ORIGINSincludebeta.chatbackend.aimloperations.comchat_backend_beta.env(created in server-infra#7).env.prod.example/ READMETianji (beta builds)
Backend does not load
tracker.js, but beta builds must work with frontend analytics:chat_web_appTracker — frontend ticket owns wiringdata-website-id)Custom event tracking, cookie consent, and a notifications page are follow-on tickets (not this one).
Coordination
chat_web_appbeta workflows + Tianji beta website ID in TrackerAcceptance criteria
masterdeploys beta only (not prod)workflow_dispatchbuttonchat_backend_betaDB--env prodsuccessfully when run manuallyReferences
dta_service.gitea/workflows/deploy-beta.yml+deploy-prod.ymlLinks
Follow-ons live on
chat_web_app(#36 events, #37 cookie consent, #38 notifications, #39 ToS).