Files
ERP/start.ps1
T
MMD 934b74ebbd Squashed 'pm/' content from commit 91f3271
git-subtree-dir: pm
git-subtree-split: 91f3271d866fa8ee471cfb6793e334b83e6d2b6e
2026-10-07 15:14:20 +03:30

58 lines
2.2 KiB
PowerShell

# Start the PM Construction Platform stack (postgres + api + frontend)
# Run this from the PM folder:
#
# powershell -ExecutionPolicy Bypass -File .\start.ps1
$ErrorActionPreference = "Stop"
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
Set-Location $here
Write-Host ""
Write-Host "==========================================================" -ForegroundColor Cyan
Write-Host " PM Construction Platform — Starting Docker Containers " -ForegroundColor Cyan
Write-Host "==========================================================" -ForegroundColor Cyan
# 1. Verify Docker Engine is running
try {
docker info > $null 2>&1
if ($LASTEXITCODE -ne 0) {
throw "Docker is not running"
}
}
catch {
Write-Host ""
Write-Host " [ERROR] Docker Desktop is not running or the Docker daemon is unreachable." -ForegroundColor Red
Write-Host " Please start Docker Desktop from the Start Menu, wait until it is running, and try again." -ForegroundColor Yellow
Write-Host ""
exit 1
}
# 2. Ensure erp_default network exists so compose never fails if ERP is not running
$erpNet = docker network ls --filter name=^erp_default$ -q
if (-not $erpNet) {
Write-Host "Creating bridge network 'erp_default' for optional ERP integration..." -ForegroundColor Gray
docker network create erp_default | Out-Null
}
# 3. Build & start containers
Write-Host "Starting containers (build if necessary)..." -ForegroundColor Yellow
docker compose up -d --build
if ($LASTEXITCODE -ne 0) {
Write-Host "Build or startup failed. Run 'docker compose logs' to inspect." -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "Waiting for services to become healthy..." -ForegroundColor Yellow
Start-Sleep -Seconds 5
docker compose ps
Write-Host ""
Write-Host "PM Platform UI : http://localhost:8083" -ForegroundColor Green
Write-Host "PM API Health : http://localhost:8083/api/v1/health" -ForegroundColor Green
Write-Host "Database : localhost:5434 (db: pm, user: pm)" -ForegroundColor Green
Write-Host "Default Admin : admin / pm123456" -ForegroundColor Green
Write-Host ""
Write-Host "Stop: docker compose down | Full reset: docker compose down -v" -ForegroundColor DarkGray