230 lines
6.7 KiB
Bash
230 lines
6.7 KiB
Bash
#!/bin/bash
|
|
|
|
# Post-install script for Laravel project
|
|
# Run this after 'composer create-project laravel/laravel'
|
|
# Usage: ./scripts/post-install.sh
|
|
|
|
set -e
|
|
|
|
echo "=========================================="
|
|
echo "Laravel Post-Install Setup"
|
|
echo "=========================================="
|
|
|
|
# Check if we're in a Laravel project
|
|
if [ ! -f "artisan" ]; then
|
|
echo "Error: Not in a Laravel project directory"
|
|
echo "Run this from your Laravel project root (src/)"
|
|
exit 1
|
|
fi
|
|
|
|
# Install Ignition (already included in Laravel, but ensure latest)
|
|
echo ""
|
|
echo "[1/5] Ensuring Ignition is installed..."
|
|
composer require spatie/laravel-ignition --dev
|
|
|
|
# Install Flare for production error tracking
|
|
echo ""
|
|
echo "[2/5] Installing Flare for production error tracking..."
|
|
composer require spatie/laravel-flare
|
|
|
|
# Install Telescope for development debugging (optional)
|
|
echo ""
|
|
read -p "Install Laravel Telescope for development debugging? [y/N]: " INSTALL_TELESCOPE
|
|
if [[ "$INSTALL_TELESCOPE" =~ ^[Yy]$ ]]; then
|
|
composer require laravel/telescope --dev
|
|
php artisan telescope:install
|
|
php artisan migrate
|
|
echo "Telescope installed. Access at: /telescope"
|
|
fi
|
|
|
|
# Publish Flare config
|
|
echo ""
|
|
echo "[3/5] Publishing Flare configuration..."
|
|
php artisan vendor:publish --tag=flare-config
|
|
|
|
# Setup Laravel Pint (code style)
|
|
echo ""
|
|
echo "[4/5] Setting up Laravel Pint..."
|
|
if [ -f "../src/pint.json" ]; then
|
|
cp ../pint.json ./pint.json 2>/dev/null || true
|
|
fi
|
|
echo "Pint configured. Run: ./vendor/bin/pint"
|
|
|
|
# Create custom error pages
|
|
echo ""
|
|
echo "[5/5] Creating custom error pages..."
|
|
|
|
mkdir -p resources/views/errors
|
|
|
|
# 500 Error Page
|
|
cat > resources/views/errors/500.blade.php << 'EOF'
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Server Error</title>
|
|
<style>
|
|
body {
|
|
font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
.container {
|
|
background: white;
|
|
border-radius: 16px;
|
|
padding: 48px;
|
|
text-align: center;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
max-width: 500px;
|
|
}
|
|
h1 { color: #1f2937; font-size: 72px; margin: 0; }
|
|
h2 { color: #4b5563; font-weight: 500; margin: 16px 0; }
|
|
p { color: #6b7280; line-height: 1.6; }
|
|
a {
|
|
display: inline-block;
|
|
margin-top: 24px;
|
|
padding: 12px 24px;
|
|
background: #667eea;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
}
|
|
a:hover { background: #5a67d8; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>500</h1>
|
|
<h2>Something went wrong</h2>
|
|
<p>We're sorry, but something unexpected happened. Our team has been notified and is working on it.</p>
|
|
<a href="/">Go Home</a>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
|
|
# 404 Error Page
|
|
cat > resources/views/errors/404.blade.php << 'EOF'
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Page Not Found</title>
|
|
<style>
|
|
body {
|
|
font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
.container {
|
|
background: white;
|
|
border-radius: 16px;
|
|
padding: 48px;
|
|
text-align: center;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
max-width: 500px;
|
|
}
|
|
h1 { color: #1f2937; font-size: 72px; margin: 0; }
|
|
h2 { color: #4b5563; font-weight: 500; margin: 16px 0; }
|
|
p { color: #6b7280; line-height: 1.6; }
|
|
a {
|
|
display: inline-block;
|
|
margin-top: 24px;
|
|
padding: 12px 24px;
|
|
background: #667eea;
|
|
color: white;
|
|
text-decoration: none;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
}
|
|
a:hover { background: #5a67d8; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>404</h1>
|
|
<h2>Page not found</h2>
|
|
<p>The page you're looking for doesn't exist or has been moved.</p>
|
|
<a href="/">Go Home</a>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
|
|
# 503 Maintenance Page
|
|
cat > resources/views/errors/503.blade.php << 'EOF'
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Maintenance Mode</title>
|
|
<style>
|
|
body {
|
|
font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
|
min-height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin: 0;
|
|
padding: 20px;
|
|
}
|
|
.container {
|
|
background: white;
|
|
border-radius: 16px;
|
|
padding: 48px;
|
|
text-align: center;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
max-width: 500px;
|
|
}
|
|
h1 { color: #1f2937; font-size: 48px; margin: 0; }
|
|
h2 { color: #4b5563; font-weight: 500; margin: 16px 0; }
|
|
p { color: #6b7280; line-height: 1.6; }
|
|
.icon { font-size: 64px; margin-bottom: 16px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="icon">🔧</div>
|
|
<h1>Be Right Back</h1>
|
|
<h2>We're doing some maintenance</h2>
|
|
<p>We're making some improvements and will be back shortly. Thanks for your patience!</p>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
EOF
|
|
|
|
echo ""
|
|
echo "=========================================="
|
|
echo "Post-install setup complete!"
|
|
echo "=========================================="
|
|
echo ""
|
|
echo "Next steps:"
|
|
echo " 1. Get your Flare key at: https://flareapp.io"
|
|
echo " 2. Add FLARE_KEY to your .env file"
|
|
echo " 3. Customize error pages in resources/views/errors/"
|
|
echo ""
|
|
echo "Ignition features (development):"
|
|
echo " - AI error explanations"
|
|
echo " - Click-to-open in VS Code"
|
|
echo " - Runnable solution suggestions"
|
|
echo ""
|
|
if [[ "$INSTALL_TELESCOPE" =~ ^[Yy]$ ]]; then
|
|
echo "Telescope dashboard: http://localhost:8080/telescope"
|
|
echo ""
|
|
fi
|