Enable beta builds: auto-deploy beta on master, manual prod button #26

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

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.


Current state

  • Single deploy workflow: after Unit Tests success on masterdeploy.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.ymlworkflow_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 (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
## 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
Author
Owner

Links

Follow-ons live on chat_web_app (#36 events, #37 cookie consent, #38 notifications, #39 ToS).

## Links - Infra: [server-infra#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7) - Frontend companion: [chat_web_app#35](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/35) Follow-ons live on `chat_web_app` (#36 events, #37 cookie consent, #38 notifications, #39 ToS).
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_backend#26