--- name: deploy-massprice description: Use when deploying MassPrice Scheduler, restarting the massprice container on Unraid, confirming a deploy landed, 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 `5056` (overridable via `HOST_PORT`) → 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` — create this repo on the Forgejo instance first if it doesn't exist yet) 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`, `MASSPRICE_USERNAME`, `MASSPRICE_PASSWORD`, `TZ`). 2. First `docker compose up -d --build` — confirm the container starts and `/login` responds on `HOST_PORT`. 3. Log into the webui, click "Refresh Rules" — confirms Playwright can reach massprice.tcgplayer.com and log in automatically. **If this fails**, check `data/run_history.json`/container logs for the login error — the login form locators in `automation._login()` were written generically (never verified against the real logged-out form, see `CLAUDE.md`) and may need adjusting to match TCGplayer's actual field names/labels. 4. 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. 5. **Only after step 4 succeeds**, go to each of the 5 existing rules 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 the MassPrice credentials. `data/` (bind-mounted to `/data`) holds `schedules.json` (the schedules set from the webui), `auth_state.json` (the saved MassPrice browser session — losing this just costs one re-login, not data), `run_history.json`, and `rules_cache.json`. Both are excluded from the deploy rsync (which runs `--delete`) and from git. ## If scheduled runs stop working Check, in order: 1. **Activity page in the webui** — does the failure message say "still on a login page" (credentials/CAPTCHA problem) or "rule id not found" (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.