diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 06bf0019..e6eb3e39 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -238,11 +238,6 @@ jobs: TRAEFIK_HOST: ${{ needs.prepare.outputs.traefik_host }} GATEKEEPER_HOST: ${{ needs.prepare.outputs.gatekeeper_host }} - # Secrets mapping (Payload CMS) - PAYLOAD_SECRET: ${{ secrets.PAYLOAD_SECRET || vars.PAYLOAD_SECRET || 'you-need-to-set-a-payload-secret' }} - PAYLOAD_DB_NAME: ${{ secrets.PAYLOAD_DB_NAME || vars.PAYLOAD_DB_NAME || 'payload' }} - PAYLOAD_DB_USER: ${{ secrets.PAYLOAD_DB_USER || vars.PAYLOAD_DB_USER || 'payload' }} - PAYLOAD_DB_PASSWORD: ${{ (needs.prepare.outputs.target == 'testing' && secrets.TESTING_PAYLOAD_DB_PASSWORD) || (needs.prepare.outputs.target == 'staging' && secrets.STAGING_PAYLOAD_DB_PASSWORD) || secrets.PAYLOAD_DB_PASSWORD || vars.PAYLOAD_DB_PASSWORD || 'payload' }} # Secrets mapping (Mail) MAIL_HOST: ${{ secrets.SMTP_HOST || vars.SMTP_HOST }} @@ -304,11 +299,6 @@ jobs: echo "MAIL_FROM=$MAIL_FROM" echo "MAIL_RECIPIENTS=$MAIL_RECIPIENTS" echo "" - echo "# Payload CMS" - echo "PAYLOAD_SECRET=$PAYLOAD_SECRET" - echo "PAYLOAD_DB_NAME=$PAYLOAD_DB_NAME" - echo "PAYLOAD_DB_USER=$PAYLOAD_DB_USER" - echo "PAYLOAD_DB_PASSWORD=$PAYLOAD_DB_PASSWORD" echo "" echo "# Gatekeeper" echo "GATEKEEPER_PASSWORD=$GATEKEEPER_PASSWORD" @@ -367,51 +357,6 @@ jobs: ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file '$ENV_FILE' pull" ssh root@alpha.mintel.me "cd $SITE_DIR && docker compose -p '${{ needs.prepare.outputs.project_name }}' --env-file '$ENV_FILE' up -d --remove-orphans" - # Sanitize Payload Migrations: Replace 'dev' push entries with proper migration names. - # Without this, Payload prompts interactively for confirmation and blocks forever in Docker. - DB_CONTAINER="${{ needs.prepare.outputs.project_name }}-klz-db-1" - echo "โณ Waiting for database container to be ready..." - for i in $(seq 1 15); do - if ssh root@alpha.mintel.me "docker exec $DB_CONTAINER pg_isready -U payload -q 2>/dev/null"; then - echo "โœ… Database is ready." - break - fi - echo " Attempt $i/15..." - sleep 2 - done - - echo "๐Ÿ”ง Sanitizing payload_migrations table (if exists)..." - REMOTE_DB_USER=$(ssh root@alpha.mintel.me "grep -h '^PAYLOAD_DB_USER=' $SITE_DIR/.env* 2>/dev/null | tail -1 | cut -d= -f2" || echo "payload") - REMOTE_DB_NAME=$(ssh root@alpha.mintel.me "grep -h '^PAYLOAD_DB_NAME=' $SITE_DIR/.env* 2>/dev/null | tail -1 | cut -d= -f2" || echo "payload") - REMOTE_DB_USER="${REMOTE_DB_USER:-payload}" - REMOTE_DB_NAME="${REMOTE_DB_NAME:-payload}" - - # Auto-detect migrations from src/migrations/*.ts - BATCH=1 - VALUES="" - for f in $(ls src/migrations/*.ts 2>/dev/null | sort); do - NAME=$(basename "$f" .ts) - [ -n "$VALUES" ] && VALUES="$VALUES," - VALUES="$VALUES ('$NAME', $BATCH)" - ((BATCH++)) - done - - if [ -n "$VALUES" ]; then - ssh root@alpha.mintel.me "docker exec $DB_CONTAINER psql -U $REMOTE_DB_USER -d $REMOTE_DB_NAME -c \" - DO \\\$\\\$ BEGIN - DELETE FROM payload_migrations WHERE batch = -1; - INSERT INTO payload_migrations (name, batch) - SELECT name, batch FROM (VALUES $VALUES) AS v(name, batch) - WHERE NOT EXISTS (SELECT 1 FROM payload_migrations pm WHERE pm.name = v.name); - EXCEPTION WHEN undefined_table THEN - RAISE NOTICE 'payload_migrations table does not exist yet โ€” skipping sanitization'; - END \\\$\\\$; - \"" || echo "โš ๏ธ Migration sanitization skipped (table may not exist yet)" - fi - - # Restart app to pick up clean migration state - APP_CONTAINER="${{ needs.prepare.outputs.project_name }}-klz-app-1" - ssh root@alpha.mintel.me "docker restart $APP_CONTAINER" ssh root@alpha.mintel.me "docker system prune -f --filter 'until=24h'" @@ -484,33 +429,6 @@ jobs: [ -f /usr/bin/chromium ] && ln -sf /usr/bin/chromium /usr/bin/google-chrome [ -f /usr/bin/chromium ] && ln -sf /usr/bin/chromium /usr/bin/chromium-browser - # โ”€โ”€ Critical Smoke Tests (MUST pass) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ - - name: ๐Ÿฅ CMS Deep Health Check - continue-on-error: true - env: - DEPLOY_URL: ${{ needs.prepare.outputs.next_public_url }} - GK_PASS: ${{ secrets.GATEKEEPER_PASSWORD || 'klz2026' }} - run: | - echo "Waiting 60s for app to fully start (cold start / migrations / hydration)..." - sleep 60 - - echo "Checking basic health..." - curl -sfL --retry 5 --retry-delay 10 "$DEPLOY_URL/health" || { echo "โŒ Basic health check failed after retries"; exit 1; } - echo "โœ… Basic health OK" - - echo "Checking CMS DB connectivity..." - # We use -v to see if we hit Gatekeeper (307) or 503/504 - URL="$DEPLOY_URL/api/health/cms?gk_bypass=$GK_PASS&cb=$(date +%s)" - RESPONSE=$(curl -sfL --retry 5 --retry-delay 10 "$URL" 2>&1) || { - echo "โš ๏ธ CMS health check failed, but site might still be fine." - echo "--- DEBUG INFO ---" - curl -svI "$URL" - echo "--- RESPONSE BODY ---" - curl -sL "$URL" | head -c 1000 - echo "" - echo "Proceeding to smoke tests to confirm actual site functionality." - } - echo "โœ… CMS health output: $RESPONSE" - name: ๐Ÿš€ OG Image Check diff --git a/scripts/check-forms.ts b/scripts/check-forms.ts index 0f8fad94..66a33128 100644 --- a/scripts/check-forms.ts +++ b/scripts/check-forms.ts @@ -350,66 +350,7 @@ async function main() { hasErrors = true; } - // 5. Cleanup: Delete test submissions from Payload CMS - console.log(`\n๐Ÿงน Starting cleanup of test submissions...`); - const payloadSecret = process.env.PAYLOAD_SECRET; - - if (!payloadSecret) { - console.warn( - ` โš ๏ธ PAYLOAD_SECRET not found in environment. Cleanup will likely fail with 403 if the server expects a secret.`, - ); - } else { - console.log( - ` ๐Ÿ” PAYLOAD_SECRET found (${payloadSecret.substring(0, 3)}...). Sending x-e2e-secret header.`, - ); - } - - try { - const apiUrl = `${targetUrl.replace(/\/$/, '')}/api/form-submissions`; - // We fetch ALL submissions matching the test email to clean up potential lefovers from previous runs - const searchUrl = `${apiUrl}?where[email][equals]=testing@mintel.me&limit=100`; - - // Fetch test submissions with bypass header - const searchResponse = await axios.get(searchUrl, { - headers: { - Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`, - 'x-e2e-secret': payloadSecret || '', - }, - }); - - const testSubmissions = searchResponse.data.docs || []; - console.log(` Found ${testSubmissions.length} test submissions to clean up.`); - - for (const doc of testSubmissions) { - try { - await axios.delete(`${apiUrl}/${doc.id}`, { - headers: { - Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`, - 'x-e2e-secret': payloadSecret || '', - }, - }); - console.log(` โœ… Deleted submission: ${doc.id} (${doc.name})`); - } catch (delErr: any) { - console.warn(` โš ๏ธ Cleanup attempt on ${doc.id} failed: ${delErr.message}`); - } - } - - if (testSubmissions.length > 0) { - console.log(`โœ… Cleanup completed successfully.`); - } - } catch (err: any) { - if (err.response?.status === 403) { - console.error(` โŒ Cleanup failed with 403 Forbidden.`); - console.error(` Detail: The server rejected the x-e2e-secret header.`); - console.error(` Server Response: ${JSON.stringify(err.response.data)}`); - } else { - console.error(` โŒ Cleanup fetch failed: ${err.message}`); - if (err.response) { - console.error(` Status: ${err.response.status}`); - console.error(` Body: ${JSON.stringify(err.response.data)}`); - } - } - } + console.log(`\n๐Ÿงน Skipping cleanup (No CMS/DB active in this infrastructure).`); await browser.close(); diff --git a/scripts/check-og-images.ts b/scripts/check-og-images.ts index 92ba3ba3..b8f6cbd1 100644 --- a/scripts/check-og-images.ts +++ b/scripts/check-og-images.ts @@ -8,8 +8,8 @@ const routes = [ '/de/opengraph-image', '/en/opengraph-image', '/de/blog/opengraph-image', - '/de/api/og/product?slug=low-voltage-cables', - '/en/api/og/product?slug=medium-voltage-cables', + '/de/kontakt/opengraph-image', + '/en/contact/opengraph-image', ]; async function verifyImage(path: string): Promise {