Files
cloudlense/website-monitoring-frontend/scripts/setup-cron.sh
T
Dennis 14a32bdc0d feat: initialize monorepo with full dev team best practices
- Unified monorepo with backend (Express), frontend (Next.js), and devops
- Backend: ESLint, Prettier, Jest tests (3 passing), health endpoint, .env.example
- Frontend: Fixed build errors, fixed all lint errors (0 remaining), tests passing
- DevOps: Docker Compose with PostgreSQL, backend, frontend + healthchecks
- CI/CD: 3 GitHub Actions workflows (backend, frontend, docker integration)
- DX: Husky pre-commit hooks with smart change detection
- Docs: Root README with architecture, CONTRIBUTING.md, PR template

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-06 00:05:50 +01:00

89 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
# Lighthouse Scanner Cron Job Setup Script
# This script helps you set up automated scanning for your website monitoring application
set -e
echo "🚀 Lighthouse Scanner Cron Job Setup"
echo "====================================="
# Check if we're in the right directory
if [ ! -f "package.json" ]; then
echo "❌ Error: Please run this script from your project root directory"
exit 1
fi
# Check if vercel.json exists
if [ -f "vercel.json" ]; then
echo "✅ Found vercel.json - Vercel cron jobs are configured"
echo " Schedule: Every 6 hours"
echo " Endpoint: /api/cron/scan?mode=all"
echo ""
echo "📝 To deploy with Vercel cron jobs:"
echo " 1. Deploy to Vercel: vercel --prod"
echo " 2. Cron jobs will start automatically"
echo ""
fi
# Check if GitHub Actions workflow exists
if [ -f ".github/workflows/cron-scan.yml" ]; then
echo "✅ Found GitHub Actions workflow"
echo " Schedule: Every 6 hours"
echo " File: .github/workflows/cron-scan.yml"
echo ""
echo "📝 To use GitHub Actions:"
echo " 1. Push this repository to GitHub"
echo " 2. Set DEPLOYMENT_URL secret in repository settings"
echo " 3. Workflow will run automatically"
echo ""
fi
# Check environment variables
echo "🔧 Environment Check:"
if [ -f ".env" ]; then
echo "✅ Found .env file"
# Check for required Supabase variables
if grep -q "NEXT_PUBLIC_SUPABASE_URL" .env; then
echo "✅ NEXT_PUBLIC_SUPABASE_URL is configured"
else
echo "❌ NEXT_PUBLIC_SUPABASE_URL is missing"
fi
if grep -q "NEXT_PUBLIC_SUPABASE_ANON_KEY" .env; then
echo "✅ NEXT_PUBLIC_SUPABASE_ANON_KEY is configured"
else
echo "❌ NEXT_PUBLIC_SUPABASE_ANON_KEY is missing"
fi
if grep -q "SUPABASE_SERVICE_ROLE_KEY" .env; then
echo "✅ SUPABASE_SERVICE_ROLE_KEY is configured"
else
echo "❌ SUPABASE_SERVICE_ROLE_KEY is missing"
fi
else
echo "❌ No .env file found"
echo " Please create .env file with your Supabase configuration"
fi
echo ""
echo "📚 Documentation:"
echo " - Cron setup guide: docs/cron-setup-guide.md"
echo " - Database setup: setup-database.sql"
echo ""
echo "🎯 Next Steps:"
echo " 1. Ensure your database is set up with all required tables"
echo " 2. Configure your environment variables"
echo " 3. Deploy your application"
echo " 4. Set up cron jobs using one of the methods above"
echo " 5. Test the system by visiting your dashboard"
echo ""
echo "🔍 Testing:"
echo " You can test the cron endpoint manually:"
echo " curl -X POST 'https://your-domain.com/api/cron/scan?mode=all'"
echo ""
echo "✅ Setup complete! Check the documentation for detailed instructions."