docs(#11): WOO_BASE_URL in compose, HTTPS-only, Settings read-only
Check in implementable deploy/docker-compose.yml, .env.example, and Caddy fragment. Store URL is env SoT (not a settings row). Application Password setup stays in DEPLOYMENT §5 (issue #5).
This commit is contained in:
+2
-1
@@ -175,9 +175,10 @@ authoritative source for tag definitions; this table caches synced Woo tags.
|
||||
| `updated_at` | TEXT | |
|
||||
|
||||
Keys (server settings; secrets encrypted at rest):
|
||||
- `woo_base_url`, `woo_wp_username`, `woo_app_password`
|
||||
- `woo_wp_username`, `woo_app_password`
|
||||
(username + WordPress application password for a dedicated low-priv WP user;
|
||||
not WooCommerce consumer keys)
|
||||
- Store URL is **not** a settings row: `WOO_BASE_URL` env (compose), HTTPS only
|
||||
- `inference_base_url`, `inference_api_key`, `inference_model`
|
||||
- `inference_enabled`, `content_llm_enabled`
|
||||
- `brand_voice`, `geo_context`
|
||||
|
||||
+25
-28
@@ -41,7 +41,7 @@ SlabUploader/
|
||||
│ ├── docker-compose.yml
|
||||
│ ├── Caddyfile.fragment # slab site block (merged into host Caddy)
|
||||
│ ├── INVENTORY.md # filled at Gate B on the designated host
|
||||
│ ├── .env.example # SLAB_AES_KEY, APP_*, port vars (no real secrets)
|
||||
│ ├── .env.example # SLAB_AES_KEY, APP_*, WOO_BASE_URL (https only)
|
||||
│ └── backup.sh # sqlite .backup + images tar, with retention
|
||||
├── frontend/ # SvelteKit app
|
||||
└── backend/ # FastAPI app
|
||||
@@ -58,33 +58,29 @@ SlabUploader/
|
||||
└── Dockerfile
|
||||
```
|
||||
|
||||
## 3. docker-compose.yml (target shape)
|
||||
## 3. docker-compose.yml (checked in)
|
||||
|
||||
```yaml
|
||||
services:
|
||||
frontend:
|
||||
build: ./frontend
|
||||
ports: ["127.0.0.1:${FRONTEND_PORT:-18080}:80"] # Caddy-only; not public
|
||||
depends_on: [fastapi]
|
||||
restart: unless-stopped
|
||||
Canonical file: `deploy/docker-compose.yml`. Placeholders: `deploy/.env.example`.
|
||||
From **repo root**:
|
||||
|
||||
fastapi:
|
||||
build: ./backend
|
||||
environment:
|
||||
SLAB_AES_KEY: ${SLAB_AES_KEY} # from .env (32-byte base64)
|
||||
# no Woo/inference keys here — they live encrypted in SQLite (Settings UI)
|
||||
volumes:
|
||||
- slab_db:/data
|
||||
- slab_images:/images
|
||||
- ./prompts:/app/prompts:ro # prompt files, read-only mount
|
||||
ports: ["127.0.0.1:${FASTAPI_PORT:-18081}:8000"] # Caddy-only
|
||||
mem_limit: 2g # env convention: mem_limit preferred
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
slab_db:
|
||||
slab_images:
|
||||
```
|
||||
cp deploy/.env.example deploy/.env && chmod 600 deploy/.env
|
||||
# fill SLAB_AES_KEY, APP_HOSTNAME, WOO_BASE_URL (https:// only)
|
||||
docker compose -f deploy/docker-compose.yml --env-file deploy/.env up -d
|
||||
```
|
||||
|
||||
Caddy site block: `deploy/Caddyfile.fragment` (merge into host Caddy). Compose
|
||||
service names `frontend` and `fastapi` must match that fragment.
|
||||
|
||||
**`WOO_BASE_URL` (issue #11 — plan of record):**
|
||||
|
||||
- Set in `deploy/.env` and injected into the FastAPI container at start.
|
||||
- **HTTPS only.** FastAPI must refuse missing / `http://` values at startup.
|
||||
- Not a Settings input and **not** a SQLite settings row.
|
||||
- Settings UI shows the URL as **read-only** text (which store this deploy hits).
|
||||
- Change store = edit `.env` + recreate the fastapi container.
|
||||
|
||||
Woo Application Password stays out of compose (AES-GCM via Settings; issue #5).
|
||||
|
||||
Conventions (house rules):
|
||||
|
||||
@@ -95,8 +91,8 @@ Conventions (house rules):
|
||||
|
||||
## 4. Caddy (fragment)
|
||||
|
||||
API must win over the frontend catch-all. Put `handle /api/*` **before** the frontend
|
||||
`handle` block:
|
||||
Canonical file: `deploy/Caddyfile.fragment`. API must win over the frontend
|
||||
catch-all. Put `handle /api/*` **before** the frontend `handle` block:
|
||||
|
||||
```caddyfile
|
||||
{$APP_HOSTNAME} {
|
||||
@@ -121,7 +117,8 @@ API must win over the frontend catch-all. Put `handle /api/*` **before** the fro
|
||||
|
||||
| Secret | Where | Notes |
|
||||
|---|---|---|
|
||||
| `SLAB_AES_KEY` | `.env` on host (mode 600) → compose env | 32-byte base64; NEVER in the repo |
|
||||
| `SLAB_AES_KEY` | `deploy/.env` (mode 600) → compose env | 32-byte base64; NEVER in the repo |
|
||||
| `WOO_BASE_URL` | `deploy/.env` → compose → FastAPI env | `https://` only; Settings **read-only** |
|
||||
| Woo WP username + application password | SQLite `settings` (AES-GCM) via Settings UI | dedicated low-priv WP user; not consumer keys |
|
||||
| Inference API key | SQLite `settings` (AES-GCM) via Settings UI | usually empty for local llama.cpp |
|
||||
| `.env.example` | repo | placeholders only, committed |
|
||||
|
||||
+4
-2
@@ -120,7 +120,7 @@ the call returns. WooCommerce is the authoritative source for `feat-*` definitio
|
||||
|
||||
### SettingsView (read; secrets masked)
|
||||
```jsonc
|
||||
{ "woo_base_url": "https://www.whidbeywoodstore.com",
|
||||
{ "woo_base_url": "https://www.whidbeywoodstore.com", // WOO_BASE_URL env; read-only
|
||||
"woo_wp_username": "slab-uploader", // non-secret identity; password never returned
|
||||
"woo_credentials_configured": true,
|
||||
"inference_base_url": "http://192.168.1.202:8080/v1",
|
||||
@@ -209,6 +209,8 @@ Sheet/slider prefs are client localStorage only in POC (not in SettingsView).
|
||||
### Settings
|
||||
- `GET /api/v1/settings` → `200` `SettingsView`
|
||||
- `PUT /api/v1/settings` — Update settings. Body: partial `{ key: value }`.
|
||||
- `woo_base_url` is **not** writable (ignore or `422`). SoT is `WOO_BASE_URL`
|
||||
env (HTTPS, compose). GET still returns it for read-only Settings text.
|
||||
- Woo credential keys: `woo_wp_username` (plain) and `woo_app_password`
|
||||
(write-only; AES-GCM at rest). Reject any payload that still sends
|
||||
`woo_consumer_key` / `woo_consumer_secret`.
|
||||
@@ -216,7 +218,7 @@ Sheet/slider prefs are client localStorage only in POC (not in SettingsView).
|
||||
never echoed).
|
||||
- `POST /api/v1/settings/test-woo` → `200` `{ "ok": bool, "detail": "..." }`
|
||||
- Uses stored username + application password over HTTPS Basic Auth against
|
||||
the store REST v3 base. Fails closed if credentials missing or store HTTP.
|
||||
`WOO_BASE_URL` REST v3. Fails closed if credentials missing or URL is not https.
|
||||
- `POST /api/v1/settings/test-inference` → `200` `{ "ok": bool, "vision_capable": bool, "detail": "..." }`
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user