fix /plan
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 2m57s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 2m57s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
@@ -9,6 +9,10 @@ echo "========================================"
|
||||
echo "Current user: $(whoami)"
|
||||
echo "Current directory: $(pwd)"
|
||||
|
||||
# Force debug mode for troubleshooting
|
||||
export APP_DEBUG=true
|
||||
export LOG_LEVEL=debug
|
||||
|
||||
# Create ALL required Laravel directories
|
||||
echo "Creating storage directories..."
|
||||
mkdir -p storage/framework/cache
|
||||
@@ -54,12 +58,33 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
# Generate key if not present
|
||||
if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then
|
||||
# Generate key if not present (only if APP_KEY is empty or missing)
|
||||
echo "Checking .env for APP_KEY..."
|
||||
if ! grep -E "APP_KEY=.{10,}" .env; then
|
||||
echo "APP_KEY is empty or missing. Generating..."
|
||||
echo "Generating application key..."
|
||||
php artisan key:generate --no-interaction --force || echo "Key generation failed"
|
||||
# If the file doesn't have APP_KEY= at all, add it so artisan can replace it
|
||||
if ! grep -q "APP_KEY=" .env; then
|
||||
echo "Appending APP_KEY= placeholder..."
|
||||
echo "" >> .env
|
||||
echo "APP_KEY=" >> .env
|
||||
fi
|
||||
php artisan key:generate --no-interaction --force || echo "❌ Key generation failed!"
|
||||
fi
|
||||
|
||||
echo "Verifying APP_KEY after generation:"
|
||||
grep "APP_KEY" .env
|
||||
|
||||
# Force autoloader regeneration to ensure absolute path consistency
|
||||
echo "Regenerating autoloader..."
|
||||
composer dump-autoload
|
||||
|
||||
# Verify vendor integrity at PHP level
|
||||
echo "Checking vendor visibility and READABILITY for PHP..."
|
||||
ls -la /var/www/html/vendor/laravel/prompts/src/helpers.php
|
||||
php -r 'if (file_exists("/var/www/html/vendor/laravel/prompts/src/helpers.php")) { echo "✅ file_exists true\n"; }'
|
||||
php -r 'require "/var/www/html/vendor/laravel/prompts/src/helpers.php"; echo "✅ PHP successfully REQUIRED helpers.php\n";'
|
||||
|
||||
# Clear all caches to ensure fresh state
|
||||
echo "Clearing caches..."
|
||||
php artisan config:clear || true
|
||||
@@ -85,9 +110,9 @@ echo "========================================"
|
||||
|
||||
# Start the application with proper error handling
|
||||
if [ "$MODE" = "staging" ]; then
|
||||
echo "Starting PHP built-in server on port 8000..."
|
||||
# Use exec with error capture
|
||||
exec php artisan serve --host=0.0.0.0 --port=8000 2>&1 | tee -a /var/log/php-server.log
|
||||
echo "Starting DIRECT PHP server on port 8000 (Bypassing artisan serve)..."
|
||||
# Use direct php -S to eliminate any artisan wrapper issues
|
||||
exec php -d opcache.enable=0 -S 0.0.0.0:8000 -t public server.php 2>&1 | tee -a /var/log/php-server.log
|
||||
else
|
||||
echo "Starting PHP-FPM on port 9000..."
|
||||
# Ensure PHP-FPM is properly configured
|
||||
|
||||
Reference in New Issue
Block a user