From 1c63302c4073e848dfa4b11286635ba1f8b70bef Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Sat, 25 Jul 2026 06:26:39 -0500 Subject: [PATCH] Register chat_web_app for node-static deploy (chat_web_app#13 Part B). Add app_catalog entry, host_apps on adama/roslin/ai-server-4080 (prod :8082), and document ports/NPM backends for the CRA static frontend. --- IMPLEMENTATION.md | 17 ++++++++++++----- inventory/group_vars/all.yml | 9 +++++++++ inventory/host_vars/adama.yml | 2 ++ inventory/host_vars/ai-server-4080.yml | 4 +++- inventory/host_vars/roslin.yml | 2 ++ scripts/deploy.sh | 2 +- 6 files changed, 29 insertions(+), 7 deletions(-) diff --git a/IMPLEMENTATION.md b/IMPLEMENTATION.md index 46df233..59614f9 100644 --- a/IMPLEMENTATION.md +++ b/IMPLEMENTATION.md @@ -191,8 +191,9 @@ After Docker install, re-SSH so the `docker` group membership takes effect. |-----|------|-------|------|-------| | `company_site` | django (docker) | adama + roslin (+ ai-server-4080) | prod | active/active behind NPM; beta port reserved | | `dta_service` | django (docker) | adama + roslin + ai-server-4080 | beta + prod | active/active behind NPM | -| `dta_webapp` | node/vite static | adama + roslin (+ ai-server-4080) | beta + prod | active/active; built to `/var/www/_dta_webapp`, served by web-static nginx | +| `dta_webapp` | node/vite static | adama + roslin (+ ai-server-4080) | beta + prod | active/active; built to `/var/www/.app.ditchtheagent/html`, served by web-static nginx | | `scha` | django (docker) | adama + roslin + ai-server-4080 | prod | active/active behind NPM; beta port reserved | +| `chat_web_app` | node-static (CRA) | adama + roslin + ai-server-4080 | prod | active/active; built to `/var/www/.chat.aimloperations/html`, served by web-static nginx; beta port reserved | Django apps use a **shared external Postgres** (via `DATABASE_URL` in each host's env file) so active/active replicas share one database. Beta and prod never share @@ -217,6 +218,7 @@ future beta replica. | dta_service | 8011 | 8001 | adama, roslin, ai-server-4080 | | scha | 8012 (*not deployed*) | 8002 | adama, roslin, ai-server-4080 | | dta_webapp (nginx) | 8081 | 8080 | adama, roslin, ai-server-4080 | +| chat_web_app (nginx) | 8083 (*not deployed*) | 8082 | adama, roslin, ai-server-4080 | ### Flow @@ -235,9 +237,10 @@ future beta replica. to host `{{ apps_env_dir }}` → git checkout at ref → copy `.env` into checkout → `docker compose build` → `up -d` → migrate (run once, shared DB). - **node-static**: git checkout at ref → `npm ci` → `npm run build:` - (writes to `/var/www/_dta_webapp`). -- **web-static** role: one nginx container per app host (adama + roslin) serving - the static roots on their ports; NPM balances across both. + (writes to the app's `webroot_pattern`, e.g. `/var/www/{env}.app.ditchtheagent/html` + or `/var/www/{env}.chat.aimloperations/html`). +- **web-static** role: one nginx container per app host serving the static roots + on their ports (from `host_apps`); NPM balances across hosts. ### Reverse proxy / load balancing (NPM at 10.0.0.230) @@ -255,6 +258,7 @@ point each domain at the backend(s): | dta_service | (see DTA NPM hosts) | `adama:8001` / `8011` + same on roslin / ai-server-4080 | | dta_webapp | (see DTA NPM hosts) | `adama:8080` / `8081` + same on roslin | | scha | `schawheaton.aimloperations.com`, `schawheaton.com` (+ www) | `adama:8002` + `roslin:8002` (+ `ai-server-4080:8002`) | +| chat_web_app | `chat.aimloperations.com` (+ www) | `adama:8082` + `roslin:8082` (+ `ai-server-4080:8082`) | ### Required changes IN each app repo (owned separately) @@ -265,7 +269,9 @@ point each domain at the backend(s): with a call to `server-infra/scripts/deploy.sh --app --env --ref ` (keep the test/docker jobs). - [ ] `dta_webapp`: `npm run build:beta` / `build:prod` output to - `/var/www/beta_dta_webapp` / `/var/www/prod_dta_webapp`. + `/var/www/beta.app.ditchtheagent/html` / `/var/www/prod.app.ditchtheagent/html`. +- [ ] `chat_web_app`: `npm run build:beta` / `build:prod` output to + `/var/www/beta.chat.aimloperations/html` / `/var/www/prod.chat.aimloperations/html`. ### Shared Postgres (10.0.0.230, same box as NPM) @@ -356,6 +362,7 @@ Store vault password for CI in a file readable only by the Act runner (e.g. `~/. | 9 | Stub `deploy-apps.yml` + update `company_site` workflow | Future | | 10 | Dockerize `company_site` | Future (separate ticket) | | 10a | Register + deploy `scha` (all webservers, port 8002) | In progress ([scha#19](https://git.aimloperations.com/ai_ml_operations/scha/issues/19)) | +| 10b | Register + deploy `chat_web_app` (node-static, port 8082) | In progress ([chat_web_app#13](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/13)) | | 11 | Gitea container registry (optional) | Future | ## Open Decisions diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 07da8ba..027eda1 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -87,6 +87,15 @@ app_catalog: compose_file: docker-compose.prod.yml web_service: web migrate_cmd: "uv run python manage.py migrate --noinput" + chat_web_app: + type: node-static + repo: "{{ git_base_url }}/ai_ml_operations/chat_web_app.git" + default_branch: master + # package.json lives in this subdir of the checkout (npm runs here). + subdir: llm-fe + # Document root served by nginx and written by `npm run build:`. + # {env} is replaced with the entry's env (beta/prod). + webroot_pattern: "/var/www/{env}.chat.aimloperations/html" # Deploy filter vars. CI passes these; manual runs may leave them undefined # to (re)deploy every app listed in the host's host_apps. diff --git a/inventory/host_vars/adama.yml b/inventory/host_vars/adama.yml index 8cb65f7..f3eb8ee 100644 --- a/inventory/host_vars/adama.yml +++ b/inventory/host_vars/adama.yml @@ -12,3 +12,5 @@ host_apps: - { name: dta_webapp, env: beta, port: 8081 } - { name: scha, env: prod, port: 8002 } # optional: - { name: scha, env: beta, port: 8012 } + - { name: chat_web_app, env: prod, port: 8082 } + # optional: - { name: chat_web_app, env: beta, port: 8083 } diff --git a/inventory/host_vars/ai-server-4080.yml b/inventory/host_vars/ai-server-4080.yml index 4723b36..22e649b 100644 --- a/inventory/host_vars/ai-server-4080.yml +++ b/inventory/host_vars/ai-server-4080.yml @@ -24,4 +24,6 @@ host_apps: - { name: dta_webapp, env: beta, port: 8081 } - { name: dta_service, env: prod, port: 8001 } - { name: dta_service, env: beta, port: 8011 } - - { name: scha, env: prod, port: 8002 } \ No newline at end of file + - { name: scha, env: prod, port: 8002 } + - { name: chat_web_app, env: prod, port: 8082 } + # optional: - { name: chat_web_app, env: beta, port: 8083 } \ No newline at end of file diff --git a/inventory/host_vars/roslin.yml b/inventory/host_vars/roslin.yml index b36ea6f..c7ecf2b 100644 --- a/inventory/host_vars/roslin.yml +++ b/inventory/host_vars/roslin.yml @@ -9,3 +9,5 @@ host_apps: - { name: dta_webapp, env: beta, port: 8081 } - { name: scha, env: prod, port: 8002 } # optional: - { name: scha, env: beta, port: 8012 } + - { name: chat_web_app, env: prod, port: 8082 } + # optional: - { name: chat_web_app, env: beta, port: 8083 } diff --git a/scripts/deploy.sh b/scripts/deploy.sh index 5bb76ba..54e4420 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -17,7 +17,7 @@ Deploy applications with deploy-apps.yml. HOST Optional. Limit to one host: adama, roslin, or ai-server-4080. Options: - --app NAME App to deploy (company_site, dta_service, dta_webapp, scha) + --app NAME App to deploy (company_site, dta_service, dta_webapp, scha, chat_web_app) --env ENV Environment: beta or prod --ref REF Git ref/sha to deploy (default: master) --check Dry run -- 2.54.0