Misbahuddin Claude Opus 4.8 commited on
Commit
0ae7bbd
·
1 Parent(s): 8e98f03

docs: add REDEPLOY guide for the existing HF Space; fix DEPLOY remote name

Browse files

The Space already exists (remote `hf` → Misbahuddin/amana). REDEPLOY.md is the
short "ship today's commit to the Space you already have" path; DEPLOY.md §6
updated to use the real `hf` remote and the DATABASE_URL secret.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Files changed (2) hide show
  1. DEPLOY.md +8 -5
  2. REDEPLOY.md +82 -0
DEPLOY.md CHANGED
@@ -98,18 +98,21 @@ In the Space → **Settings → Variables and secrets**:
98
 
99
  ## 6. Push the repo to the Space 🚀
100
 
101
- The Space is its own git repo; push your `main` to it. You'll authenticate with an **HF access token**
 
102
  (huggingface.co → Settings → Access Tokens → create one with **write** scope; use it as the password
103
  when git prompts, username = your HF username).
104
 
 
 
 
105
  ```powershell
106
- git remote add space https://huggingface.co/spaces/<your-username>/amana
107
  git checkout main
108
- git push space main
109
  ```
110
 
111
- - [ ] If HF rejects the push because the Space already has an initial commit, force it (your repo is
112
- the source of truth): `git push space main --force`
113
  - [ ] In the Space UI, watch **Logs / Building** → it builds the image (Node build → Python →
114
  `build_index`) and then **Running**. First build takes a few minutes.
115
  - [ ] If the build fails on a transient `429` during `build_index`, click **Factory rebuild** / push
 
98
 
99
  ## 6. Push the repo to the Space 🚀
100
 
101
+ The Space is its own git repo; push your `main` to it. The remote is already configured as **`hf`**
102
+ (`https://huggingface.co/spaces/Misbahuddin/amana`). You'll authenticate with an **HF access token**
103
  (huggingface.co → Settings → Access Tokens → create one with **write** scope; use it as the password
104
  when git prompts, username = your HF username).
105
 
106
+ > **Reusing an existing Space?** That's the normal case here — see **`REDEPLOY.md`** for the short
107
+ > redeploy path (it's just steps 5–7 against the Space you already have).
108
+
109
  ```powershell
 
110
  git checkout main
111
+ git push hf main # remote `hf` already exists; this triggers a rebuild
112
  ```
113
 
114
+ - [ ] If HF rejects the push because the Space already has commits, force it (your repo is the source
115
+ of truth): `git push hf main --force`
116
  - [ ] In the Space UI, watch **Logs / Building** → it builds the image (Node build → Python →
117
  `build_index`) and then **Running**. First build takes a few minutes.
118
  - [ ] If the build fails on a transient `429` during `build_index`, click **Factory rebuild** / push
REDEPLOY.md ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Redeploy to your existing HF Space (do this now)
2
+
3
+ Your Space already exists — **reuse it**. You're just shipping today's commit (Neon persistence,
4
+ moderator identity, token telemetry, warm redesign) to it. ~10 minutes.
5
+
6
+ | What | Value |
7
+ |---|---|
8
+ | HF Space (page) | https://huggingface.co/spaces/Misbahuddin/amana |
9
+ | HF Space (direct app URL) | https://misbahuddin-amana.hf.space *(confirm via the Space's ⋮ → "Embed this Space")* |
10
+ | Git remote for the Space | `hf` (already configured) |
11
+ | GitHub remote | `origin` |
12
+ | New commit to ship | `8e98f03` on `main` |
13
+
14
+ ---
15
+
16
+ ## 1. Add the new secret FIRST (before pushing) 🔑
17
+
18
+ The only **new** config this release needs is the database. Add it before the rebuild so the new code
19
+ boots with persistence on.
20
+
21
+ In the Space → **Settings → Variables and secrets**:
22
+
23
+ - [ ] Add **Secret** `DATABASE_URL` = your Neon **pooled** connection string (the host with `-pooler`
24
+ in it). It's the same value that's in your local `.env`:
25
+ `postgresql://neondb_owner:...@ep-...-pooler.c-3.us-east-1.aws.neon.tech/neondb?sslmode=require`
26
+ - [ ] Confirm these already exist from your first deploy (add them if not):
27
+ **Secret** `ANTHROPIC_API_KEY` · **Variable** `LLM_PROVIDER=anthropic`.
28
+ - [ ] *(`PUBLIC_DEMO=1` is baked into the Dockerfile — nothing to set.)*
29
+
30
+ > Without `DATABASE_URL` the app still runs, but the audit log falls back to an in-container file that
31
+ > resets on every rebuild. With it, decisions persist in Neon.
32
+
33
+ ---
34
+
35
+ ## 2. Push the commit 🚀
36
+
37
+ ```powershell
38
+ git push origin main # GitHub (source of truth)
39
+ git push hf main # the Space — this triggers a rebuild
40
+ ```
41
+
42
+ - [ ] If HF rejects the push because histories diverged (the Space has its own commits):
43
+ `git push hf main --force` (your repo is the source of truth).
44
+ - [ ] Authentication: when git prompts, username = your HF username (`Misbahuddin`), password = an
45
+ **HF access token** with **write** scope (huggingface.co → Settings → Access Tokens). If you
46
+ pushed before, your credential is probably cached and it just works.
47
+
48
+ ---
49
+
50
+ ## 3. Watch the rebuild 🛠️
51
+
52
+ - [ ] In the Space UI → **Logs / Building**: it rebuilds the image (Node build → Python →
53
+ `build_index`) and flips to **Running**. First rebuild takes a few minutes.
54
+ - [ ] If the build dies on a transient `huggingface.co … 429` during `build_index`, hit **Factory
55
+ rebuild** or push an empty commit — it's a rate-limit, not a bug.
56
+
57
+ ---
58
+
59
+ ## 4. Verify live ✅
60
+
61
+ On https://misbahuddin-amana.hf.space :
62
+
63
+ - [ ] Console loads with the **warm redesign** (pine-green + gold, "Amana" seal in the header).
64
+ - [ ] **camp-017** → APPROVE, **camp-005** → REJECT — each verdict shows a **stamped seal** and a
65
+ **token/latency** line beneath it.
66
+ - [ ] **camp-015** → the **prompt-injection** banner + ESCALATE.
67
+ - [ ] Decide a campaign: it requires a **moderator name** (remembered), and **History** shows
68
+ "by &lt;name&gt;". An override forces a written reason.
69
+ - [ ] **Persistence check:** click **Factory rebuild**, wait for Running, reopen → your earlier
70
+ decisions are **still in History** (they're in Neon, not the container).
71
+
72
+ ---
73
+
74
+ ## 5. Stop it sleeping (keep-alive) 💤
75
+
76
+ The repo now has `.github/workflows/keepalive.yml` (cron ping every 6h). Switch it on:
77
+
78
+ - [ ] **GitHub repo → Settings → Secrets and variables → Actions → Variables** → add variable
79
+ `SPACE_URL` = `https://misbahuddin-amana.hf.space`.
80
+ - [ ] *(optional)* Actions tab → run **keepalive** once → expect HTTP 200.
81
+
82
+ That's it — free, persistent, awake, and on your existing URL.