v1.0.0:3 — post-cutover seed strip
Removes the one-time `/data` snapshot from the deployed Docker image now that the cutover from the legacy `workout-log` package is verified done (v1.0.0:1 + :2 in production). Dockerfile - Drops `COPY start9/0.4/seed/data /app/seed/data`. - Drops the `WORKOUT_BAKED_SEED_DB_PATH` env var. - Comment block explains the rationale + how to re-seed if ever needed. docker_entrypoint.sh - Step 1 collapses to single-branch fallback: if /data is empty AND /app/prisma/data/app.db exists, copy the empty-schema fallback. The baked-seed branch is gone. - Comment cross-references v1.0.0:3 for the rationale. start9/0.4/seed/README.md rewritten to reflect historical-only status + how to re-seed for the rare "spin up another instance with this history" case. Version graph - Adds startos/versions/v1.0.0.3.ts with empty up/down migrations and release notes. - Promotes v1.0.0:3 to `current`; v1.0.0:1 and :2 move to `other` so hosts on either upgrade in place. No schema changes, no data migration. /data on existing installs is left exactly as-is. Image size drops by ~1.7MB (the snapshot size).
This commit is contained in:
@@ -3,15 +3,16 @@
|
||||
#
|
||||
# Responsibilities (in order):
|
||||
# 1. Ensure the persistent /data directory exists.
|
||||
# 2. Seed /data on truly-fresh first boot:
|
||||
# a. If /app/seed/data/app.db is present (v1.0.0:1 cutover image),
|
||||
# copy it into /data. This is how an operator migrating from
|
||||
# the legacy `workout-log` package preserves their full history.
|
||||
# b. Otherwise fall back to the empty-schema fallback DB at
|
||||
# /app/prisma/data/app.db (already seeded with the curated
|
||||
# exercise library at build time).
|
||||
# Both branches are gated on /data/app.db being absent AND
|
||||
# /data/.seeded being absent — never overwrites live data.
|
||||
# 2. First-boot fallback ONLY: if /data is empty (no app.db, no
|
||||
# .seeded marker) AND a fallback DB exists at
|
||||
# /app/prisma/data/app.db, copy it into /data. This handles
|
||||
# brand-new sideloads on a host that has never had proof-of-work
|
||||
# installed before. Existing installs ALWAYS skip this branch
|
||||
# because /data/app.db is already present.
|
||||
# (v1.0.0:1 had a second branch that copied a baked cutover seed
|
||||
# from /app/seed/data/app.db. v1.0.0:3 stripped both the COPY of
|
||||
# that seed in the Dockerfile and the branch that copied it here,
|
||||
# now that the cutover from `workout-log` is verified done.)
|
||||
# 3. Run idempotent compat ALTERs for columns added after older snapshots.
|
||||
# No-ops on hosts whose schema is already current.
|
||||
# 4. Ensure the curated exercise library is present for every user. New
|
||||
@@ -26,7 +27,6 @@ set -eu
|
||||
DATA_DIR="${WORKOUT_DATA_DIR:-/data}"
|
||||
DB_PATH="${WORKOUT_DB_PATH:-$DATA_DIR/app.db}"
|
||||
FALLBACK_SEED_DB_PATH="${WORKOUT_FALLBACK_SEED_DB_PATH:-/app/prisma/data/app.db}"
|
||||
BAKED_SEED_DB_PATH="${WORKOUT_BAKED_SEED_DB_PATH:-/app/seed/data/app.db}"
|
||||
LIBRARY_JSON_PATH="${WORKOUT_LIBRARY_JSON_PATH:-/app/prisma/exercises.seed.json}"
|
||||
|
||||
log() {
|
||||
@@ -37,21 +37,17 @@ log() {
|
||||
mkdir -p "$DATA_DIR"
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Step 1 — first-boot seeding. NEVER overwrites an existing app.db.
|
||||
# Both branches are skipped on every restart of an installed host because
|
||||
# /data/app.db already exists.
|
||||
# Step 1 — first-boot fallback. NEVER overwrites an existing app.db.
|
||||
# Skipped on every restart of an installed host because /data/app.db
|
||||
# already exists.
|
||||
# -----------------------------------------------------------------------------
|
||||
if [ ! -f "$DB_PATH" ] && [ ! -f "$DATA_DIR/.seeded" ]; then
|
||||
if [ -f "$BAKED_SEED_DB_PATH" ]; then
|
||||
log "no $DB_PATH and no .seeded marker; copying baked cutover seed from $BAKED_SEED_DB_PATH"
|
||||
cp "$BAKED_SEED_DB_PATH" "$DB_PATH"
|
||||
date -u +"seeded from baked cutover snapshot at %Y-%m-%dT%H:%M:%SZ" > "$DATA_DIR/.seeded"
|
||||
elif [ -f "$FALLBACK_SEED_DB_PATH" ]; then
|
||||
log "no $DB_PATH and no baked seed; copying empty-schema fallback from $FALLBACK_SEED_DB_PATH"
|
||||
if [ -f "$FALLBACK_SEED_DB_PATH" ]; then
|
||||
log "no $DB_PATH and no .seeded marker; copying empty-schema fallback from $FALLBACK_SEED_DB_PATH"
|
||||
cp "$FALLBACK_SEED_DB_PATH" "$DB_PATH"
|
||||
date -u +"seeded from empty-schema fallback at %Y-%m-%dT%H:%M:%SZ" > "$DATA_DIR/.seeded"
|
||||
else
|
||||
log "no $DB_PATH, no baked seed, no fallback DB; creating empty $DB_PATH"
|
||||
log "no $DB_PATH and no fallback DB; creating empty $DB_PATH"
|
||||
touch "$DB_PATH"
|
||||
fi
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user