Commit Graph
27 Commits
Author SHA1 Message Date
westfarn 1988def1a6 Register dta_blog for node-static deploy (closes #29) (#30)
Sync runner checkout / sync (push) Successful in 7s
## Summary
- Closes [#29](#29).
- Register `dta_blog` in `app_catalog` (`type: node-static`, repo `Ditch_The_Agent/dta_blog`, default branch `main`, webroot `/var/www/{env}.blog.realpath.app/html`). Reuses `roles/app-deploy/tasks/node_static.yml` (`npm ci` then `npm run build:<env>`); the blog's `package.json` copies `dist/` to that webroot after `python3 build.py --env <env>`.
- Add prod **8086** / beta **8087** `host_apps` on adama, roslin, starbuck, apollo, and ai-server-4080 (those ports were free vs 8080–8085 / 8088).
- Optional nginx `error_page 404 /404.html` for this app only (`error_page_404` catalog field); other static apps keep the SPA `try_files` fallback.
- Document NPM/DNS (`blog.realpath.app` → `:8086`, `beta.blog.realpath.app` → `:8087`), no `realpath.app/blog` mount, and UFW staying LAN/NPM-only.

## Test plan
- [ ] Confirm 8086/8087 unused on app hosts before first deploy.
- [ ] `./scripts/deploy.sh --app dta_blog --env beta --ref main` publishes `/var/www/beta.blog.realpath.app/html`.
- [ ] `./scripts/deploy.sh --app dta_blog --env prod --ref main` publishes `/var/www/prod.blog.realpath.app/html`.
- [ ] **Until [dta_blog#1](Ditch_The_Agent/dta_blog#1) is on `main`**, use `--ref issue-1-static-blog` so the SSG (not the stub README) is built.
- [ ] NPM + DNS + TLS: `blog.realpath.app` → `:8086`, `beta.blog.realpath.app` → `:8087`. Do not reverse-proxy onto `realpath.app/blog`.
- [ ] Prod HTML has article text, Tianji id `cmtvvmf562afjzqumwt1yh2y8`, links to `https://realpath.app/`.
- [ ] Beta HTML has Tianji id `cmtvvn6z62agdzqumtk8xijpy`, links to `https://beta.realpath.app/`, demo posts present.
- [ ] `https://blog.realpath.app/sitemap.xml`, `robots.txt`, `llms.txt` return 200.
- [ ] Unknown slug returns 404.html (not the index SPA fallback).

Reviewed-on: #30
2026-09-10 18:34:25 -07:00
westfarn 2abcdd7c58 Register print_forge for django deploy (closes #27) (#28)
Sync runner checkout / sync (push) Successful in 6s
## Summary
- Closes [#27](#27).
- Register `print_forge` in `app_catalog` (`type: django`, repo `ai_ml_operations/print_forge`, default branch `master`).
- Add `host_apps` prod `:8007` / beta `:8019` on **adama**, **roslin**, **starbuck**, **apollo**, and **ai-server-4080**.
- dj-queue **worker singleton on adama** only (`compose_profiles: [worker]`); other hosts web-only.
- Document ports, NPM hosts, Postgres DBs, secrets, Nominatim (`10.0.0.128:8089`), and the app-repo companion ([print_forge#1](ai_ml_operations/print_forge#1)).
- Update `scripts/deploy.sh` `--app` help.
- Move unused `abc_be` prod port reserve **8007 → 8009** so it does not collide with `print_forge`.

## Test plan
- [ ] Confirm `print_forge` appears in `app_catalog` and `--app print_forge` is listed in `deploy.sh --help`
- [ ] Confirm beta `host_apps` on all five hosts (port **8019**); adama has `compose_profiles: [worker]`
- [ ] Confirm prod port **8007** reserved on those hosts (no NPM until launch)
- [ ] After merge (ops, not this PR): create Postgres DBs `print_forge_beta` + `print_forge` on `10.0.0.230`, grant `westfarn`
- [ ] After merge (ops): write `~/Documents/secrets/print_forge/print_forge_{beta,prod}.env` from app `.env.prod.example`; add `print_forge:<token>` to `SHORTENER_API_TOKENS` (beta first)
- [ ] After merge (ops): NPM `print-forge-preview.aimloperations.com` → `:8019` active/active; do **not** NPM-route `printforgeprints.com` until launch
- [ ] After secrets + DBs: `~/Documents/repos/server-infra/scripts/deploy.sh --app print_forge --env beta --ref master` and hit `/healthz/`

Reviewed-on: #28
2026-09-06 06:35:48 -07:00
westfarnandCursor aac815314d Register abc_fe / abc_be / abc_worker for beta-only deploy.
Sync runner checkout / sync (push) Successful in 6s
Closes #26. GIS Benefits Coach gets beta host_apps (8017/8018/8085) and catalog entries; prod ports stay reserved.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 16:21:23 -05:00
westfarn 95fbae8db4 Register college_craft for django deploy (closes #24) (#25)
Sync runner checkout / sync (push) Successful in 6s
## Summary
- Closes [#24](#24).
- Register `college_craft` in `app_catalog` (`type: django`, repo `ai_ml_operations/college_craft`, default branch `master`).
- Add `host_apps` prod `:8006` / beta `:8016` on **adama**, **roslin**, **starbuck**, **apollo**, and **ai-server-4080**.
- dj-queue **worker singleton on adama** only (`compose_profiles: [worker]`); other hosts web-only.
- Document ports, NPM hosts, Postgres DBs, secrets, Nominatim (`10.0.0.128:8089`), and the app-repo `--app client_site` leftover.
- Add `college_craft` to `scripts/deploy.sh` `--app` help.

## Out of scope (ops, after merge)
- Create Postgres DBs `college_craft` / `college_craft_beta` on `10.0.0.230` and grant `westfarn`.
- Write control-node secrets `~/Documents/secrets/college_craft/college_craft_{prod,beta}.env`.
- NPM: `collegecraft.com` (+ www) → `:8006`; `college-craft-preview.aimloperations.com` → `:8016`.
- Smoke deploy after secrets + DBs exist:
  ```bash
  ~/Documents/repos/server-infra/scripts/deploy.sh --app college_craft --env beta --ref master
  ~/Documents/repos/server-infra/scripts/deploy.sh --app college_craft --env prod --ref master
  ```

## Test plan
- [ ] Confirm `app_catalog.college_craft` matches other django apps (`compose_file`, `migrate_cmd`).
- [ ] Confirm ports 8006/8016 unused elsewhere and match across all five hosts.
- [ ] Confirm only adama has `compose_profiles: [worker]` for college_craft.
- [ ] After secrets + DBs: deploy beta then prod; `/healthz/` up on both; prod holding page, beta full site.

Reviewed-on: #25
2026-09-02 07:39:03 -07:00
westfarn 9208e63491 Register url_shortening_service for django deploy (closes #22) (#23)
Sync runner checkout / sync (push) Successful in 6s
## Summary
- Closes [#22](#22).
- Register `url_shortening_service` in `app_catalog` (`type: django`, repo `ai_ml_operations/url_shortening_service`, default branch `master`) and `host_apps` on **adama**, **roslin**, **starbuck**, **apollo**, and **ai-server-4080** (prod **8005**, beta **8015**).
- Document NPM (short host vs API host, same container), Postgres DBs (`url_shortener` / `url_shortener_beta`), and extra env keys. No compose worker profile.
- List `url_shortening_service` in `scripts/deploy.sh` `--app` help.

## Out of scope (manual ops)
- Create Postgres DBs `url_shortener` / `url_shortener_beta` + grant `westfarn` on `10.0.0.230`
- Control-node secrets under `~/Documents/secrets/url_shortening_service/`
- NPM proxy hosts (Ryan): short host `/` + `/[a-z0-9]{4,8}` (404 `/api/`, `/admin/`, `/debug/`); API host `/api/` only (404 `/admin/`)
- Deploy smoke — [url_shortening_service](https://git.aimloperations.com/ai_ml_operations/url_shortening_service) `master` is still a stub (`README.md` only)

## Test plan
- [x] Inventory YAML: `url_shortening_service` in `app_catalog`; every host `host_apps` has prod **8005** / beta **8015**
- [ ] After app compose + secrets + DBs exist: `./scripts/deploy.sh --app url_shortening_service --env beta --ref master`
- [ ] Same for prod
- [ ] `GET /healthz/` → `{"status":"ok"}` on both ports
- [ ] Short host `GET /` landing page; `POST /api/links/` without Bearer → 401; public `/admin/` → 404

Reviewed-on: #23
2026-08-30 04:51:31 -07:00
westfarn ec294a1d45 Add starbuck and apollo as active/active app hosts (#21)
Sync runner checkout / sync (push) Successful in 6s
## Summary

- Closes [#20](#20).
- Register **starbuck** (`10.0.0.44`) and **apollo** (`10.0.0.7`) as Proxmox app hosts in `webservers`, with `host_apps` copied from **roslin** (same apps/ports; **no** `monica_site` worker — that stays a singleton on **adama**).
- Allow `starbuck` / `apollo` in `provision.sh` and `deploy.sh`; document inventory, NPM backends, and Alloy `host` labels.

## Test plan

- [ ] `ansible-inventory --list` shows both hosts under `webservers` at the expected IPs.
- [ ] Bootstrap SSH + passwordless sudo on each VM (keep a Proxmox console open for first UFW enable).
- [ ] `ansible starbuck,apollo -m ping`
- [ ] `./scripts/provision.sh starbuck --check` then `./scripts/provision.sh starbuck`
- [ ] `./scripts/provision.sh apollo --check` then `./scripts/provision.sh apollo`
- [ ] `./scripts/deploy.sh starbuck` and `./scripts/deploy.sh apollo` bring up the same app+env set as roslin.
- [ ] `monica_site` dj-queue worker still runs **only** on adama.
- [ ] Grafana/Loki show `host="starbuck"` and `host="apollo"`.
- [ ] NPM Advanced upstreams (manual): add `starbuck:PORT` and `apollo:PORT` beside adama/roslin.Reviewed-on: #21
2026-08-16 07:20:38 -07:00
westfarn 2e3fe13b39 Build profile-gated services so workers do not run stale images (#19)
Sync runner checkout / sync (push) Successful in 7s
## Summary

The django deploy sets `COMPOSE_PROFILES` on the **start** step but not on the **build** step, so `docker compose build` skips profile-gated services. `up -d` then reuses whatever image already exists and the container silently keeps running old code.

This adds `COMPOSE_PROFILES` to the build step so it matches the start step. Only affects hosts that set `host_apps.compose_profiles` (today: the `monica_site` dj-queue worker on adama).

## Symptom this fixes

On adama the beta worker image was 20 hours stale while web was current:

| Image | Built | Postgres driver |
|---|---|---|
| `monica_site_beta-web` | today | psycopg 3.3.4 |
| `monica_site_beta-worker` | Aug 8 | psycopg2 2.9.12 |

So the worker crash-looped on LISTEN/NOTIFY (`TypeError: 'list' object is not callable` in `dj_queue/runtime/notify.py`) long after `monica_site` had moved to psycopg3, because its image was never rebuilt.

Branch is merged up with `master`, which already carries the worker auto-start from [#18](#18); the diff here is just the build step.

## Test plan

- [x] Manual `COMPOSE_PROFILES=worker docker compose build worker` on adama produced an image with psycopg 3.3.4 and the notify errors stopped.
- [ ] Beta deploy from this branch recreates the worker with a fresh image, no manual rebuild.
- [ ] Hosts without `compose_profiles` (roslin, ai-server-4080) still build/start web only.Reviewed-on: #19
2026-08-09 04:36:51 -07:00
westfarn b07e8cb4c3 Auto-start monica_site dj-queue worker on adama (#18)
Sync runner checkout / sync (push) Successful in 7s
## Summary
- Closes [#17](#17).
- Django deploy passes optional `host_apps.compose_profiles` as `COMPOSE_PROFILES` so compose profiles survive `up -d --remove-orphans`.
- Adama `monica_site` beta+prod set `compose_profiles: [worker]` (dj-queue singleton). Roslin / ai-server-4080 stay web-only.

## Why
Real campaign sends enqueue dj-queue tasks; without the worker they stay **Queued**. Test email worked because it is synchronous SMTP.

## Test plan
- [ ] Merge + deploy `monica_site` beta (and/or prod) via `deploy.sh`
- [ ] On **adama**, confirm worker container up for `monica_site_beta` / `monica_site_prod`
- [ ] On roslin / ai-server-4080, confirm **no** worker
- [ ] Portal: send campaign → recipient leaves Queued → SentReviewed-on: #18
2026-08-08 12:01:18 -07:00
westfarn cc503988c0 Register monica_site for django deploy (closes #14) (#15)
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
2026-08-06 13:46:00 -07:00
westfarn 829a63cbf2 Point dta_webapp webroot at realpath.app paths (closes #12) (#13)
Sync runner checkout / sync (push) Successful in 7s
## Summary
- Change `dta_webapp` `webroot_pattern` from `/var/www/{env}.app.ditchtheagent/html` → `/var/www/{env}.realpath.app/html`
- Update `IMPLEMENTATION.md` references to match
- **web-static:** before `compose up`, `docker rm -f` any container publishing the static host ports (`docker ps --filter publish=<port>`), then force-recreate when cleanup ran — clears orphan/legacy binders while keeping the same ports

Closes #12

Coordinates with [dta_webapp#48](Ditch_The_Agent/dta_webapp#48) / [PR #49](Ditch_The_Agent/dta_webapp#49) (`build:beta`/`build:prod` write to the same dirs; prod uses `prod.realpath.app`).

## Test plan
- [ ] Confirm `app_catalog.dta_webapp.webroot_pattern` expands to beta/prod realpath paths
- [ ] On a host with a leftover container on 8080/8081, run deploy and confirm it is removed and web-static rebinds
- [ ] After merge, redeploy `dta_webapp` beta (and prod when ready) and verify files under `/var/www/{env}.realpath.app/html`
- [ ] Hit web-static ports and confirm new build content servedReviewed-on: #13
2026-08-06 08:46:33 -07:00
westfarn 7e48c22e3e Deploy SearxNG on ai-server-4080 for chat_backend grounded search (#10) (#11)
Sync runner checkout / sync (push) Successful in 7s
## Summary
- Closes [#10](#10).
- Deploys **SearxNG** on **ai-server-4080** (`10.0.0.128`) for [chat_backend#62](ai_ml_operations/chat_backend#62) / [PR #65](ai_ml_operations/chat_backend#65) grounded search.
- New `roles/searxng/` (compose + JSON-enabled `settings.yml`), gated by `searxng_stack: true`, wired into `site.yml`.
- **Host port 8088** (not 8080 — that is `dta_webapp` on this host). UFW allows `10.0.0.0/24` → `8088/tcp` only.

## Ops after merge

```bash
./scripts/provision.sh ai-server-4080
# or targeted:
ansible-playbook playbooks/site.yml --limit ai-server-4080 --tags never  # full site play includes searxng when searxng_stack
```

Then set in `chat_backend_prod.env` / `chat_backend_beta.env`:

```text
SEARCH_PROVIDER=searxng
SEARCH_FAILOVER_PROVIDER=ddgs
SEARXNG_BASE_URL=http://10.0.0.128:8088
```

Smoke test from any app host:

```bash
curl -sG 'http://10.0.0.128:8088/search' --data-urlencode 'q=test' -d 'format=json' | head
```

## Test plan
- [ ] Provision ai-server-4080; confirm `docker ps` shows `searxng`
- [ ] Confirm `:8088` responds with JSON; `:8080` still serves dta_webapp
- [ ] Confirm UFW rule is LAN-only
- [ ] From adama/roslin container network, curl SearxNG succeeds
- [ ] Update chat_backend secrets to `:8088` and redeploy betaReviewed-on: #11
2026-08-02 11:33:38 -07:00
westfarn 92afbc6e00 Enable beta deploys for chat_backend + chat_web_app (#7) (#8)
Sync runner checkout / sync (push) Successful in 7s
## Summary

Implements [#7](#7): register **beta** workloads for `chat_backend` and `chat_web_app`, matching the existing `dta_service` / `dta_webapp` pattern.

- Enable `host_apps` beta entries on **adama**, **roslin**, and **ai-server-4080** (`chat_backend` **8013**, `chat_web_app` **8083**)
- Update `IMPLEMENTATION.md` apps / ports / NPM / roadmap tables for chat beta + prod
- Prod chat entries unchanged

## Ops follow-ups (outside this PR)

- Create Postgres DB `chat_backend_beta` + grant `westfarn`
- Add `~/Documents/secrets/chat_backend/chat_backend_beta.env` (mode 600)
- NPM: `beta.chat.aimloperations.com` → `*:8083`; `beta.chatbackend.aimloperations.com` → `*:8013`
- Smoke: `./scripts/deploy.sh --app chat_backend --env beta --ref <sha>` and same for `chat_web_app`

Companion app tickets: [chat_backend#26](ai_ml_operations/chat_backend#26), [chat_web_app#35](ai_ml_operations/chat_web_app#35)

## Test plan

- [ ] Confirm beta rows present in all three `host_vars`
- [ ] After merge + ops setup: deploy beta for both apps succeeds
- [ ] Prod chat deploys still work on 8003 / 8082
- [ ] NPM beta domains route to 8013 / 8083Reviewed-on: #8
2026-07-27 08:32:36 -07:00
westfarn d49c6bfe2d Fail loud when deploy --app matches nothing (#6)
Sync runner checkout / sync (push) Successful in 6s
## Summary

- Fail when `--app` / `--env` match no `host_apps` row (was silent no-op)
- Fail when `--app` missing from `app_catalog`

Prevents "deploy succeeded" that only refreshed web-static nginx while skipping Django — what happened on [chat_backend run 205](https://git.aimloperations.com/ai_ml_operations/chat_backend/actions/runs/205) before `chat_backend` was registered on master.

## Test plan

- [ ] `./scripts/deploy.sh --app does_not_exist --env prod` should fail with catalog message
- [ ] `./scripts/deploy.sh --app chat_backend --env prod` should proceed with Django once catalog/host_apps presentReviewed-on: #6
2026-07-27 08:27:29 -07:00
westfarn ed68275fa6 Register chat_backend for django deploy (#6 Part B)
Sync runner checkout / sync (push) Successful in 7s
2026-07-25 05:34:28 -07:00
westfarnandCursor 39b0a9f475 Register chat_backend for django deploy (chat_backend#6 Part B).
Sync runner checkout / sync (pull_request) Successful in 7s
Add app_catalog entry, host_apps on adama/roslin/ai-server-4080 (prod
:8003), and document ports/NPM/Postgres/Ollama for active/active.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-25 07:03:36 -05:00
westfarn 71d96839dc Register chat_web_app for node-static deploy (chat_web_app#13 Part B). (#4)
Sync runner checkout / sync (push) Successful in 6s
Add app_catalog entry, host_apps on adama/roslin/ai-server-4080 (prod :8082),
and document ports/NPM backends for the CRA static frontend.Reviewed-on: #4
2026-07-25 04:28:26 -07:00
westfarn 04ccbecbd7 Register scha for deploy on all webservers (scha#19 Part B) (#3)
Sync runner checkout / sync (push) Successful in 6s
## Summary
- Register `scha` in `app_catalog` and `host_apps` on adama, roslin, and ai-server-4080 (prod port **8002**; beta **8012** reserved).
- Update `IMPLEMENTATION.md` ports, apps, Postgres, and NPM tables so every app lists beta + prod.
- Include `scha` in `deploy.sh` help.

Part A (dockerize / CI in the `scha` repo) is tracked separately in [scha#19](ai_ml_operations/scha#19).

## Test plan
- [ ] Confirm inventory YAML loads: `ansible-inventory --list` shows `scha` under each host
- [ ] After Part A merges + `~/Documents/secrets/scha/scha_prod.env` exists: dry-run `./scripts/deploy.sh --app scha --env prod --check`
- [ ] Create DB `scha` on shared Postgres (`10.0.0.230`) and point NPM at `adama:8002` + `roslin:8002` (+ optional `ai-server-4080:8002`)

Reviewed-on: #3
2026-07-14 03:06:46 -07:00
westfarn d9d2dc246a Add Gitea workflow to sync runner checkout on master changes (#2)
Sync runner checkout / sync (push) Successful in 7s
## Summary

Implements #1: Gitea Act workflow that fast-forward pulls `~/Documents/repos/server-infra` on the self-hosted runner whenever `master` changes.

- Adds `.gitea/workflows/sync-checkout.yml`
- Triggers on direct push to `master` and on merged PRs targeting `master`
- Refuses to pull if the working tree is dirty
- Documents the workflow in `IMPLEMENTATION.md`

## Test plan

- [ ] Merge PR → workflow runs on self-hosted runner
- [ ] Runner checkout at `/home/westfarn/Documents/repos/server-infra` advances to latest `master` commit
- [ ] Dirty working tree on runner causes workflow to fail (no silent overwrite)
- [ ] Direct push to `master` also triggers sync

Closes #1

Reviewed-on: #2
2026-07-11 09:58:14 -07:00
westfarn 974e848d91 updating to remove company_site beta 2026-07-10 12:31:32 -05:00
westfarn f37ec41530 Updates for grafana stack 2026-07-10 06:50:52 -05:00
westfarn 728a0c60f2 doc plan update 2026-07-09 17:11:14 -05:00
westfarnandCursor b1b9b3bafe Stop legacy dta_service systemd units before Docker deploy (#52).
ai-server-4080 runs dta_service active/active with adama and roslin.
Disable beta_dta_wsgi/prod_dta_wsgi so port 8001/8011 are free for compose.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 11:45:03 -05:00
westfarn a7417345a3 Update inventory/host_vars/ai-server-4080.yml 2026-07-09 08:31:59 -07:00
westfarn c53112bfd7 more updates 2026-07-08 13:30:33 -05:00
westfarn 1ba3d10e3f pushing updates 2026-07-08 13:16:59 -05:00
westfarn 589462e6d0 updates 2026-07-08 05:59:11 -05:00
westfarn f848420d8f Initial server-infra setup 2026-07-06 15:34:49 -05:00