- Add frontend service to docker-compose.yml (port 4200) - Simplify quickstart scripts to start all services together - Remove need for separate dev-start scripts and proxy config - Frontend now accessible at http://localhost:4200 with nginx proxying API requests
150 lines
5.9 KiB
PowerShell
150 lines
5.9 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[switch]$Rebuild,
|
|
[switch]$Help
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
if ($Help) {
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Usage: .\quickstart.ps1 [OPTIONS]" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "Options:" -ForegroundColor Yellow
|
|
Write-Host " -Rebuild Force rebuild of all containers" -ForegroundColor White
|
|
Write-Host " -Help Show this help message" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green
|
|
Write-Host ""
|
|
exit 0
|
|
}
|
|
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Check if Docker is installed
|
|
if (-not (Get-Command "docker" -ErrorAction SilentlyContinue)) {
|
|
Write-Host "Error: Docker is not installed. Please install Docker Desktop first." -ForegroundColor Red
|
|
Write-Host "Visit: https://www.docker.com/products/docker-desktop" -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
|
|
# Check if Docker Compose is available
|
|
$ComposeCmd = $null
|
|
if (Get-Command "docker-compose" -ErrorAction SilentlyContinue) {
|
|
$ComposeCmd = "docker-compose"
|
|
} else {
|
|
try {
|
|
& docker compose version | Out-Null
|
|
$ComposeCmd = "docker compose"
|
|
}
|
|
catch {
|
|
Write-Host "Error: Docker Compose is not available." -ForegroundColor Red
|
|
Write-Host "Please ensure Docker Desktop is running." -ForegroundColor Yellow
|
|
Read-Host "Press Enter to exit"
|
|
exit 1
|
|
}
|
|
}
|
|
|
|
# Create .env file if it doesn't exist
|
|
if (-not (Test-Path ".env")) {
|
|
Write-Host "Creating .env file from .env.example..." -ForegroundColor Yellow
|
|
Copy-Item ".env.example" ".env"
|
|
Write-Host "[OK] .env file created" -ForegroundColor Green
|
|
} else {
|
|
Write-Host "[OK] .env file already exists" -ForegroundColor Green
|
|
}
|
|
|
|
Write-Host ""
|
|
|
|
# Handle rebuild logic
|
|
if ($Rebuild) {
|
|
Write-Host "Rebuilding containers..." -ForegroundColor Yellow
|
|
Write-Host "Stopping existing containers..." -ForegroundColor White
|
|
|
|
if ($ComposeCmd -eq "docker compose") {
|
|
& docker compose down
|
|
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
|
|
& docker compose down --rmi local 2>$null
|
|
Write-Host "Building and starting all services..." -ForegroundColor White
|
|
& docker compose up -d --build
|
|
} else {
|
|
& docker-compose down
|
|
Write-Host "Removing existing images for rebuild..." -ForegroundColor White
|
|
& docker-compose down --rmi local 2>$null
|
|
Write-Host "Building and starting all services..." -ForegroundColor White
|
|
& docker-compose up -d --build
|
|
}
|
|
} else {
|
|
Write-Host "Starting all services..." -ForegroundColor Green
|
|
if ($ComposeCmd -eq "docker compose") {
|
|
& docker compose up -d
|
|
} else {
|
|
& docker-compose up -d
|
|
}
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Waiting for services to be ready..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 20
|
|
|
|
Write-Host ""
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host "Complete Stack is running!" -ForegroundColor Green
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
Write-Host "Frontend: http://localhost:4200" -ForegroundColor White
|
|
Write-Host "API: http://localhost:8000" -ForegroundColor White
|
|
Write-Host "API Docs: http://localhost:8000/docs" -ForegroundColor White
|
|
Write-Host "MinIO Console: http://localhost:9001" -ForegroundColor White
|
|
Write-Host " Username: minioadmin" -ForegroundColor Gray
|
|
Write-Host " Password: minioadmin" -ForegroundColor Gray
|
|
Write-Host ""
|
|
Write-Host "To view logs: $ComposeCmd logs -f" -ForegroundColor Yellow
|
|
Write-Host "To stop: $ComposeCmd down" -ForegroundColor Yellow
|
|
Write-Host ""
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host "Testing the API..." -ForegroundColor Cyan
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Wait a bit more for API to be fully ready
|
|
Start-Sleep -Seconds 5
|
|
|
|
# Test health endpoint
|
|
try {
|
|
$response = Invoke-RestMethod -Uri "http://localhost:8000/health" -Method Get -TimeoutSec 10
|
|
if ($response.status -eq "healthy") {
|
|
Write-Host "[OK] API is healthy!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "All services are ready!" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "Example: Upload a test file" -ForegroundColor White
|
|
Write-Host "----------------------------" -ForegroundColor Gray
|
|
Write-Host 'echo "test,data" > test.csv' -ForegroundColor Green
|
|
Write-Host 'curl -X POST "http://localhost:8000/api/v1/artifacts/upload"' -ForegroundColor Green
|
|
Write-Host ' -F "file=@test.csv"' -ForegroundColor Green
|
|
Write-Host ' -F "test_name=sample_test"' -ForegroundColor Green
|
|
Write-Host ' -F "test_suite=demo"' -ForegroundColor Green
|
|
Write-Host ' -F "test_result=pass"' -ForegroundColor Green
|
|
Write-Host ""
|
|
} else {
|
|
Write-Host "[WARNING] API returned unexpected status. Please check http://localhost:8000/health" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
catch {
|
|
Write-Host "[WARNING] API is not responding yet. Please wait a moment and check http://localhost:8000/health" -ForegroundColor Yellow
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|
|
Write-Host "Setup complete!" -ForegroundColor Green
|
|
Write-Host "Open http://localhost:4200 in your browser" -ForegroundColor Yellow
|
|
Write-Host "=========================================" -ForegroundColor Cyan
|