--- name: deploy-massprice description: Use when deploying MassPrice Scheduler, restarting the massprice container on Unraid, confirming a deploy landed, logging into MassPrice via the Session page, or troubleshooting its scheduled-rule automation. --- ## Deployment **Target:** Unraid server, container path `/mnt/user/appdata/massprice`, built from `Dockerfile`/`docker-compose.yml` in this repo. Container name `massprice`, port `5057` (overridable via `HOST_PORT` — `5056` was already taken by `arr-summary`, despite its own docs saying `5055`) → container port `5000`. **Deploy mechanism: Forgejo push-to-deploy**, the same pattern as `arr-summary`, `card-grader`, `lunch-notifier`, `n64-tracker` — see `arr-summary`'s `deploy-arr-summary` skill or `card-grader`'s `CLAUDE.md` for the full runner mechanics. Push to `main` on the `forgejo` remote (`https://git.hippofam.com/ninja_hippo/massprice.git`) triggers `.forgejo/workflows/deploy.yml`, which syncs into `/mnt/user/appdata/massprice` (excluding `.git`, `.env`, `data/`) and runs `docker compose up -d --build`. **Restarting the container manually: use Compose, not the Unraid Docker UI** — same reasoning as the other projects (every deploy recreates the container with a new Docker ID; Unraid's UI caches the old one). From the Unraid terminal: ```bash cd /mnt/user/appdata/massprice && docker compose restart ``` `docker compose up -d --force-recreate` for a guaranteed-clean recreate; `docker ps --filter name=massprice` to check real state. **Confirming a deploy landed:** the footer renders `v · ` from constants near the top of `app.py`. Bump them every commit. ## First deploy checklist 1. Create `/mnt/user/appdata/massprice` on Unraid and a real `.env` there (copy `.env.example`, fill in `LOGIN_PASSWORD`, `SECRET_KEY`, `HOST_PORT`, `TZ` — and optionally `GMAIL_USER`/`GMAIL_APP_PASSWORD`/ `ALERT_EMAIL` for the session-expiry email alert, same Gmail-app- password pattern as `lunch-notifier`). 2. First `docker compose up -d --build` — confirm the container starts and `/login` responds on `HOST_PORT`. 3. Log into the webui, go to the **Session** page, and follow its instructions: log into massprice.tcgplayer.com in your own regular Chrome, export its cookies with the Cookie-Editor extension, paste them into the box, and click "Import Session". MassPrice's login is behind hCaptcha, which blocks any form of automated login (confirmed by testing — see `CLAUDE.md`), so this manual export is the only path in, and needs repeating whenever the session eventually expires. 4. Click "Refresh Rules" on the Dashboard — confirms the saved session actually works and pulls the real rule list. 5. Set up at least one schedule and use "Run Now" once to confirm a click actually lands — cross-check by looking at MassPrice's own Activity Log (`https://massprice.tcgplayer.com/Activity/List`) for a fresh timestamp on that rule. 6. **Only after step 5 succeeds**, go to each existing rule on massprice.tcgplayer.com (three-dot menu → Edit Schedule) and set Status to Inactive, so native scheduling stops double-triggering runs and this tool becomes the sole source of scheduled runs. ## Persistent state, never touched by deploys `.env` holds `LOGIN_PASSWORD`, `SECRET_KEY`, and (optionally) `GMAIL_USER`/`GMAIL_APP_PASSWORD`/`ALERT_EMAIL`. `data/` (bind-mounted to `/data`) holds `schedules.json` (the schedules set from the webui), `auth_state.json` (the saved MassPrice session imported via the Session page — a live bearer credential for the user's MassPrice account while valid, see `CLAUDE.md`; losing this just costs one re-import, not data), `run_history.json`, `rules_cache.json`, and `notify_state.json` (the session-expiry alert's send-once dedupe flag). Both are excluded from the deploy rsync (which runs `--delete`) and from git. ## If scheduled runs stop working Check, in order: 1. **Dashboard banner / Activity page** — a "session expired or missing" message means go log in again via the Session page. "rule id not found" means a rule was renamed/deleted on MassPrice — click "Refresh Rules". 2. **Is the container still running** — `docker ps --filter name=massprice` — a Chromium crash inside the container (rare, but possible if `shm_size` ever gets dropped from `docker-compose.yml`) would show as the container restarting. 3. **Timezone** — `TZ` in `.env` controls what "6:00 AM" means for every schedule; confirm it matches what the user actually expects before assuming a schedule itself is wrong. 4. **Session import fails with "didn't authenticate"** — the export was probably taken from the wrong tab or before login finished. Re-export only after you're actually looking at massprice.tcgplayer.com's own Dashboard/Rules pages, not the login page or `store.tcgplayer.com`. 5. **Session import fails with "none of the pasted cookies are for tcgplayer.com"** — the extension exported the wrong site's cookies; make sure the active tab was massprice.tcgplayer.com when you clicked Export.