SPB Git

spb/market-atlas

Public
3.7 KB · 51 lines markdown
1# Deploying Market Atlas on MacLustr23Production runs on **M2U64** (Mac Studio M2 Ultra, 24 c / 64 GB) behind the MacLustr Tunnel (BHS64 Caddy → WireGuard wg1 10.67.0.12).4Everything goes through the gateway M1M32 and `mld` (`~/Desktop/cluster-skill/mld`).56```7Internet → GoDaddy DNS (A www.market-atlas.co → 51.161.112.61)8        → BHS64 Caddy (TLS, WebSocket passthrough) → wg1 → M2U64:8380  market-atlas-core (Fastify edge: /v1 REST + WS + SSE, workers, connectors)9                                                                    └─ proxies every non-/v1 path → 127.0.0.1:8382  market-atlas-web (Next.js)10                                                                    └─ Postgres 17 Homebrew (db/role market_atlas) · ~/market-atlas-data (raw, archive, backups, logs)11```1213Node prerequisites (present on M2U64 on 2026-09-12): node 25, pnpm 9, pm2, `postgresql@17` (brew service), role/db `market_atlas`14(password `market_atlas`, localhost only). Data dirs: `~/market-atlas-data/{raw,archive,backups,logs,cache}`.1516## Release procedure (from the laptop)1718```bash19cd ~/Desktop/Projets/apps-web/market-atlas20pnpm typecheck && pnpm test                                          # 1. types + 58+ unit/connector/consensus/calendar tests21deploy/render-manifest.sh --push                                     # 2. manifest with MA_ADMIN_TOKEN + HFMD_API_KEY → M1M32:~/dispatch/apps/market-atlas.json22~/Desktop/cluster-skill/mld stage ~/Desktop/Projets/apps-web/market-atlas market-atlas   # 3. laptop → gateway staging (sync_excludes)23~/Desktop/cluster-skill/mld deploy market-atlas --node M2U64        # 4. rsync → node, hooks (pnpm install, esbuild, migrate+seed, next build), PM2, health, tunnel route, registry24curl -s https://www.market-atlas.co/v1/health                        # 5. public check25```2627The `post_sync` hooks build the API bundle (`apps/api/dist`), run migrations + seeds and build the web app. `main.js` also migrates and28seeds at start (idempotent). `mld heal` (every 5 min on M1M32) restarts anything missing after a power cut and keeps the Caddy route29pointing at the current node.3031## Operations3233```bash34~/Desktop/cluster-skill/mld status | grep market-atlas35ssh M2U64 'pm2 logs market-atlas-core --lines 100 --nostream'36ssh M2U64 'cd ~/apps/market-atlas && export PATH=/opt/homebrew/opt/postgresql@17/bin:/opt/homebrew/bin:$PATH DATABASE_URL=postgres://market_atlas:market_atlas@127.0.0.1:5432/market_atlas MA_DATA_DIR=$HOME/market-atlas-data && node apps/api/dist/cli.js status'37ssh M2U64 '… node apps/api/dist/cli.js run cboe-delayed-quotes'      # one poll, printed38ssh M2U64 '… node apps/api/dist/cli.js replay 2026-09-12'            # re-normalize archived raw payloads offline39ssh M2U64 '… node apps/api/dist/cli.js backup'                       # pg_dump of metadata → ~/market-atlas-data/backups (also nightly ~04:00)40curl -s https://www.market-atlas.co/v1/stats | python3 -m json.tool  # live counters41```4243Admin console: `https://www.market-atlas.co/admin` (token = `deploy/.admin-token`). Connector actions (pause/resume/restart/test),44schema-change acknowledgements, storage/partitions, discovery form. Environment variables are listed in `.env.example`.4546Retention: observations partitions older than `MA_OBSERVATION_RETENTION_DAYS` (45) are exported to `~/market-atlas-data/archive/<year>/…ndjson.gz`47then dropped (index in `observation_archives`). Bars, events, filings, quotes are permanent. Off-node copies of `backups/` and `archive/`48should be scheduled to M1M32 (`rsync -a M2U64:~/market-atlas-data/backups/ M1M32:~/backups/market-atlas/`).4950Apex domain: add `A market-atlas.co → 51.161.112.61` at GoDaddy, then set `"redirects": ["market-atlas.co"]` in the manifest and redeploy.51
Files · 194ce53c1aa3a7f9dd438c773dc8d99bee9c6246
Menu

Theme