# Redeploy to your existing HF Space (do this now) Your Space already exists โ€” **reuse it**. You're just shipping today's commit (Neon persistence, moderator identity, token telemetry, warm redesign) to it. ~10 minutes. | What | Value | |---|---| | HF Space (page) | https://huggingface.co/spaces/Misbahuddin/amana | | HF Space (direct app URL) | https://misbahuddin-amana.hf.space *(confirm via the Space's โ‹ฎ โ†’ "Embed this Space")* | | Git remote for the Space | `hf` (already configured) | | GitHub remote | `origin` | | New commit to ship | `8e98f03` on `main` | --- ## 1. Add the new secret FIRST (before pushing) ๐Ÿ”‘ The only **new** config this release needs is the database. Add it before the rebuild so the new code boots with persistence on. In the Space โ†’ **Settings โ†’ Variables and secrets**: - [ ] Add **Secret** `DATABASE_URL` = your Neon **pooled** connection string (the host with `-pooler` in it). It's the same value that's in your local `.env`: `postgresql://neondb_owner:...@ep-...-pooler.c-3.us-east-1.aws.neon.tech/neondb?sslmode=require` - [ ] Confirm these already exist from your first deploy (add them if not): **Secret** `ANTHROPIC_API_KEY` ยท **Variable** `LLM_PROVIDER=anthropic`. - [ ] *(`PUBLIC_DEMO=1` is baked into the Dockerfile โ€” nothing to set.)* > Without `DATABASE_URL` the app still runs, but the audit log falls back to an in-container file that > resets on every rebuild. With it, decisions persist in Neon. --- ## 2. Push the commit ๐Ÿš€ ```powershell git push origin main # GitHub (source of truth) git push hf main # the Space โ€” this triggers a rebuild ``` - [ ] If HF rejects the push because histories diverged (the Space has its own commits): `git push hf main --force` (your repo is the source of truth). - [ ] Authentication: when git prompts, username = your HF username (`Misbahuddin`), password = an **HF access token** with **write** scope (huggingface.co โ†’ Settings โ†’ Access Tokens). If you pushed before, your credential is probably cached and it just works. --- ## 3. Watch the rebuild ๐Ÿ› ๏ธ - [ ] In the Space UI โ†’ **Logs / Building**: it rebuilds the image (Node build โ†’ Python โ†’ `build_index`) and flips to **Running**. First rebuild takes a few minutes. - [ ] If the build dies on a transient `huggingface.co โ€ฆ 429` during `build_index`, hit **Factory rebuild** or push an empty commit โ€” it's a rate-limit, not a bug. --- ## 4. Verify live โœ… On https://misbahuddin-amana.hf.space : - [ ] Console loads with the **warm redesign** (pine-green + gold, "Amana" seal in the header). - [ ] **camp-017** โ†’ APPROVE, **camp-005** โ†’ REJECT โ€” each verdict shows a **stamped seal** and a **token/latency** line beneath it. - [ ] **camp-015** โ†’ the **prompt-injection** banner + ESCALATE. - [ ] Decide a campaign: it requires a **moderator name** (remembered), and **History** shows "by <name>". An override forces a written reason. - [ ] **Persistence check:** click **Factory rebuild**, wait for Running, reopen โ†’ your earlier decisions are **still in History** (they're in Neon, not the container). --- ## 5. Stop it sleeping (keep-alive) ๐Ÿ’ค The repo now has `.github/workflows/keepalive.yml` (cron ping every 6h). Switch it on: - [ ] **GitHub repo โ†’ Settings โ†’ Secrets and variables โ†’ Actions โ†’ Variables** โ†’ add variable `SPACE_URL` = `https://misbahuddin-amana.hf.space`. - [ ] *(optional)* Actions tab โ†’ run **keepalive** once โ†’ expect HTTP 200. That's it โ€” free, persistent, awake, and on your existing URL.