- Add Redis/in-memory caching layer (cache.go) - Add SMTP alerting for high failure rates (alerts.go) - Add data migration script from old API (migrate.go) - Add docker-compose.yml for easy deployment - Move dashboard to / with redirect from /dashboard - Add dark/light mode toggle - Add error analysis and failed apps statistics - Add PVE version and LXC/VM type stats - Add /metrics Prometheus endpoint - Add /api/records pagination endpoint - Add CSV export functionality - Enhanced healthcheck with PB connection status New ENV vars: - Cache: ENABLE_CACHE, CACHE_TTL_SECONDS, ENABLE_REDIS, REDIS_URL - Alerts: ALERT_ENABLED, SMTP_*, ALERT_FAILURE_THRESHOLD, etc. - Migration: RUN_MIGRATION, MIGRATION_REQUIRED, MIGRATION_SOURCE_URL
51 lines
1.5 KiB
Bash
51 lines
1.5 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
echo "============================================="
|
|
echo " ProxmoxVED Telemetry Service"
|
|
echo "============================================="
|
|
|
|
# Run migration if enabled
|
|
if [ "$RUN_MIGRATION" = "true" ]; then
|
|
echo ""
|
|
echo "🔄 Migration mode enabled"
|
|
echo " Source: $MIGRATION_SOURCE_URL"
|
|
echo " Target: $POCKETBASE_URL"
|
|
echo " Collection: $POCKETBASE_COLLECTION"
|
|
echo ""
|
|
|
|
# Wait for PocketBase to be ready
|
|
echo "⏳ Waiting for PocketBase to be ready..."
|
|
RETRIES=30
|
|
until wget -q --spider "$POCKETBASE_URL/api/health" 2>/dev/null; do
|
|
RETRIES=$((RETRIES - 1))
|
|
if [ $RETRIES -le 0 ]; then
|
|
echo "❌ PocketBase not reachable after 30 attempts"
|
|
if [ "$MIGRATION_REQUIRED" = "true" ]; then
|
|
exit 1
|
|
fi
|
|
echo "⚠️ Continuing without migration..."
|
|
break
|
|
fi
|
|
echo " Waiting... ($RETRIES attempts left)"
|
|
sleep 2
|
|
done
|
|
|
|
if wget -q --spider "$POCKETBASE_URL/api/health" 2>/dev/null; then
|
|
echo "✅ PocketBase is ready"
|
|
echo ""
|
|
echo "🚀 Starting migration..."
|
|
/app/migrate || {
|
|
if [ "$MIGRATION_REQUIRED" = "true" ]; then
|
|
echo "❌ Migration failed!"
|
|
exit 1
|
|
fi
|
|
echo "⚠️ Migration failed, but continuing..."
|
|
}
|
|
echo ""
|
|
fi
|
|
fi
|
|
|
|
echo "🚀 Starting telemetry service..."
|
|
exec /app/telemetry-ingest
|