1.9 KiB
Development and tests
Run npm test before every commit and whenever changing authentication, API authorization, service-worker behavior, or persistence. Add a regression test under test/ for every new route and for every security/ownership bug. Tests use an in-memory PostgreSQL-compatible database; production migration is run automatically at startup against DATABASE_URL.
Every change pushed to the remote must be deployed to the Unraid Docker service immediately afterward. Verify the deployed container is healthy and the production endpoint responds before reporting completion. Production runs from /mnt/user/dev/roast_command_center on xNAS. The Gitea Actions runner is the gitea-act-runner container (registered as unraid-roast-deployer); use it for the eventual push-to-master test/deploy workflow. Do not create duplicate runners, and never expose a runner registration token in a command, log, or commit.
Docker builds run scripts/stamp-asset-version.mjs, which replaces __ASSET_VERSION__ in browser assets and the service-worker cache. Keep those markers intact: each build must produce fresh CSS/JS URLs so Cloudflare cannot serve a mixed stale frontend. The Docker entrypoint copies the read-only PI_AGENT_CONFIG_DIR seed mounted at /run/pi-agent-config into writable /home/node/.pi/agent; Pi locks auth.json at runtime, so do not mount that directory directly over the runtime path or prefill will lose configured model credentials.
For local development, copy .env.example, start docker compose up --build, then visit http://localhost:8090. Production must set APP_ORIGIN=https://roast.srmr.xyz, COOKIE_SECURE=true, a strong POSTGRES_PASSWORD, and a random BOOTSTRAP_SETUP_TOKEN. Bootstrap [email protected] exactly once at POST /api/auth/bootstrap, then remove BOOTSTRAP_SETUP_TOKEN from deployment configuration. Never commit credentials or a bootstrap password/token.