Files
merchbay/start-local.sh
Frank John Begornia 02c7f4e2aa Refactor Docker setup for Laravel 5.0 compatibility and optimize deployment process
- Updated Dockerfile configurations for various environments (alpine, basic, cloudrun, minimal, simple, test) to ensure compatibility with Laravel 5.0 and PHP 5.6.
- Added PHP compatibility documentation outlining mcrypt requirements and upgrade paths.
- Created cloudbuild.yaml for Google Cloud Build integration to streamline deployment to Cloud Run.
- Introduced docker-compose.local.yml for local development with MySQL and Redis services.
- Enhanced rebuild.sh script for easier local development and migration handling.
- Updated Laravel Blade views to correct asset paths.
- Added start-local.sh script for quick local setup and service management.
2025-08-11 23:14:31 +08:00

67 lines
2.1 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Quick start script for local development and testing before Cloud Run deployment
set -e
echo "🚀 Starting Merchbay Laravel Application Setup..."
# Check if Docker is running
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker is not running. Please start Docker and try again."
exit 1
fi
# Determine which docker compose command to use
if command -v docker-compose > /dev/null 2>&1; then
DOCKER_COMPOSE="docker-compose"
elif docker compose version > /dev/null 2>&1; then
DOCKER_COMPOSE="docker compose"
else
echo "❌ Neither 'docker-compose' nor 'docker compose' is available."
echo "Please install Docker Compose and try again."
exit 1
fi
echo " Using: $DOCKER_COMPOSE"
# Check if .env file exists
if [ ! -f .env ]; then
echo "📄 Creating .env file from .env.example..."
cp .env.example .env
echo "✅ .env file created. Please update it with your configuration."
fi
# Build and start services
echo "🔨 Building Docker images..."
$DOCKER_COMPOSE -f docker-compose.local.yml build
echo "🚀 Starting services..."
$DOCKER_COMPOSE -f docker-compose.local.yml up -d
echo "⏳ Waiting for services to be ready..."
sleep 30
# Run Laravel setup commands
echo "🔧 Setting up Laravel..."
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan key:generate
#$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan migrate --force
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan config:cache
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan route:cache
$DOCKER_COMPOSE -f docker-compose.local.yml exec app php artisan view:cache
echo "✅ Setup complete!"
echo ""
echo "🌐 Your application is now running at:"
echo " Application: http://localhost:8080"
echo " phpMyAdmin: http://localhost:8081"
echo ""
echo "📊 Check logs with:"
echo " $DOCKER_COMPOSE -f docker-compose.local.yml logs -f app"
echo ""
echo "🛑 Stop the application with:"
echo " $DOCKER_COMPOSE -f docker-compose.local.yml down"
echo ""
echo "🚀 When ready to deploy to Cloud Run, use:"
echo " gcloud builds submit --config=cloudbuild.yaml"