amana / REDEPLOY.md
Misbahuddin's picture
docs: add REDEPLOY guide for the existing HF Space; fix DEPLOY remote name
0ae7bbd
|
Raw
History Blame Contribute Delete
3.64 kB
# 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.