# MoneyFlix Redirector System ## Overview Dedicated redirect + CRM stack for the MoneyFlix client, isolated from the main CRM so multi-client traffic does not collide. ## Production (canonical) — CT 241 / LXC > **Retired host:** The old hacked VM `94.23.75.89` (PM2, Node on port 3001) is **no longer production**. Do not SSH there, do not restart PM2 there, and do not point deploy scripts at that IP. | Item | Value | |------|-------| | Proxmox VMID | **241** (`moneyflix`) | | LAN IP | **10.10.50.37/24** (VLAN 1050, node09) | | App directory | `/opt/moneyflix` | | Secrets (guest) | `/etc/moneyflix/moneyflix.env` (Infisical / vault — **never in Git**) | | Redirector process | **systemd** unit `moneyflix-redirector` (Node listens on **:3000**; nginx proxies **:80**) | | CRM admin | nginx **:8080** → php8.1-fpm | | Public edge | Nginx Proxy Manager **CT 102** (`192.168.1.85`) — TLS termination | | Public domain | `redirect.moneyflix.com` → `http://10.10.50.37:80` | | CRM admin (internal) | `crm-moneyflix.bitreport.pt` → `http://10.10.50.37:8080` | ### Operator runbook (Paperclip meta-repo) Canonical provisioning, secrets, NPM hosts, rollback, and service management: - `docs/runbooks/MONEYFLIX_LXC_DEPLOY_BIT24694.md` (paperclip repo) - Inventory row: `docs/environments/03-lxc.md` — CT **241** ### Post-deploy smoke (this repo) From the Paperclip host (`10.10.50.17`) or any host on VLAN 1050: ```bash CT_IP=10.10.50.37 bash tools/proxmox/smoke_moneyflix_prod.sh ``` Direct checks: ```bash curl -sf http://10.10.50.37/health curl -sf http://10.10.50.37:8080/system/status curl -sf https://redirect.moneyflix.com/health ``` ## Architecture (guest) ``` Internet / Cloudflare │ ▼ NPM CT 102 (TLS) ──► CT 241 nginx :80 ──► Node redirector :3000 (systemd) └──► CT 241 nginx :8080 ──► PHP CRM (php8.1-fpm) └── MariaDB (local) ``` Example nginx shape on the guest (details live in the LXC install scripts / runbook): ```nginx # Redirector front (:80) — proxy to local Node location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } ``` ## Configuration ### Environment (placeholders only) Real values live in Infisical (CT 235) and on the guest at `/etc/moneyflix/moneyflix.env`. Never commit live secrets. ```bash # Example shape — use vault values in production CRM_API_URL=http://127.0.0.1:8080/api/redirects CRM_API_KEY= PORT=3000 NODE_ENV=production DB_HOST=127.0.0.1 DB_USER=moneyflix_app DB_PASS= DB_NAME=moneyflix ``` ### Repository layout ``` MoneyFlix/ ├── nodejs-redirector/ # Node redirector app ├── crm/ # PHP CRM (MoneyFlix copy) ├── tools/proxmox/ # LXC install + smoke_moneyflix_prod.sh ├── docs/ # Product docs index ├── README_MONEYFLIX.md # This file └── … ``` ## Deploy / update (CT 241) Preferred path: follow the Paperclip runbook. Short form inside the guest: ```bash ssh root@10.10.50.37 cd /opt/moneyflix git pull --ff-only origin master cd nodejs-redirector && npm ci --omit=dev cd ../crm && composer install --no-dev systemctl restart moneyflix-redirector systemctl reload nginx ``` Then re-run the smoke script from the Paperclip host. Legacy root scripts (`deploy-moneyflix.sh`, PM2 `ecosystem.config.*`) may still exist in the tree for historical reference — **do not** treat them as the production path. ## Redirects API - **LAN:** `http://10.10.50.37:8080/api/redirects` (CRM on :8080) - **Public redirector health:** `https://redirect.moneyflix.com/health` - **Auth:** `Authorization: Bearer ` (vault placeholder only in docs) Example: ```bash curl -sS 'http://10.10.50.37:8080/api/redirects' \ -H "Authorization: Bearer " \ -H 'Host: redirect.moneyflix.com' ``` ## Troubleshooting | Symptom | Check | |---------|--------| | Redirect missing / wrong | CRM API + DB; smoke script | | Redirector down | `systemctl status moneyflix-redirector` on CT 241 | | Public TLS / domain issues | NPM CT 102 proxy host → `10.10.50.37:80` | | CRM admin unreachable | nginx :8080 + php8.1-fpm on CT 241 | ```bash # On CT 241 systemctl status moneyflix-redirector nginx php8.1-fpm mariadb journalctl -u moneyflix-redirector -n 50 --no-pager # From Paperclip host CT_IP=10.10.50.37 bash /opt/bitreport/MoneyFlix/tools/proxmox/smoke_moneyflix_prod.sh ``` ## Monitoring - Smoke: `tools/proxmox/smoke_moneyflix_prod.sh` - Health: `http://10.10.50.37/health` and `https://redirect.moneyflix.com/health` - Logs: `journalctl -u moneyflix-redirector -f` (not PM2) ## Important notes 1. **Canonical prod is CT 241** (`10.10.50.37`) with systemd + nginx + NPM — not `94.23.75.89` / PM2. 2. **Zero credentials in Git** — placeholders only; secrets from Infisical / `/etc/moneyflix/moneyflix.env`. 3. **Limited scope** — MoneyFlix is a dedicated LXC stack; do not assume PMX expansibility. 4. Full ops detail: Paperclip runbook `MONEYFLIX_LXC_DEPLOY_BIT24694.md`. ## Support path 1. Run smoke script and capture PASS/FAIL lines. 2. Check `journalctl -u moneyflix-redirector` and nginx on CT 241. 3. Confirm NPM CT 102 upstream still points at `10.10.50.37:80` / `:8080`. 4. Escalate with smoke output + journal excerpts (no secrets).