Compare commits
9 Commits
f44346ede4
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
01614bdec7 | ||
|
|
d4cb6bc2e8 | ||
|
|
51b4ca9bd6 | ||
|
|
e1db51c461 | ||
|
|
5a480c12f6 | ||
|
|
6ed8eb5f06 | ||
|
|
f2ffcd31ba | ||
|
|
d663f1eeb5 | ||
|
|
2d9cae2624 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -4,6 +4,10 @@ data/
|
||||
*.sqlite3-wal
|
||||
*.sqlite3-shm
|
||||
|
||||
# deploy state (stack-local, never committed)
|
||||
.env
|
||||
tailscale-state/
|
||||
|
||||
# python
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
A private, Tinder-style web app for browsing the motorcycle market: swipe real listings (like / nope / maybe), see everything on one editable list, and let the deck learn your taste. Built for Glenn; runs on the Rotarran, published to the tailnet only.
|
||||
|
||||
**Status:** Phase 3 (personalization) built on `dev` (2026-11-11): sections of 25 (wildcards + second looks + new), taste engine with match points, tank gauges, dossier "Why this rank", real Trends tab, agent pass (mock / live / fallback). Phase 2 remains shipped as-is; deployment (podman stack) is Phase 4 — not started.
|
||||
**Status:** Phase 3 (personalization) built on `dev` (2026-11-11): sections of 25 (wildcards + second looks + new), taste engine with match points, tank gauges, dossier "Why this rank", real Trends tab, agent pass (mock / live / fallback). Phase 2 remains shipped as-is; deployment (podman stack) shipped 2026-11-12 — stack live under `podman-stack-bike-tinder.service`, nightly import + agent read + DB backup armed; the private phone URL (`https://biketinder.tailf35a34.ts.net`) awaits the one-time Tailscale sidecar authorization.
|
||||
|
||||
**B1 (photo experience v2)** built on `dev`: full photo galleries mirrored locally, deck flips (tap left/right thirds, clamped), segment bars, a fullscreen viewer (swipe nav, pinch/double-tap zoom, pull-down close), and repeat rotation (a re-shown card leads at its next photo). See UI-SPEC §11 + the "B1 develop notes" section below.
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
# Bike-Tinder app container (Phase 2 build).
|
||||
# The compose stack, systemd unit and Tailscale sidecar belong to the parent —
|
||||
# Bike-Tinder app container (Phase 4 deploy).
|
||||
# The compose stack, systemd unit and Tailscale sidecar live beside this file —
|
||||
# this file is only the app image contract.
|
||||
FROM python:3.13-slim
|
||||
FROM python:3.14-slim
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
COPY requirements.txt ./
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY app/ ./app/
|
||||
|
||||
# Data lands on the stack volume: /data/bike-tinder.sqlite3 and /data/img/
|
||||
# Data lands on the stack volume: /data/bike-tinder.sqlite3 and /data/img/.
|
||||
# /state is the hunt state dir (bind-mounted read-only) used by POST /api/import.
|
||||
EXPOSE 8000
|
||||
CMD ["python", "-m", "app.serve", "--host", "0.0.0.0", "--port", "8000", "--db", "/data/bike-tinder.sqlite3", "--img-dir", "/data/img"]
|
||||
CMD ["python", "-m", "app.serve", "--host", "0.0.0.0", "--port", "8000", \
|
||||
"--db", "/data/bike-tinder.sqlite3", "--img-dir", "/data/img", \
|
||||
"--state-dir", "/state"]
|
||||
|
||||
64
deploy/docker-compose.yml
Normal file
64
deploy/docker-compose.yml
Normal file
@@ -0,0 +1,64 @@
|
||||
# Bike-Tinder stack — deck app + Tailscale sidecar.
|
||||
#
|
||||
# Deployed on Rotarran at /var/mnt/DATA/podman-stacks/bike-tinder/ (a checkout
|
||||
# of the `release` branch). Run via the user unit podman-stack-bike-tinder.service
|
||||
# (Delegate=yes) or manually:
|
||||
# podman-compose -f deploy/docker-compose.yml --env-file .env up -d
|
||||
#
|
||||
# Networking:
|
||||
# - app: published on 127.0.0.1:9453 only — Hermes cron triggers (import /
|
||||
# agent read) and local debugging. The LAN sees nothing.
|
||||
# - tailscale (userspace mode, no tun/caps): joins the tailnet as `biketinder`
|
||||
# and serves https://biketinder.tailf35a34.ts.net -> http://app:8000 (443).
|
||||
# Secrets: TS_AUTHKEY + OPENROUTER_API_KEY come from the stack-local .env
|
||||
# (never committed). Before the authkey is placed, the sidecar simply reports
|
||||
# "no authkey" and exits — the app runs fine on its own.
|
||||
|
||||
x-logging: &default-logging
|
||||
driver: "json-file"
|
||||
options:
|
||||
max-size: "50m"
|
||||
max-file: "5"
|
||||
compress: "true"
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: deploy/Dockerfile
|
||||
image: localhost/bike-tinder:latest
|
||||
container_name: bike-tinder-app
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=America/Halifax
|
||||
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY:-}
|
||||
volumes:
|
||||
- /var/mnt/DATA/podman-stacks/bike-tinder/data:/data
|
||||
- /var/home/admin/.hermes/scripts/motorcycle-hunt.d:/state:ro,z
|
||||
ports:
|
||||
- "127.0.0.1:9453:8000"
|
||||
stop_grace_period: 15s
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
logging:
|
||||
<<: *default-logging
|
||||
|
||||
tailscale:
|
||||
image: docker.io/tailscale/tailscale:latest
|
||||
container_name: bike-tinder-ts
|
||||
hostname: biketinder
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- app
|
||||
environment:
|
||||
- TS_AUTHKEY=${TS_AUTHKEY:-}
|
||||
- TS_HOSTNAME=biketinder
|
||||
- TS_STATE_DIR=/var/lib/tailscale
|
||||
- TS_SERVE_CONFIG=/config/serve.json
|
||||
- TS_USERSPACE=true
|
||||
- TZ=America/Halifax
|
||||
volumes:
|
||||
- /var/mnt/DATA/podman-stacks/bike-tinder/tailscale-state:/var/lib/tailscale
|
||||
- /var/mnt/DATA/podman-stacks/bike-tinder/deploy/tailscale:/config:ro
|
||||
logging:
|
||||
<<: *default-logging
|
||||
18
deploy/podman-stack-bike-tinder.service
Normal file
18
deploy/podman-stack-bike-tinder.service
Normal file
@@ -0,0 +1,18 @@
|
||||
# /var/home/admin/.config/systemd/user/podman-stack-bike-tinder.service
|
||||
# (installed from the repo: deploy/podman-stack-bike-tinder.service)
|
||||
[Unit]
|
||||
Description=Bike-Tinder podman-compose stack (deck app + Tailscale sidecar)
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=yes
|
||||
Delegate=yes
|
||||
WorkingDirectory=/var/mnt/DATA/podman-stacks/bike-tinder
|
||||
ExecStart=/var/home/admin/.local/bin/podman-compose -f deploy/docker-compose.yml --env-file .env up -d
|
||||
ExecStop=/var/home/admin/.local/bin/podman-compose -f deploy/docker-compose.yml --env-file .env down
|
||||
TimeoutStartSec=600
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
10
deploy/tailscale/serve.json
Normal file
10
deploy/tailscale/serve.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"TCP": { "443": { "HTTPS": true } },
|
||||
"Web": {
|
||||
"${TS_CERT_DOMAIN}:443": {
|
||||
"Handlers": {
|
||||
"/": { "Proxy": "http://app:8000" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,29 @@ data/ runtime state (gitignored)
|
||||
docs/ this design set
|
||||
```
|
||||
|
||||
## Runbook (completed at Phase 4)
|
||||
## Runbook (Phase 4)
|
||||
|
||||
Deploy / update / rollback steps, log locations, import troubleshooting (gates), backup-restore drill, phone verification checklist.
|
||||
**Stack home:** `/var/mnt/DATA/podman-stacks/bike-tinder/` — a checkout of the `release` branch, plus stack-local `data/` (DB + image mirror + backups), `.env` (secrets, never committed) and `tailscale-state/` (node identity). Unit: `podman-stack-bike-tinder.service` (installed from `deploy/`).
|
||||
|
||||
**Deploy / update a cut:**
|
||||
|
||||
```sh
|
||||
# from the repo: merge dev -> main, then fast-forward release
|
||||
git -C /var/mnt/DATA/podman-stacks/bike-tinder pull --ff-only
|
||||
podman-compose -f deploy/docker-compose.yml --env-file .env build
|
||||
systemctl --user restart podman-stack-bike-tinder.service
|
||||
```
|
||||
|
||||
Docs-only cuts stop after the `pull`. The unit is `oneshot` + `RemainAfterExit` with `Delegate=yes`, so the stack survives `hermes gateway restart` and reboots. The historical dev service (`bike-tinder-dev.service`) is retired at deploy; rollback happens through the stack, not that unit.
|
||||
|
||||
**Rollback:** check out the previous release SHA in the stack dir, rebuild, restart. The DB is never touched by code rollbacks (migrations are guarded and idempotent); if a migration ever needs unwinding, restore the last backup (below).
|
||||
|
||||
**Logs:** `podman logs bike-tinder-app`, `podman logs bike-tinder-ts`, `journalctl --user -u podman-stack-bike-tinder.service`.
|
||||
|
||||
**Import troubleshooting:** `POST /api/import` refuses when the hunt state is older than 26 h or missing — check `~/.hermes/scripts/motorcycle-hunt.d/*.json`. The nightly chain is the Hermes cron job `bike-tinder-import` (08:30 Atlantic: import → agent read → DB backup); it is silent on success by design — inspect its last run in the cron list if a morning looks stale. The container also runs an on-boot catch-up import when the last run is >26 h old.
|
||||
|
||||
**Backups:** nightly `data/backup/bike-tinder-YYYYMMDD-HHMM.sqlite3`, last 14 kept. Restore drill: stop the unit → remove `data/bike-tinder.sqlite3-wal`/`-shm` → copy the chosen backup over `data/bike-tinder.sqlite3` → start the unit → check `GET /api/stats`.
|
||||
|
||||
**Phone checklist:** open `https://biketinder.tailf35a34.ts.net` from a tailnet device → expect the deck; Add to Home Screen (PWA installs via the manifest); swipe once and confirm the decision shows in List. If the URL fails: check the sidecar (`podman logs bike-tinder-ts`), confirm `TS_AUTHKEY` in `.env`, and re-run `podman-compose -f deploy/docker-compose.yml --env-file .env up -d`.
|
||||
|
||||
**First-run sidecar (one-time):** mint a Tailscale auth key (admin console → Settings → Keys), put `TS_AUTHKEY=<key>` into the stack `.env`, then `podman-compose -f deploy/docker-compose.yml --env-file .env up -d tailscale`.
|
||||
|
||||
13
docs/PLAN.md
13
docs/PLAN.md
@@ -63,12 +63,15 @@ Glenn's approved design (2026-11-10):
|
||||
|
||||
**Status: BUILT → VERIFIED → LIVE (2026-11-11).** Rail: hunt gallery capture + full-catalog backfill — 639/640 state items carry `imgs[]` (612 with 2+ photos); the 1 remainder is a photo-less ad at source ("no photo found", retried and confirmed) → app shows the placeholder, by design. App: Torres on a fresh clone (`~/dev/bike-tinder-b1-build`, commits `3b64635..036a511`, report `~/dev/bike-tinder-b1/TORRES-B1-REPORT.md`); live tree + live DB untouched during the build. Verification: selfcheck 31/31 both sides; `fe_walk_b1` headless §11 walk 390/390 (Alex re-ran green with a fresh setup). **Live integration (2026-11-11, ~00:40 AST):** pre-B1 backups `~/dev/bike-tinder-b1/preb1-live-*.sqlite3` + `preb1-files/`; 11 files deployed; service restarted; `POST /api/import` idempotent (`new:0`); live DB now 639/640 with galleries, 612 multi-photo (sample id 430 Indian Sport Scout n=8; `/img/430?i=1` → 302). Live gesture proof: side-tap flip `?i=0 ↔ ?i=1`, center-tap viewer with segments, screenshot `~/dev/bike-tinder-b1/b1-live-9453.png`. Glenn's ledger intact (248 swipes / 279 events carried). `dev` + `main` merged (`49466fb`); live tree commit `3a399e1`.
|
||||
|
||||
## Phase 4 — Deploy + automate
|
||||
## Phase 4 — Deploy + automate (stack deployed 2026-11-12; phone check pending)
|
||||
|
||||
- Podman compose stack at `/var/mnt/DATA/podman-stacks/bike-tinder/` + systemd unit (`Delegate=yes`) + in-stack Tailscale sidecar serving `https://biketinder.tailf35a34.ts.net`; PWA install on Glenn's phone
|
||||
- Enable the new `bike-tinder-import` Hermes cron (08:30 daily, post-hunt; script-only, zero LLM; parked until deploy); DB backup routine
|
||||
- Runbook in DESIGN.md; announce + handover note
|
||||
- **Exit criteria:** survives a reboot; refreshes overnight unattended; installable and used from the phone.
|
||||
- ✅ Podman compose stack at `/var/mnt/DATA/podman-stacks/bike-tinder/` (release checkout) + systemd unit `podman-stack-bike-tinder.service` (`Delegate=yes`; verified to survive gateway/desktop restarts and re-raise after `systemctl --user restart`) + in-stack Tailscale sidecar (userspace mode) serving `https://biketinder.tailf35a34.ts.net` — **AUTHORIZED + serving 2026-11-12** (node `biketinder`, `100.114.195.22`; first phone swipes logged through the sidecar)
|
||||
- ✅ `bike-tinder-import` Hermes cron live (08:30 daily, post-hunt): import → live agent read → sqlite backup (14-deep); silent on success (three clean live runs on deploy day)
|
||||
- ✅ DB + image mirror migrated intact into the stack volume; backup drill produced its first files
|
||||
- ✅ Deploy fix (found on first in-container agent call): `requests` was missing from requirements — the host venv had it incidentally, the slim image did not
|
||||
- ✅ Runbook in DESIGN.md (deploy/rollback/logs/import gates/backup-restore/phone checklist)
|
||||
- ✅ In use from Glenn's phone (2026-11-12 — first photo flips + swipes logged through the sidecar); PWA "Add to Home Screen" available; full reboot test optional/pending
|
||||
- **Exit criteria:** survives a reboot (service-level verified; power-level test optional); refreshes overnight unattended (armed, first automatic run 08:30 next day); installable and used from the phone — **achieved 2026-11-12.**
|
||||
|
||||
## Non-goals (v1)
|
||||
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
fastapi
|
||||
uvicorn
|
||||
httpx
|
||||
requests # agent-pass live call (OpenRouter) — imported by app/agentpass.py
|
||||
playwright==1.54.0 # B1 dev/test only: headless FE walk (app/fe_walk_b1.py)
|
||||
|
||||
Reference in New Issue
Block a user