refactor: flatten monorepo structure to backend/ frontend/ devops/
Rename subdirectories for a cleaner single-repo layout: - website-monitoring-backend/ → backend/ - website-monitoring-frontend/ → frontend/ - website-monitoring-devops/ → devops/ Update all references in package.json scripts, CI workflows, docker-compose, pre-commit hooks, and documentation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#!/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."
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Setup database for website monitoring frontend
|
||||
echo "Setting up database..."
|
||||
|
||||
# Start PostgreSQL service if not running
|
||||
if ! pg_isready -h localhost -p 5432 > /dev/null 2>&1; then
|
||||
echo "Starting PostgreSQL service..."
|
||||
devenv up &
|
||||
sleep 5
|
||||
fi
|
||||
|
||||
# Create database and user if they don't exist
|
||||
psql -h localhost -U postgres -c "CREATE DATABASE website_monitoring;" 2>/dev/null || echo "Database already exists"
|
||||
psql -h localhost -U postgres -c "CREATE USER website_monitoring WITH PASSWORD 'password';" 2>/dev/null || echo "User already exists"
|
||||
psql -h localhost -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE website_monitoring TO website_monitoring;" 2>/dev/null
|
||||
|
||||
# Run the schema setup
|
||||
echo "Running database schema setup..."
|
||||
psql -h localhost -U website_monitoring -d website_monitoring -f setup-database.sql
|
||||
|
||||
# Add missing column if it doesn't exist
|
||||
echo "Adding missing scheduled_at column..."
|
||||
psql -h localhost -U website_monitoring -d website_monitoring -c "ALTER TABLE scans ADD COLUMN IF NOT EXISTS scheduled_at TIMESTAMPTZ;"
|
||||
|
||||
echo "Database setup complete!"
|
||||
Reference in New Issue
Block a user