- Changed database path to ./storage/data.db - Changed uploads path to ./storage/uploads - Updated Dockerfile to create storage/uploads dir (not uploads) - Updated entrypoint.sh to check /app/storage/data.db - Removed COPY of uploads from builder to runner Now all persistent data is in /app/storage/: - /app/storage/data.db (SQLite database) - /app/storage/uploads/ (uploaded media) Easypanel mount: emdash-storage → /app/storage To update EmDash: change version in package.json → push → redeploy Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
860 B
Bash
27 lines
860 B
Bash
#!/bin/sh
|
|
# Wait for volume mount to settle (Easypanel may mount after container starts)
|
|
sleep 3
|
|
|
|
# Check if data.db exists in storage folder and has content
|
|
DB_PATH="/app/storage/data.db"
|
|
UPLOADS_PATH="/app/storage/uploads"
|
|
|
|
# Ensure storage directories exist
|
|
mkdir -p "$UPLOADS_PATH"
|
|
|
|
# Check if data.db exists and has content
|
|
if [ -f "$DB_PATH" ]; then
|
|
DB_SIZE=$(stat -c%s "$DB_PATH" 2>/dev/null || stat -f%z "$DB_PATH" 2>/dev/null || echo "0")
|
|
if [ "$DB_SIZE" -gt 1000 ]; then
|
|
if sqlite3 "$DB_PATH" "SELECT COUNT(*) FROM content" 2>/dev/null | grep -q "^[1-9]"; then
|
|
echo "Database exists with content, starting normally..."
|
|
exec node ./dist/server/entry.mjs
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
echo "Database missing, empty, or corrupted. Running emdash init & seed..."
|
|
cd /app
|
|
pnpm exec emdash init
|
|
pnpm exec emdash seed
|
|
exec node ./dist/server/entry.mjs |