Spaces:
Sleeping
Sleeping
File size: 3,379 Bytes
c506ed2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | # Deployment — Two Hugging Face Spaces
This project uses **two separate Hugging Face Spaces** so the live app stays stable while you build changes for a new client.
| Environment | Space | Git remote | Branch | URL |
|-------------|-------|------------|--------|-----|
| **Production** (current clients) | `coderuday21/satdetect` | `hf` | `production` | https://huggingface.co/spaces/coderuday21/satdetect |
| **Development** (new client work) | `coderuday21/satdetect-dev` | `hf-dev` | `master` | https://huggingface.co/spaces/coderuday21/satdetect-dev |
---
## One-time setup: create the dev Space
1. Open **https://huggingface.co/new-space**
2. Set:
- **Owner:** `coderuday21`
- **Space name:** `satdetect-dev`
- **SDK:** Docker
- **Visibility:** Public (or Private if you prefer)
3. Click **Create Space**.
Then add the dev remote (once):
```powershell
cd change_detection_webapp
git remote add hf-dev https://huggingface.co/spaces/coderuday21/satdetect-dev
```
If `hf-dev` already exists, update it:
```powershell
git remote set-url hf-dev https://huggingface.co/spaces/coderuday21/satdetect-dev
```
Push the current development code to the new Space:
```powershell
git push hf-dev master:main
```
Or run the helper script:
```powershell
.\scripts\push_hf_dev.ps1
```
---
## Branch strategy
```
production ──► hf (satdetect) — live app (no login; direct to detection)
master ──► hf-dev (satdetect-dev) — new client experiments and upcoming changes
```
- **`production`** — tracks the stable live release (currently same as `master`, no login).
- **`master`** — active development; push to the dev Space for testing before promoting to production.
Work on new client features on `master`. When ready for the live app, merge into `production` and push to `hf`.
---
## Deploy commands
### Production (live app — no login)
```powershell
git checkout production
git merge master
git push hf production:main
```
Or push `master` directly to production:
```powershell
git push hf master:main
```
Helper:
```powershell
.\scripts\push_hf_production.ps1
```
### Development (new client Space)
After every change you want on the dev Space:
```powershell
git checkout master
git push hf-dev master:main
```
Helper:
```powershell
.\scripts\push_hf_dev.ps1
```
---
## GitHub (optional mirror)
GitHub tracks `master` only:
```powershell
git push origin master
```
You can add a `production` branch on GitHub too:
```powershell
git push origin production
```
---
## Environment variables (both Spaces)
Set these in each Space’s **Settings → Repository secrets / Variables** if needed:
| Variable | Purpose |
|----------|---------|
| `SECRET_KEY` | Optional legacy JWT setting (login disabled) |
| `DATABASE_URL` | PostgreSQL instead of SQLite (optional) |
| `SMTP_USER` / `SMTP_PASS` | Email notifications via Gmail SMTP |
| `EMAIL_API_URL` | Custom email API (default in code) |
Dev Space can omit `SECRET_KEY` (login is disabled on both Spaces).
---
## Quick reference
```powershell
# Daily work (new client)
git checkout master
# ... edit code ...
git add .
git commit -m "Your message"
git push hf-dev master:main
# Update live app (only when ready)
git checkout production
git merge master # or cherry-pick specific commits
git push hf production:main
git checkout master
```
|