52 lines
No EOL
1.3 KiB
Bash
Executable file
52 lines
No EOL
1.3 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
# Copy development environment configuration to backend
|
|
cp /var/www/html/docker/dev/podman/.env.dev /var/www/html/backend/.env
|
|
|
|
# Setup nginx configuration for development
|
|
cp /var/www/html/docker/dev/podman/nginx.conf /etc/nginx/sites-available/default
|
|
|
|
# Install/update dependencies
|
|
echo "Installing PHP dependencies..."
|
|
cd /var/www/html/backend
|
|
composer install --no-interaction
|
|
|
|
# Generate application key
|
|
echo "Generating application key..."
|
|
php artisan key:generate --force
|
|
|
|
# Wait for database to be ready
|
|
echo "Waiting for database..."
|
|
while ! mysql -h db -u ffr_user -pffr_password --connect-timeout=2 -e "SELECT 1" >/dev/null 2>&1; do
|
|
echo "Database not ready, waiting..."
|
|
sleep 1
|
|
done
|
|
echo "Database connection established!"
|
|
|
|
# Run migrations and seeders
|
|
php artisan migrate --force
|
|
php artisan db:seed --force
|
|
|
|
# Build frontend if not already built
|
|
cd /var/www/html/frontend
|
|
if [ ! -d "dist" ]; then
|
|
echo "Building React frontend..."
|
|
npm run build
|
|
fi
|
|
|
|
# Start services
|
|
echo "Starting services..."
|
|
|
|
# Start React dev server
|
|
cd /var/www/html/frontend
|
|
npm run dev -- --host 0.0.0.0 --port 5173 &
|
|
|
|
# Start Laravel backend
|
|
cd /var/www/html/backend
|
|
php artisan serve --host=127.0.0.1 --port=8000 &
|
|
|
|
# Start nginx
|
|
nginx -g "daemon off;" &
|
|
|
|
# Wait for background processes
|
|
wait |