Files
proof-of-work/start9/0.4/README.md
T
Keysat aa407b5f67 Rebrand to Proof of Work; multi-user 0.4 package with curated library sync
Repo cleanup
- Add top-level .gitignore (was missing; node_modules, .next, *.s9pk,
  image.tar, seed/data/*.db, log files, etc.) and a root README.
- Delete legacy start9/0.3.5/ package (StartOS 0.3.5 wrapper, no longer
  the deploy target).
- Delete start9-example-packaging/ (template from another project).
- Delete planning docs (START9_PACKAGING_LOG.md, VERSIONING.md,
  STARTOS_0.4_UPGRADE_PROMPT.md, ICON_FILES_INDEX.md, etc.) — info now
  lives in the deploy guide and code comments.
- Drop the standalone Dockerfile, docker-compose.yml, ICON_*, and dev
  log/build artifacts from the app dir.
- Drop the v0.1.0:18/19/20 version files (they belonged to the legacy
  workout-log package and don't apply to the new id).

Rename + new package
- Rename app dir workout-planner/ -> proof-of-work/.
- Rename StartOS package id workout-log -> proof-of-work; the new id
  makes this a brand new StartOS service (clean cutover from the old
  one rather than in-place upgrade).
- Reset version graph; v1.0.0:1 is the seeded cutover release. The
  Dockerfile bakes a one-time /data snapshot and docker_entrypoint.sh
  copies it into the new volume on truly-fresh first boot only (both
  /data/app.db missing AND /data/.seeded absent).
- Move start9/0.4-migration/ -> start9/0.4/; the old start9/0.4/ stub
  is gone.

Curated exercise library (multi-user-aware)
- proof-of-work/prisma/exercises.seed.json is the canonical library
  shipped to every install (164 exercises today, dumped from the live
  snapshot).
- proof-of-work/scripts/sync-library.cjs (npm run sync-library) refreshes
  the JSON from start9/0.4/seed/data/app.db after refresh_seed.sh.
- proof-of-work/prisma/seed.ts now reads from the JSON instead of a
  hardcoded 52-exercise array; runs at Docker build time to seed the
  fallback DB and on first boot for fresh installs.
- proof-of-work/prisma/ensureExerciseLibrary.cjs runs on every container
  boot (from docker_entrypoint.sh) and INSERT OR IGNOREs every library
  entry for every user, keyed on (userId, name). Library updates flow
  to existing installs on package upgrade; user-custom exercises
  (isCustom=true) and any colliding names are never overwritten;
  removed exercises stay on existing installs (additive-only).

Deploy guide (start9/0.4/DEPLOY_040.md)
- Rewritten end-to-end for the workout-log -> proof-of-work cutover:
  refresh_seed, sync-library, build, sideload, verify, rotate creds,
  stop the old service, then post-cutover cleanup release v1.0.0:2.
2026-05-08 20:12:25 -05:00

87 lines
3.0 KiB
Markdown

<p align="center">
<img src="icon.png" alt="Proof of Work Logo" width="21%">
</p>
# Proof of Work on StartOS 0.4 (migration package)
This directory packages **Proof of Work** (`proof-of-work`) for StartOS 0.4
beta. It is the cutover package that carries your 0.3.5 data across to a new
x86_64 StartOS 0.4 host.
> Upstream app lives at `../../proof-of-work/` in this repo.
> Legacy 0.3.5 package lives at `../0.3.5/` (kept intact; do not modify).
> Codex's WIP 0.4 scaffold lives at `../0.4/` (kept intact; superseded by
> this folder).
## Goals
- Keep the package id `proof-of-work` so StartOS recognizes it as the same service.
- Keep the persistent data volume `main` mounted at `/data`.
- Keep the SQLite database at `/data/app.db`.
- Preserve every existing workout, set, exercise, and preference.
- Ship x86_64 only for 0.4 beta (sideload target).
## How data preservation works
1. `seed/data/app.db` holds a one-time snapshot of `/data` from the live
0.3.5 host (currently 1 user, 348 workouts, 164 exercises, 5720 set
logs).
2. The `Dockerfile` bakes that snapshot into the image at
`/app/seed/data/`.
3. On **first boot only**`/data/app.db` missing AND `/data/.seeded`
absent — `docker_entrypoint.sh` copies the seed into `/data/` and writes
a `.seeded` marker.
4. On every subsequent boot, `/data/` is the sole source of truth; the seed
in the image is ignored.
See `seed/README.md` for the snapshot provenance and row counts.
## Image runtime
| Property | Value |
| --- | --- |
| Base image | `node:20-alpine` (multi-stage build) |
| App runtime | Next.js standalone + Prisma + SQLite |
| Entrypoint | `/usr/local/bin/docker_entrypoint.sh` (dumb-init wrapped) |
| Internal port | `3000` |
| Architectures | `x86_64` (beta) |
## Build and sideload
```sh
cd start9/0.4
npm ci
make clean
make x86 # outputs proof-of-work_x86_64.s9pk
```
Sideload via StartOS web UI or `make install` (requires `~/.startos/config.yaml`).
Step-by-step instructions are in [`DEPLOY_040.md`](./DEPLOY_040.md).
## What is unchanged from 0.3.5
- Package id: `proof-of-work`
- Volume id: `main`
- Mount path: `/data`
- DB path: `/data/app.db`
- Health endpoint: `/api/health`
- Compat `ALTER TABLE` block (idempotent; no-op on a current DB)
## What is new in 0.4
- TypeScript SDK manifest under `startos/`
- ExVer version (`0.1.0:18`) replaces the 0.3.5 4-part `0.1.0.17`
- Seed-on-first-boot with a `.seeded` marker and stderr logging
- `alertUpdate` warning users not to Uninstall to troubleshoot
- Self-contained Dockerfile — no references to `../0.3.5/` or `../0.4/`
## Follow-up releases (planned, do not ship yet)
- **v0.1.0:19** — remove the `COPY seed/data \u2026` line and the seed block
from the entrypoint once the cutover is confirmed. Leaves `seed/` on disk
unreferenced.
- **v0.1.0:19** or **v0.1.0:20** — add a StartOS Package Action
`change-admin-credentials` that updates the User row in `/data/app.db`
(bcryptjs, salt rounds 10) so you can rename/rotate the admin from the
StartOS UI.