Deploy chat_web_app via server-infra (node-static like dta_webapp, multi-host) #13

Closed
opened 2026-07-14 03:11:33 -07:00 by westfarn · 1 comment
Owner

Summary

Wire chat_web_app into the same automated deploy pipeline used by dta_webapp. Follow dta_webapp's lead: this is a node-static frontend — do not Dockerize the webapp. Build with npm on the host, write static assets into a document root, serve via the existing web-static nginx container, active/active on adama + roslin + ai-server-4080 behind NPM.

Companion backend work: chat_backend (Docker/Django like dta_service).


Current state

  • CRA/React app under llm-fe/ (react-scripts).
  • Scripts today: start, build, testno build:prod / build:beta that copy into /var/www/....
  • .env.production points API at https://chatbackend.aimloperations.com.
  • No .gitea/workflows, no integration with server-infra app_catalog / host_apps.

How dta_webapp works (follow this)

  • app_catalog type: node-static (not django/docker).
  • Deploy role: git checkout → npm ci in subdirnpm run build:<env>.
  • Build scripts write into a host webroot, e.g. dta:
    • build:prod/var/www/prod.app.ditchtheagent/html
    • build:beta/var/www/beta.app.ditchtheagent/html
  • web-static nginx serves those roots on host ports from host_apps (8080/8081).
  • Gitea workflows: unit tests + deploy-prod / deploy-beta calling server-infra/scripts/deploy.sh --app dta_webapp --env <env> --ref <sha>.

Conclusion: chat_web_app should not get a production Dockerfile for serving. Match node-static + web-static.


Target architecture

  • One built static tree per env on each host; ports match across hosts for NPM.
  • Deploy on adama + roslin + ai-server-4080 (same as dta_webapp / dta_service).

Proposed ports

App prod beta
dta_webapp (nginx) 8080 8081
chat_web_app (nginx, new) 8082 8083
chat_backend (django docker) 8003 8013

Part A — Changes in THIS repo (chat_web_app)

A1. Build scripts (mirror dta_webapp)

In llm-fe/package.json (or chosen package root), add:

  • build:prod — production build + install into agreed webroot, e.g.
    • /var/www/prod.chat.aimloperations/html (exact path TBD; must match server-infra webroot_pattern)
  • build:beta — same for beta webroot

Ensure env-specific API URLs (CRA REACT_APP_* or equivalent) are set per mode so prod/beta hit the right chat_backend.

A2. Gitea workflows (.gitea/workflows/)

Mirror dta_webapp:

  • Unit / CI tests on push + PR
  • Deploy after green tests → server-infra/scripts/deploy.sh --app chat_web_app --env prod --ref <sha> (and beta workflow if enabled)

A3. Docs

  • README: local dev, build:prod/beta, how deploy expects /var/www/... layout.

Part B — Changes in server-infra

B1. app_catalog

chat_web_app:
  type: node-static
  repo: "{{ git_base_url }}/ai_ml_operations/chat_web_app.git"
  default_branch: master   # confirm actual default branch
  subdir: llm-fe
  webroot_pattern: "/var/www/{env}.chat.aimloperations/html"  # align with package.json

B2. host_apps on adama, roslin, and ai-server-4080

- { name: chat_web_app, env: prod, port: 8082 }
# optional: - { name: chat_web_app, env: beta, port: 8083 }

B3. web-static

  • Confirm nginx template / compose picks up the new static apps from host_apps (same mechanism as dta_webapp).

B4. NPM

  • Point the public chat frontend domain(s) at adama:8082 + roslin:8082 + ai-server-4080:8082.

B5. Docs

  • Update IMPLEMENTATION.md ports/apps/NPM tables for chat_web_app.

Acceptance criteria

  • npm run build:prod / build:beta produce assets in the configured /var/www/... paths
  • Not dockerized for production serve (node-static + web-static like dta_webapp)
  • Gitea tests + auto-deploy via server-infra/scripts/deploy.sh
  • Registered in app_catalog + host_apps on adama, roslin, and ai-server-4080
  • Reachable via NPM active/active on the chat frontend domain(s)

References

  • dta_webappbuild:prod / build:beta, .gitea/workflows, node-static pattern
  • server-infraapp_catalog.dta_webapp, roles/app-deploy/tasks/node_static.yml, roles/web-static
  • Companion: chat_backend ticket (dockerize + Ollama → 10.0.0.128:11434)
