- pnpm monorepo (apps/client + apps/server) - Server: Express + node:sqlite with numbered migration runner, REST API for all 9 features (members, events, chores, shopping, meals, messages, countdowns, photos, settings) - Client: React 18 + Vite + TypeScript + Tailwind + Framer Motion + Zustand - Theme system: dark/light + 5 accent colors, CSS custom properties, anti-FOUC script, ThemeToggle on every surface - AppShell: collapsible sidebar, animated route transitions, mobile drawer - Phase 2 features: Calendar (custom month grid, event chips, add/edit modal), Chores (card grid, complete/reset, member filter, streaks), Shopping (multi-list tabs, animated check-off, quick-add bar, member assign) - Family member CRUD with avatar, color picker - Settings page: theme/accent, photo folder, slideshow, weather, date/time - Docker: multi-stage Dockerfile, docker-compose.yml, entrypoint with PUID/PGID - Unraid: CA XML template, CLI install script, UNRAID.md guide - .gitignore covering node_modules, dist, db files, secrets, build artifacts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
98 lines
4.6 KiB
Bash
98 lines
4.6 KiB
Bash
#!/bin/bash
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
# Family Planner — Unraid CLI Install Script
|
|
#
|
|
# Run from the Unraid terminal:
|
|
# bash /path/to/install.sh
|
|
#
|
|
# Or pipe directly (once the image is published):
|
|
# curl -fsSL https://raw.githubusercontent.com/your-username/family-planner/main/unraid/install.sh | bash
|
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
set -euo pipefail
|
|
|
|
# ── Configurable defaults (edit these or they will be prompted) ───────────────
|
|
IMAGE="${IMAGE:-ghcr.io/your-username/family-planner:latest}"
|
|
CONTAINER_NAME="${CONTAINER_NAME:-family-planner}"
|
|
HOST_PORT="${HOST_PORT:-3001}"
|
|
DATA_PATH="${DATA_PATH:-/mnt/user/appdata/family-planner}"
|
|
PHOTOS_PATH="${PHOTOS_PATH:-/mnt/user/Photos}"
|
|
PUID="${PUID:-99}"
|
|
PGID="${PGID:-100}"
|
|
TZ="${TZ:-America/New_York}"
|
|
|
|
# ── Helper ────────────────────────────────────────────────────────────────────
|
|
info() { echo -e "\033[1;34m[INFO]\033[0m $*"; }
|
|
success() { echo -e "\033[1;32m[OK]\033[0m $*"; }
|
|
warn() { echo -e "\033[1;33m[WARN]\033[0m $*"; }
|
|
error() { echo -e "\033[1;31m[ERROR]\033[0m $*" >&2; exit 1; }
|
|
|
|
# ── Preflight ─────────────────────────────────────────────────────────────────
|
|
command -v docker &>/dev/null || error "Docker is not installed or not in PATH."
|
|
|
|
info "Family Planner — Unraid Installer"
|
|
echo ""
|
|
echo " Container : $CONTAINER_NAME"
|
|
echo " Image : $IMAGE"
|
|
echo " Port : $HOST_PORT → 3001"
|
|
echo " Data path : $DATA_PATH"
|
|
echo " Photos : $PHOTOS_PATH (read-only)"
|
|
echo " PUID/PGID : $PUID/$PGID"
|
|
echo " TZ : $TZ"
|
|
echo ""
|
|
read -rp "Proceed with these settings? [Y/n] " confirm
|
|
confirm="${confirm:-Y}"
|
|
[[ "$confirm" =~ ^[Yy]$ ]] || { info "Aborted."; exit 0; }
|
|
|
|
# ── Stop and remove existing container if present ─────────────────────────────
|
|
if docker inspect "$CONTAINER_NAME" &>/dev/null; then
|
|
warn "Container '$CONTAINER_NAME' already exists — stopping and removing it."
|
|
docker stop "$CONTAINER_NAME" &>/dev/null || true
|
|
docker rm "$CONTAINER_NAME" &>/dev/null || true
|
|
fi
|
|
|
|
# ── Ensure data directory exists ──────────────────────────────────────────────
|
|
mkdir -p "$DATA_PATH"
|
|
success "Data directory ready: $DATA_PATH"
|
|
|
|
# ── Pull the latest image ─────────────────────────────────────────────────────
|
|
info "Pulling image: $IMAGE"
|
|
docker pull "$IMAGE"
|
|
|
|
# ── Run the container ─────────────────────────────────────────────────────────
|
|
info "Starting container..."
|
|
docker run -d \
|
|
--name "$CONTAINER_NAME" \
|
|
--restart unless-stopped \
|
|
-p "${HOST_PORT}:3001" \
|
|
-v "${DATA_PATH}:/data" \
|
|
-v "${PHOTOS_PATH}:/photos:ro" \
|
|
-e "PUID=${PUID}" \
|
|
-e "PGID=${PGID}" \
|
|
-e "TZ=${TZ}" \
|
|
-e "PORT=3001" \
|
|
-e "DATA_DIR=/data" \
|
|
-e "PHOTOS_DIR=/photos" \
|
|
"$IMAGE"
|
|
|
|
# ── Verify startup ────────────────────────────────────────────────────────────
|
|
info "Waiting for container to become healthy..."
|
|
for i in $(seq 1 15); do
|
|
if docker exec "$CONTAINER_NAME" wget -qO- http://localhost:3001/api/settings &>/dev/null; then
|
|
success "Family Planner is up!"
|
|
break
|
|
fi
|
|
sleep 2
|
|
if [ "$i" -eq 15 ]; then
|
|
warn "Health check timed out. Check logs with: docker logs $CONTAINER_NAME"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
success "Installation complete."
|
|
echo ""
|
|
echo " Open in browser : http://$(hostname -I | awk '{print $1}'):${HOST_PORT}"
|
|
echo " View logs : docker logs -f $CONTAINER_NAME"
|
|
echo " Stop : docker stop $CONTAINER_NAME"
|
|
echo " Update image : docker pull $IMAGE && docker stop $CONTAINER_NAME && bash $(realpath "$0")"
|
|
echo ""
|