Vellum/entrypoint.sh
mithral eb1ad6d920 Phase 0: skeleton, config, migrations, health check, container
Bootstraps Vellum as a single Go binary with one SQLite database.

- core: env-driven config, slog logging, SQLite (WAL) with pooled pragmas,
  embedded migration runner keyed on PRAGMA user_version
- migrations/0001_core.sql: identity, media, user state, infra. Media items
  are global; all per-user state (progress, favorites, grants) is a join.
  One polymorphic progress table covers every media kind.
- httpapi: request-ID, structured request logging, panic recovery, JSON
  endpoints for /healthz and /api/v1/version
- multi-arch Dockerfile (pure-Go SQLite, CGO_ENABLED=0) with an entrypoint
  that honours PUID/PGID like the rest of the self-hosted stack
- tests for migration idempotency, FK enforcement, WAL, config, middleware

Media does not exist yet. Nothing is exposed beyond health and version.
2026-10-09 16:26:08 -04:00

27 lines
901 B
Bash
Executable file

#!/bin/sh
# Vellum container entrypoint.
#
# Honours PUID/PGID the same way the rest of this stack does: when started as
# root, take ownership of the data and cache directories and drop privileges to
# the requested user. This is what lets a bind-mounted host directory owned by
# an arbitrary UID work without the operator matching IDs by hand.
#
# If already running as non-root (rootless podman with --userns=keep-id), skip
# all of it and just exec the binary.
set -eu
PUID="${PUID:-1001}"
PGID="${PGID:-1001}"
if [ "$(id -u)" != "0" ]; then
exec /usr/local/bin/vellum "$@"
fi
# Non-recursive: the application creates its own files, and recursively
# chowning a large thumbnail/page cache on every boot would be needlessly slow.
for dir in /data /config; do
mkdir -p "$dir"
chown "$PUID:$PGID" "$dir" 2>/dev/null || true
done
exec su-exec "$PUID:$PGID" /usr/local/bin/vellum "$@"