Initial commit for Start9 packaging
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
# Deploy on StartOS 0.3.5 (Raspberry Pi)
|
||||
|
||||
## 1) Build package on your Mac
|
||||
```bash
|
||||
cd /Users/macpro/Projects/Workout-log
|
||||
make -C start9/0.3.5 package
|
||||
```
|
||||
|
||||
This creates:
|
||||
- `start9/0.3.5/image.tar`
|
||||
- `start9/0.3.5/workout-log.s9pk`
|
||||
|
||||
## 2) Upload package to StartOS
|
||||
1. Open the StartOS web UI.
|
||||
2. Go to Services -> Sideload Package (0.3.5 menu naming may vary).
|
||||
3. Upload `workout-log.s9pk`.
|
||||
4. Install and start the service.
|
||||
|
||||
## 3) First run
|
||||
1. Open the service UI.
|
||||
2. Log in with `admin@local` / `workout123`.
|
||||
3. Change password and run one manual backup.
|
||||
|
||||
## 4) Data persistence contract
|
||||
- App DB path: `/data/app.db`
|
||||
|
||||
Because this lives in the persistent service volume, restarts and wrapper upgrades should not erase data.
|
||||
|
||||
## 5) Preparing for StartOS 0.4.0 migration
|
||||
1. Run a StartOS backup before migration.
|
||||
2. Keep `/data/app.db` contract unchanged in the future 0.4 wrapper.
|
||||
3. Preserve package id (`workout-log`) when possible to simplify migration continuity.
|
||||
@@ -0,0 +1,47 @@
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache openssl
|
||||
|
||||
COPY workout-planner/package.json workout-planner/package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
COPY workout-planner/ ./
|
||||
RUN npx prisma generate
|
||||
RUN mkdir -p /tmp-seed \
|
||||
&& DATABASE_URL=file:/tmp-seed/app.db npx prisma db push --skip-generate \
|
||||
&& DATABASE_URL=file:/tmp-seed/app.db npm run db:seed
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN apk add --no-cache dumb-init curl openssl \
|
||||
&& addgroup -S nodejs -g 1001 \
|
||||
&& adduser -S nextjs -u 1001 -G nodejs
|
||||
|
||||
ENV NODE_ENV=production \
|
||||
HOSTNAME=0.0.0.0 \
|
||||
PORT=3000 \
|
||||
WORKOUT_DATA_DIR=/data \
|
||||
WORKOUT_DB_PATH=/data/app.db \
|
||||
WORKOUT_SEED_DB_PATH=/app/prisma/data/app.db
|
||||
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/prisma ./prisma
|
||||
COPY --from=builder --chown=nextjs:nodejs /tmp-seed/app.db /app/prisma/data/app.db
|
||||
COPY start9/0.3.5/docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
|
||||
COPY start9/0.3.5/healthcheck.sh /usr/local/bin/healthcheck.sh
|
||||
|
||||
RUN chmod +x /usr/local/bin/docker_entrypoint.sh /usr/local/bin/healthcheck.sh \
|
||||
&& mkdir -p /data \
|
||||
&& chown -R nextjs:nodejs /app /data
|
||||
|
||||
USER nextjs
|
||||
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["dumb-init", "--", "/usr/local/bin/docker_entrypoint.sh"]
|
||||
@@ -0,0 +1,4 @@
|
||||
All rights reserved.
|
||||
|
||||
This StartOS packaging wrapper and associated project materials are provided for
|
||||
internal/private use unless otherwise licensed by the repository owner.
|
||||
@@ -0,0 +1,23 @@
|
||||
PKG_ID := workout-log
|
||||
PKG_VERSION := 0.1.0.0
|
||||
REPO_ROOT := $(abspath ../..)
|
||||
WRAPPER_DIR := $(CURDIR)
|
||||
IMAGE_NAME := start9/$(PKG_ID)/main:$(PKG_VERSION)
|
||||
|
||||
.PHONY: image-arm package verify clean
|
||||
|
||||
image-arm:
|
||||
docker buildx build --platform=linux/arm64 \
|
||||
-f $(WRAPPER_DIR)/Dockerfile \
|
||||
-t $(IMAGE_NAME) \
|
||||
-o type=docker,dest=$(WRAPPER_DIR)/image.tar \
|
||||
$(REPO_ROOT)
|
||||
|
||||
package: image-arm
|
||||
start-sdk pack
|
||||
|
||||
verify:
|
||||
start-sdk verify s9pk $(PKG_ID).s9pk
|
||||
|
||||
clean:
|
||||
rm -f $(WRAPPER_DIR)/image.tar $(WRAPPER_DIR)/$(PKG_ID).s9pk
|
||||
@@ -0,0 +1,23 @@
|
||||
# Start9 Wrapper (0.3.5)
|
||||
|
||||
This directory contains the StartOS 0.3.5 package wrapper for Workout Log.
|
||||
|
||||
## Build prerequisites
|
||||
- Docker with buildx
|
||||
- `start-sdk` installed on build machine
|
||||
|
||||
## Build package
|
||||
```bash
|
||||
cd /Users/macpro/Projects/Workout-log
|
||||
make -C start9/0.3.5 package
|
||||
```
|
||||
|
||||
## Verify package
|
||||
```bash
|
||||
cd /Users/macpro/Projects/Workout-log
|
||||
make -C start9/0.3.5 verify
|
||||
```
|
||||
|
||||
## Outputs
|
||||
- `start9/0.3.5/image.tar`
|
||||
- `start9/0.3.5/workout-log.s9pk`
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
DATA_DIR="${WORKOUT_DATA_DIR:-/data}"
|
||||
DB_PATH="${WORKOUT_DB_PATH:-$DATA_DIR/app.db}"
|
||||
SEED_DB_PATH="${WORKOUT_SEED_DB_PATH:-/app/prisma/data/app.db}"
|
||||
|
||||
mkdir -p "$DATA_DIR"
|
||||
|
||||
if [ ! -f "$DB_PATH" ]; then
|
||||
if [ -f "$SEED_DB_PATH" ]; then
|
||||
cp "$SEED_DB_PATH" "$DB_PATH"
|
||||
else
|
||||
# Fallback if seed DB is unavailable.
|
||||
touch "$DB_PATH"
|
||||
fi
|
||||
fi
|
||||
|
||||
export DATABASE_URL="file:$DB_PATH"
|
||||
export NODE_ENV="${NODE_ENV:-production}"
|
||||
export HOSTNAME="${HOSTNAME:-0.0.0.0}"
|
||||
export PORT="${PORT:-3000}"
|
||||
|
||||
exec node /app/server.js
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
PORT="${PORT:-3000}"
|
||||
curl -fsS "http://127.0.0.1:${PORT}/api/health" >/dev/null
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
# Workout Log (StartOS 0.3.5)
|
||||
|
||||
## What this package does
|
||||
- Runs Workout Log as a private web app.
|
||||
- Persists all app data in the StartOS service volume (`/data`).
|
||||
- Exposes web UI/API on internal port `3000`.
|
||||
|
||||
## First launch
|
||||
1. Open the service UI from StartOS.
|
||||
2. Log in with default credentials: `admin@local` / `workout123`.
|
||||
3. Immediately change the password from inside the app (recommended).
|
||||
4. Run a manual StartOS backup after initial setup.
|
||||
|
||||
## Data safety
|
||||
- Database path in container: `/data/app.db`.
|
||||
- All persistent state is kept under `/data` for upgrade-safe persistence.
|
||||
|
||||
## Upgrade and migration note
|
||||
This 0.3.5 wrapper keeps runtime data separate from app/runtime files using `/data`.
|
||||
That makes migration to a future StartOS 0.4.0 wrapper straightforward as long as the
|
||||
wrapper continues to use the same data path contract.
|
||||
@@ -0,0 +1,94 @@
|
||||
id: workout-log
|
||||
title: Workout Log
|
||||
version: 0.1.0.0
|
||||
release-notes: >-
|
||||
Initial StartOS 0.3.5 package wrapper for Workout Log.
|
||||
license: Proprietary
|
||||
wrapper-repo: https://github.com/your-org/workout-log-startos
|
||||
upstream-repo: https://github.com/your-org/workout-log
|
||||
support-site: https://github.com/your-org/workout-log/issues
|
||||
marketing-site: https://github.com/your-org/workout-log
|
||||
build: ["make image-arm"]
|
||||
|
||||
description:
|
||||
short: Self-hosted workout planning and logging app.
|
||||
long: >-
|
||||
Workout Log is a self-hosted web app for planning workouts, logging sets,
|
||||
tracking progress, and managing exercises. This package keeps runtime data in
|
||||
the StartOS service volume for upgrade-safe persistence and future migration.
|
||||
|
||||
assets:
|
||||
license: LICENSE
|
||||
icon: icon.png
|
||||
instructions: instructions.md
|
||||
docker-images: image.tar
|
||||
|
||||
main:
|
||||
type: docker
|
||||
image: main
|
||||
entrypoint: docker_entrypoint.sh
|
||||
args: []
|
||||
mounts:
|
||||
main: /data
|
||||
|
||||
health-checks:
|
||||
main:
|
||||
name: API health
|
||||
success-message: Workout Log API is responding.
|
||||
type: docker
|
||||
image: main
|
||||
entrypoint: healthcheck.sh
|
||||
args: []
|
||||
inject: true
|
||||
|
||||
config: ~
|
||||
dependencies: {}
|
||||
|
||||
volumes:
|
||||
main:
|
||||
type: data
|
||||
|
||||
interfaces:
|
||||
main:
|
||||
name: Web Interface
|
||||
description: Browser UI and API for Workout Log.
|
||||
tor-config:
|
||||
port-mapping:
|
||||
80: "3000"
|
||||
lan-config:
|
||||
443:
|
||||
ssl: true
|
||||
internal: 3000
|
||||
ui: true
|
||||
protocols: [tcp, http, https]
|
||||
|
||||
backup:
|
||||
create:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
set -eu
|
||||
rm -rf /backup/*
|
||||
cp -a /data/. /backup/
|
||||
mounts:
|
||||
main: /data
|
||||
BACKUP: /backup
|
||||
restore:
|
||||
type: docker
|
||||
image: main
|
||||
system: false
|
||||
entrypoint: sh
|
||||
args:
|
||||
- -c
|
||||
- |
|
||||
set -eu
|
||||
cp -a /backup/. /data/
|
||||
mounts:
|
||||
main: /data
|
||||
BACKUP: /backup
|
||||
|
||||
actions: {}
|
||||
Reference in New Issue
Block a user