Files
emdash-blog-template/entrypoint.sh
Kunthawat Greethong 30eeee186f fix: improve entrypoint.sh volume mount handling
- Add 3 second delay to wait for Easypanel volume mount
- Check file size as backup (seeded DB > 1KB, empty < 1KB)
- Check content table count as primary validation
- Safer fallback if any check fails

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-05-02 09:48:40 +07:00

21 lines
794 B
Bash

#!/bin/sh
# Wait for volume mount to settle (Easypanel may mount after container starts)
sleep 3
# Check if data.db exists and has content
# Using file size as backup check (empty DB is ~8KB, seeded DB is much larger)
DB_SIZE=$(stat -c%s /app/data.db 2>/dev/null || stat -f%z /app/data.db 2>/dev/null || echo "0")
if [ -f /app/data.db ] && [ "$DB_SIZE" -gt 1000 ]; then
# DB exists and has size > 1KB, check if it has content
if sqlite3 /app/data.db "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
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