Register monica_site for django deploy (closes #14) (#15)
Sync runner checkout / sync (push) Successful in 6s
Sync runner checkout / sync (push) Successful in 6s
## Summary - Closes [#14](#14). - Register `monica_site` in `app_catalog` (`type: django`, repo `ai_ml_operations/monica_site`, default branch `main`) and `host_apps` on **adama**, **roslin**, and **ai-server-4080** (prod **8004**, beta **8014**). - Document NPM (`mkdrealtor.com` / `monica-preview.aimloperations.com`), Postgres DBs (`monica_site` / `monica_site_beta`), and **dj-queue worker singleton on adama** only (`compose --profile worker`). - List `monica_site` in `scripts/deploy.sh` `--app` help. ## Out of scope (manual ops) - Create Postgres DBs + grants on `10.0.0.230` - Control-node secrets under `~/Documents/secrets/monica_site/` - NPM proxy hosts (Ryan) - First deploy smoke + worker start on adama ## Test plan - [ ] Confirm inventory YAML parses (`ansible-inventory --list` or dry deploy) - [ ] Create DBs `monica_site` / `monica_site_beta` + secrets before smoke deploy - [ ] `./scripts/deploy.sh --app monica_site --env beta --ref main` - [ ] `./scripts/deploy.sh --app monica_site --env prod --ref main` - [ ] On **adama** only: `docker compose -f docker-compose.prod.yml --profile worker up -d` - [ ] Hit `/healthz/` on beta + prod; prod under-construction holding pageReviewed-on: #15
This commit was merged in pull request #15.
This commit is contained in:
@@ -198,6 +198,7 @@ After Docker install, re-SSH so the `docker` group membership takes effect.
|
|||||||
| `scha` | django (docker) | adama + roslin + ai-server-4080 | prod | active/active behind NPM; beta port reserved |
|
| `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 | beta + prod | active/active; built to `/var/www/<env>.chat.aimloperations/html`, served by web-static nginx |
|
| `chat_web_app` | node-static (CRA) | adama + roslin + ai-server-4080 | beta + prod | active/active; built to `/var/www/<env>.chat.aimloperations/html`, served by web-static nginx |
|
||||||
| `chat_backend` | django (docker) | adama + roslin + ai-server-4080 | beta + prod | active/active behind NPM; Ollama `http://10.0.0.128:11434`; SearxNG `http://10.0.0.128:8088` (`SEARXNG_BASE_URL`) |
|
| `chat_backend` | django (docker) | adama + roslin + ai-server-4080 | beta + prod | active/active behind NPM; Ollama `http://10.0.0.128:11434`; SearxNG `http://10.0.0.128:8088` (`SEARXNG_BASE_URL`) |
|
||||||
|
| `monica_site` | django (docker) | adama + roslin + ai-server-4080 | beta + prod | active/active behind NPM; no bundled Postgres (like `scha`); dj-queue **worker singleton on adama** only (`compose --profile worker`); Ollama social drafting via `10.0.0.128:11434` |
|
||||||
|
|
||||||
Django apps use a **shared external Postgres** (via `DATABASE_URL` in each host's
|
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
|
env file) so active/active replicas share one database. Beta and prod never share
|
||||||
@@ -222,6 +223,7 @@ future beta replica.
|
|||||||
| dta_service | 8011 | 8001 | adama, roslin, ai-server-4080 |
|
| dta_service | 8011 | 8001 | adama, roslin, ai-server-4080 |
|
||||||
| scha | 8012 (*not deployed*) | 8002 | adama, roslin, ai-server-4080 |
|
| scha | 8012 (*not deployed*) | 8002 | adama, roslin, ai-server-4080 |
|
||||||
| chat_backend | 8013 | 8003 | adama, roslin, ai-server-4080 |
|
| chat_backend | 8013 | 8003 | adama, roslin, ai-server-4080 |
|
||||||
|
| monica_site | 8014 | 8004 | adama, roslin, ai-server-4080 |
|
||||||
| dta_webapp (nginx) | 8081 | 8080 | adama, roslin, ai-server-4080 |
|
| dta_webapp (nginx) | 8081 | 8080 | adama, roslin, ai-server-4080 |
|
||||||
| chat_web_app (nginx) | 8083 | 8082 | adama, roslin, ai-server-4080 |
|
| chat_web_app (nginx) | 8083 | 8082 | adama, roslin, ai-server-4080 |
|
||||||
| SearxNG (LAN only) | — | **8088** | ai-server-4080 only (`searxng_stack`); not an NPM upstream |
|
| SearxNG (LAN only) | — | **8088** | ai-server-4080 only (`searxng_stack`); not an NPM upstream |
|
||||||
@@ -255,6 +257,10 @@ chat_backend secrets must use `SEARXNG_BASE_URL=http://10.0.0.128:8088`.
|
|||||||
- **django**: push per-app secret from control node `{{ secrets_dir }}/<app>/<app>_<env>.env`
|
- **django**: push per-app secret from control node `{{ secrets_dir }}/<app>/<app>_<env>.env`
|
||||||
to host `{{ apps_env_dir }}` → git checkout at ref → copy `.env` into checkout →
|
to host `{{ apps_env_dir }}` → git checkout at ref → copy `.env` into checkout →
|
||||||
`docker compose build` → `up -d` → migrate (run once, shared DB).
|
`docker compose build` → `up -d` → migrate (run once, shared DB).
|
||||||
|
**`monica_site` worker:** compose profile `worker` (dj-queue) is **not** started by
|
||||||
|
catalog deploy. After first/prod deploy, start once on **adama only**:
|
||||||
|
`docker compose -f docker-compose.prod.yml --profile worker up -d`
|
||||||
|
(do not run on roslin / ai-server-4080).
|
||||||
- **node-static**: git checkout at ref → `npm ci` → `npm run build:<env>`
|
- **node-static**: git checkout at ref → `npm ci` → `npm run build:<env>`
|
||||||
(writes to the app's `webroot_pattern`, e.g. `/var/www/{env}.realpath.app/html`
|
(writes to the app's `webroot_pattern`, e.g. `/var/www/{env}.realpath.app/html`
|
||||||
or `/var/www/{env}.chat.aimloperations/html`).
|
or `/var/www/{env}.chat.aimloperations/html`).
|
||||||
@@ -281,6 +287,7 @@ point each domain at the backend(s):
|
|||||||
| scha | `schawheaton.aimloperations.com`, `schawheaton.com` (+ www) | `adama:8002` + `roslin:8002` (+ `ai-server-4080:8002`) |
|
| scha | `schawheaton.aimloperations.com`, `schawheaton.com` (+ www) | `adama:8002` + `roslin:8002` (+ `ai-server-4080:8002`) |
|
||||||
| chat_web_app | `chat.aimloperations.com` (+ www); `beta.chat.aimloperations.com` | `adama:8082` / `8083` + same on roslin / ai-server-4080 |
|
| chat_web_app | `chat.aimloperations.com` (+ www); `beta.chat.aimloperations.com` | `adama:8082` / `8083` + same on roslin / ai-server-4080 |
|
||||||
| chat_backend | `chatbackend.aimloperations.com`; `beta.chatbackend.aimloperations.com` | `adama:8003` / `8013` + same on roslin / ai-server-4080 |
|
| chat_backend | `chatbackend.aimloperations.com`; `beta.chatbackend.aimloperations.com` | `adama:8003` / `8013` + same on roslin / ai-server-4080 |
|
||||||
|
| monica_site | `mkdrealtor.com` (+ www); `monica-preview.aimloperations.com` (beta) | `adama:8004` / `8014` + same on roslin / ai-server-4080 |
|
||||||
|
|
||||||
### Required changes IN each app repo (owned separately)
|
### Required changes IN each app repo (owned separately)
|
||||||
|
|
||||||
@@ -313,6 +320,8 @@ do not).
|
|||||||
| scha | beta | `scha_beta` | `postgres://westfarn:<pw>@10.0.0.230:5432/scha_beta` |
|
| scha | beta | `scha_beta` | `postgres://westfarn:<pw>@10.0.0.230:5432/scha_beta` |
|
||||||
| chat_backend | prod | `chat_backend` | `postgres://westfarn:<pw>@10.0.0.230:5432/chat_backend` |
|
| chat_backend | prod | `chat_backend` | `postgres://westfarn:<pw>@10.0.0.230:5432/chat_backend` |
|
||||||
| chat_backend | beta | `chat_backend_beta` | `postgres://westfarn:<pw>@10.0.0.230:5432/chat_backend_beta` |
|
| chat_backend | beta | `chat_backend_beta` | `postgres://westfarn:<pw>@10.0.0.230:5432/chat_backend_beta` |
|
||||||
|
| monica_site | prod | `monica_site` | `postgres://westfarn:<pw>@10.0.0.230:5432/monica_site` |
|
||||||
|
| monica_site | beta | `monica_site_beta` | `postgres://westfarn:<pw>@10.0.0.230:5432/monica_site_beta` |
|
||||||
|
|
||||||
Server prereqs on 10.0.0.230: create each DB + grant `westfarn`;
|
Server prereqs on 10.0.0.230: create each DB + grant `westfarn`;
|
||||||
`listen_addresses` covers LAN; `pg_hba.conf` allows `10.0.0.0/24`; firewall opens
|
`listen_addresses` covers LAN; `pg_hba.conf` allows `10.0.0.0/24`; firewall opens
|
||||||
@@ -390,6 +399,7 @@ Store vault password for CI in a file readable only by the Act runner (e.g. `~/.
|
|||||||
| 10a | Register + deploy `scha` (all webservers, port 8002) | In progress ([scha#19](https://git.aimloperations.com/ai_ml_operations/scha/issues/19)) |
|
| 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, ports 8082/8083) | Done (prod); beta ([#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7), [chat_web_app#35](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/35)) |
|
| 10b | Register + deploy `chat_web_app` (node-static, ports 8082/8083) | Done (prod); beta ([#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7), [chat_web_app#35](https://git.aimloperations.com/ai_ml_operations/chat_web_app/issues/35)) |
|
||||||
| 10c | Register + deploy `chat_backend` (django, ports 8003/8013) | Done (prod); beta ([#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7), [chat_backend#26](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/26)) |
|
| 10c | Register + deploy `chat_backend` (django, ports 8003/8013) | Done (prod); beta ([#7](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/7), [chat_backend#26](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/26)) |
|
||||||
|
| 10d | Register + deploy `monica_site` (django, ports 8004/8014; worker on adama) | In progress ([#14](https://git.aimloperations.com/ai_ml_operations/server-infra/issues/14)) |
|
||||||
| 11 | Gitea container registry (optional) | Future |
|
| 11 | Gitea container registry (optional) | Future |
|
||||||
|
|
||||||
## Open Decisions
|
## Open Decisions
|
||||||
|
|||||||
@@ -103,6 +103,16 @@ app_catalog:
|
|||||||
compose_file: docker-compose.prod.yml
|
compose_file: docker-compose.prod.yml
|
||||||
web_service: web
|
web_service: web
|
||||||
migrate_cmd: "uv run python manage.py migrate --noinput"
|
migrate_cmd: "uv run python manage.py migrate --noinput"
|
||||||
|
monica_site:
|
||||||
|
type: django
|
||||||
|
repo: "{{ git_base_url }}/ai_ml_operations/monica_site.git"
|
||||||
|
default_branch: main
|
||||||
|
compose_file: docker-compose.prod.yml
|
||||||
|
web_service: web
|
||||||
|
migrate_cmd: "uv run python manage.py migrate --noinput"
|
||||||
|
# dj-queue worker (compose profile `worker`) is a singleton — start only on
|
||||||
|
# adama after deploy: docker compose -f docker-compose.prod.yml --profile worker up -d
|
||||||
|
# Catalog deploys web + migrate only; worker is manual / ops step.
|
||||||
|
|
||||||
# Deploy filter vars. CI passes these; manual runs may leave them undefined
|
# Deploy filter vars. CI passes these; manual runs may leave them undefined
|
||||||
# to (re)deploy every app listed in the host's host_apps.
|
# to (re)deploy every app listed in the host's host_apps.
|
||||||
|
|||||||
@@ -16,3 +16,6 @@ host_apps:
|
|||||||
- { name: chat_web_app, env: beta, port: 8083 }
|
- { name: chat_web_app, env: beta, port: 8083 }
|
||||||
- { name: chat_backend, env: prod, port: 8003 }
|
- { name: chat_backend, env: prod, port: 8003 }
|
||||||
- { name: chat_backend, env: beta, port: 8013 }
|
- { name: chat_backend, env: beta, port: 8013 }
|
||||||
|
- { name: monica_site, env: prod, port: 8004 }
|
||||||
|
- { name: monica_site, env: beta, port: 8014 }
|
||||||
|
# monica_site dj-queue worker (compose --profile worker) runs ONLY on adama.
|
||||||
|
|||||||
@@ -33,4 +33,7 @@ host_apps:
|
|||||||
- { name: chat_web_app, env: prod, port: 8082 }
|
- { name: chat_web_app, env: prod, port: 8082 }
|
||||||
- { name: chat_web_app, env: beta, port: 8083 }
|
- { name: chat_web_app, env: beta, port: 8083 }
|
||||||
- { name: chat_backend, env: prod, port: 8003 }
|
- { name: chat_backend, env: prod, port: 8003 }
|
||||||
- { name: chat_backend, env: beta, port: 8013 }
|
- { name: chat_backend, env: beta, port: 8013 }
|
||||||
|
- { name: monica_site, env: prod, port: 8004 }
|
||||||
|
- { name: monica_site, env: beta, port: 8014 }
|
||||||
|
# monica_site worker is NOT on ai-server-4080 — singleton on adama only.
|
||||||
@@ -13,3 +13,6 @@ host_apps:
|
|||||||
- { name: chat_web_app, env: beta, port: 8083 }
|
- { name: chat_web_app, env: beta, port: 8083 }
|
||||||
- { name: chat_backend, env: prod, port: 8003 }
|
- { name: chat_backend, env: prod, port: 8003 }
|
||||||
- { name: chat_backend, env: beta, port: 8013 }
|
- { name: chat_backend, env: beta, port: 8013 }
|
||||||
|
- { name: monica_site, env: prod, port: 8004 }
|
||||||
|
- { name: monica_site, env: beta, port: 8014 }
|
||||||
|
# monica_site worker is NOT on roslin — singleton on adama only.
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ Deploy applications with deploy-apps.yml.
|
|||||||
HOST Optional. Limit to one host: adama, roslin, or ai-server-4080.
|
HOST Optional. Limit to one host: adama, roslin, or ai-server-4080.
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--app NAME App to deploy (company_site, dta_service, dta_webapp, scha, chat_web_app, chat_backend)
|
--app NAME App to deploy (company_site, dta_service, dta_webapp, scha, chat_web_app, chat_backend, monica_site)
|
||||||
--env ENV Environment: beta or prod
|
--env ENV Environment: beta or prod
|
||||||
--ref REF Git ref/sha to deploy (default: master)
|
--ref REF Git ref/sha to deploy (default: master)
|
||||||
--check Dry run
|
--check Dry run
|
||||||
|
|||||||
Reference in New Issue
Block a user