#!/bin/bash # Create .env file if it doesn't exist if [ ! -f /var/www/html/.env ]; then cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env fi # Fix database name to match compose file sed -i 's/DB_DATABASE=incr$/DB_DATABASE=incr_dev/' /var/www/html/.env # Generate app key if not set or empty if ! grep -q "APP_KEY=base64:" /var/www/html/.env; then # Generate a new key and set it directly NEW_KEY=$(php -r "echo 'base64:' . base64_encode(random_bytes(32));") sed -i "s/APP_KEY=/APP_KEY=$NEW_KEY/" /var/www/html/.env fi # Run migrations php artisan migrate --force # Start Laravel development server in background php artisan serve --host=0.0.0.0 --port=8000 & # Start Vite development server npm run dev -- --host 0.0.0.0 # Wait for background processes wait