## Summary Wire `chat_web_app` into the same automated deploy pipeline used by **`dta_webapp`**. Follow `dta_webapp`'s lead: this is a **node-static** frontend — **do not Dockerize** the webapp. Build with npm on the host, write static assets into a document root, serve via the existing **web-static** nginx container, active/active on **adama + roslin + ai-server-4080** behind NPM. Companion backend work: `chat_backend` (Docker/Django like `dta_service`). --- ## Current state * CRA/React app under `llm-fe/` (`react-scripts`). * Scripts today: `start`, `build`, `test` — **no** `build:prod` / `build:beta` that copy into `/var/www/...`. * `.env.production` points API at `https://chatbackend.aimloperations.com`. * No `.gitea/workflows`, no integration with `server-infra` `app_catalog` / `host_apps`. ## How `dta_webapp` works (follow this) * `app_catalog` type: **`node-static`** (not django/docker). * Deploy role: git checkout → `npm ci` in `subdir` → `npm run build:<env>`. * Build scripts write into a host webroot, e.g. dta: * `build:prod` → `/var/www/prod.app.ditchtheagent/html` * `build:beta` → `/var/www/beta.app.ditchtheagent/html` * `web-static` nginx serves those roots on host ports from `host_apps` (8080/8081). * Gitea workflows: unit tests + deploy-prod / deploy-beta calling `server-infra/scripts/deploy.sh --app dta_webapp --env <env> --ref <sha>`. **Conclusion:** `chat_web_app` should **not** get a production Dockerfile for serving. Match node-static + web-static. --- ## Target architecture * One built static tree per env on each host; ports match across hosts for NPM. * Deploy on **adama + roslin + ai-server-4080** (same as dta_webapp / dta_service). ### Proposed ports | App | prod | beta | |-----|------|------| | dta_webapp (nginx) | 8080 | 8081 | | **chat_web_app (nginx, new)** | **8082** | **8083** | | chat_backend (django docker) | 8003 | 8013 | --- ## Part A — Changes in THIS repo (`chat_web_app`) ### A1. Build scripts (mirror dta_webapp) In `llm-fe/package.json` (or chosen package root), add: * `build:prod` — production build + install into agreed webroot, e.g. * `/var/www/prod.chat.aimloperations/html` (exact path TBD; must match `server-infra` `webroot_pattern`) * `build:beta` — same for beta webroot Ensure env-specific API URLs (CRA `REACT_APP_*` or equivalent) are set per mode so prod/beta hit the right `chat_backend`. ### A2. Gitea workflows (`.gitea/workflows/`) Mirror `dta_webapp`: * Unit / CI tests on push + PR * Deploy after green tests → `server-infra/scripts/deploy.sh --app chat_web_app --env prod --ref <sha>` (and beta workflow if enabled) ### A3. Docs * README: local dev, build:prod/beta, how deploy expects `/var/www/...` layout. --- ## Part B — Changes in `server-infra` ### B1. `app_catalog` ```yaml chat_web_app: type: node-static repo: "{{ git_base_url }}/ai_ml_operations/chat_web_app.git" default_branch: master # confirm actual default branch subdir: llm-fe webroot_pattern: "/var/www/{env}.chat.aimloperations/html" # align with package.json ``` ### B2. `host_apps` on **adama, roslin, and ai-server-4080** ```yaml - { name: chat_web_app, env: prod, port: 8082 } # optional: - { name: chat_web_app, env: beta, port: 8083 } ``` ### B3. `web-static` * Confirm nginx template / compose picks up the new static apps from `host_apps` (same mechanism as dta_webapp). ### B4. NPM * Point the public chat frontend domain(s) at `adama:8082` + `roslin:8082` + `ai-server-4080:8082`. ### B5. Docs * Update `IMPLEMENTATION.md` ports/apps/NPM tables for `chat_web_app`. --- ## Acceptance criteria - [ ] `npm run build:prod` / `build:beta` produce assets in the configured `/var/www/...` paths - [ ] **Not** dockerized for production serve (node-static + web-static like `dta_webapp`) - [ ] Gitea tests + auto-deploy via `server-infra/scripts/deploy.sh` - [ ] Registered in `app_catalog` + `host_apps` on **adama, roslin, and ai-server-4080** - [ ] Reachable via NPM active/active on the chat frontend domain(s) ## References * `dta_webapp` — `build:prod` / `build:beta`, `.gitea/workflows`, node-static pattern * `server-infra` — `app_catalog.dta_webapp`, `roles/app-deploy/tasks/node_static.yml`, `roles/web-static` * Companion: `chat_backend` ticket (dockerize + Ollama → `10.0.0.128:11434`)
westfarn self-assigned this 2026-07-14 03:11:33 -07:00
Author
Owner

Companion backend ticket: ai_ml_operations/chat_backend#6

(chat_backend = Docker/Django like dta_service; Ollama → http://10.0.0.128:11434.)

Companion backend ticket: https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/6 (`chat_backend` = Docker/Django like `dta_service`; Ollama → `http://10.0.0.128:11434`.)
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#13