| |
| |
| |
| |
|
|
| Write-Host "==========================================" -ForegroundColor Cyan |
| Write-Host " Starting SaaS Local Dev Environment" -ForegroundColor Cyan |
| Write-Host "==========================================" -ForegroundColor Cyan |
|
|
| |
| Write-Host "`n[1/3] Checking Docker daemon..." -ForegroundColor Yellow |
| $dockerInfo = docker info 2>&1 |
| if ($LASTEXITCODE -ne 0) { |
| Write-Host "Docker is not running. Attempting to start Docker Desktop..." -ForegroundColor Yellow |
| $dockerPath = "C:\Program Files\Docker\Docker\Docker Desktop.exe" |
| if (Test-Path $dockerPath) { |
| Start-Process -FilePath $dockerPath |
| Write-Host "Waiting for Docker to start (this may take a minute)..." |
| while ($true) { |
| Start-Sleep -Seconds 3 |
| docker info >$null 2>&1 |
| if ($LASTEXITCODE -eq 0) { |
| Write-Host "Docker is now running!" -ForegroundColor Green |
| break |
| } |
| Write-Host "." -NoNewline |
| } |
| Write-Host "" |
| } else { |
| Write-Host "Error: Could not find Docker Desktop at $dockerPath. Please start Docker manually." -ForegroundColor Red |
| exit 1 |
| } |
| } else { |
| Write-Host "Docker is already running!" -ForegroundColor Green |
| } |
|
|
| |
| Write-Host "`n[2/3] Starting Database and Web Application via Docker Compose..." -ForegroundColor Yellow |
| docker-compose up -d --build |
| if ($LASTEXITCODE -ne 0) { |
| Write-Host "Failed to start docker containers!" -ForegroundColor Red |
| exit 1 |
| } |
| Write-Host "Containers are up and running!" -ForegroundColor Green |
|
|
| |
| Write-Host "`n[3/3] Generating public ngrok URL..." -ForegroundColor Yellow |
| Write-Host "Starting ngrok on port 8000..." -ForegroundColor Green |
| ngrok http 8000 |
|
|