diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index c5907807..bf4fa82c 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -107,6 +107,57 @@ jobs: fi echo "" + # ═══════════════════════════════════════════════════════════════════════════════ + # LOGGING: Smoke Test Phase + # ═══════════════════════════════════════════════════════════════════════════════ + - name: 🧪 Run Smoke Test + run: | + echo "╔══════════════════════════════════════════════════════════════════════════════╗" + echo "║ Step: Smoke Test ║" + echo "╚══════════════════════════════════════════════════════════════════════════════╝" + echo "" + echo "🧪 Starting local smoke test to verify build integrity..." + + # Start the application in the background + # We use the standalone output which is what runs in production + # We need to provide minimal env vars for it to start + export PORT=3001 + export NODE_ENV=production + export NEXT_PUBLIC_BASE_URL="http://localhost:3001" + + node .next/standalone/server.js & + APP_PID=$! + + echo "⏳ Waiting for application to start on port 3001 (PID: $APP_PID)..." + + # Wait for health check to pass + MAX_RETRIES=10 + RETRY_COUNT=0 + SUCCESS=false + + while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do + if curl -s http://localhost:3001/health > /dev/null; then + SUCCESS=true + break + fi + echo " • Waiting... ($((RETRY_COUNT + 1))/$MAX_RETRIES)" + sleep 3 + RETRY_COUNT=$((RETRY_COUNT + 1)) + done + + if [ "$SUCCESS" = true ]; then + echo "✅ Smoke test passed: Application started successfully" + kill $APP_PID + else + echo "❌ Smoke test failed: Application failed to start or health check timed out" + echo "🔍 Application Logs:" + # Try to get some logs before killing + kill -0 $APP_PID 2>/dev/null && sleep 2 + kill $APP_PID + exit 1 + fi + echo "" + # ═══════════════════════════════════════════════════════════════════════════════ # LOGGING: Deployment Phase # ═══════════════════════════════════════════════════════════════════════════════ diff --git a/Dockerfile b/Dockerfile index cea2e032..a52440c5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,13 +37,6 @@ RUN npx tsx scripts/validate-env.ts RUN npm run build -# Smoke test during build to catch runtime errors early -# We start the app in the background, wait for it to be ready, and run the smoke test -RUN (node .next/standalone/server.js &) && \ - npx wait-on -t 30000 http://localhost:3000/health && \ - npx tsx scripts/smoke-test.ts http://localhost:3000/health && \ - pkill -f "node .next/standalone/server.js" - # Production image, copy all the files and run next FROM base AS runner WORKDIR /app diff --git a/lib/services/cache/redis-cache-service.ts b/lib/services/cache/redis-cache-service.ts index 03f9ea5c..659c647c 100644 --- a/lib/services/cache/redis-cache-service.ts +++ b/lib/services/cache/redis-cache-service.ts @@ -1,6 +1,5 @@ import { createClient, type RedisClientType } from 'redis'; import type { CacheService, CacheSetOptions } from './cache-service'; -import { getServerAppServices } from '../create-services.server'; export type RedisCacheServiceOptions = { url: string;