Phase 1 Complete: Project Setup & Configuration
Completed Tasks (T001-T010): - ✅ Project structure created (src/, tests/, docs/, scripts/) - ✅ Python dependencies defined (requirements.txt) - ✅ C# SDK Bridge project initialized (.csproj) - ✅ Configuration template (.env.example) - ✅ Database migration config (alembic.ini) - ✅ Code quality tools (pyproject.toml with ruff, black, mypy) - ✅ Development setup script (setup_dev_environment.ps1) - ✅ Service startup script (start_services.ps1) - ✅ Architecture documentation (docs/architecture.md) - ✅ Revised MVP tasks (tasks-revised-mvp.md - 84 tasks focused on cross-switching) MVP Scope Refined: - Focus: Cross-switching control for GSCView viewers - NO recordings, NO analytics, NO LPR in MVP - REST API only, no UI needed - Phase 2: GeViSet configuration management Ready for Phase 2: SDK Bridge Foundation 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
156
scripts/setup_dev_environment.ps1
Normal file
156
scripts/setup_dev_environment.ps1
Normal file
@@ -0,0 +1,156 @@
|
||||
# Geutebruck API - Development Environment Setup Script
|
||||
# This script sets up the complete development environment
|
||||
|
||||
param(
|
||||
[switch]$SkipPython,
|
||||
[switch]$SkipDotnet,
|
||||
[switch]$SkipDatabase,
|
||||
[switch]$SkipRedis
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Geutebruck API - Development Setup" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
$RepoRoot = Split-Path -Parent $PSScriptRoot
|
||||
|
||||
# Function to check if command exists
|
||||
function Test-Command {
|
||||
param($Command)
|
||||
$null = Get-Command $Command -ErrorAction SilentlyContinue
|
||||
return $?
|
||||
}
|
||||
|
||||
# Check Prerequisites
|
||||
Write-Host "[1/8] Checking prerequisites..." -ForegroundColor Yellow
|
||||
|
||||
if (-not $SkipPython) {
|
||||
if (-not (Test-Command python)) {
|
||||
Write-Host "ERROR: Python 3.11+ is required but not found" -ForegroundColor Red
|
||||
Write-Host "Please install Python from https://www.python.org/downloads/" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$pythonVersion = python --version
|
||||
Write-Host " ✓ Python found: $pythonVersion" -ForegroundColor Green
|
||||
}
|
||||
|
||||
if (-not $SkipDotnet) {
|
||||
if (-not (Test-Command dotnet)) {
|
||||
Write-Host "ERROR: .NET 8.0 SDK is required but not found" -ForegroundColor Red
|
||||
Write-Host "Please install from https://dotnet.microsoft.com/download" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
$dotnetVersion = dotnet --version
|
||||
Write-Host " ✓ .NET SDK found: $dotnetVersion" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Create .env file if it doesn't exist
|
||||
Write-Host "[2/8] Setting up environment configuration..." -ForegroundColor Yellow
|
||||
if (-not (Test-Path "$RepoRoot\.env")) {
|
||||
Copy-Item "$RepoRoot\.env.example" "$RepoRoot\.env"
|
||||
Write-Host " ✓ Created .env file from .env.example" -ForegroundColor Green
|
||||
Write-Host " ⚠ IMPORTANT: Edit .env to configure your settings!" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " ✓ .env file already exists" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Setup Python virtual environment
|
||||
if (-not $SkipPython) {
|
||||
Write-Host "[3/8] Setting up Python virtual environment..." -ForegroundColor Yellow
|
||||
|
||||
if (-not (Test-Path "$RepoRoot\.venv")) {
|
||||
python -m venv "$RepoRoot\.venv"
|
||||
Write-Host " ✓ Created Python virtual environment" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " ✓ Virtual environment already exists" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Activate virtual environment
|
||||
& "$RepoRoot\.venv\Scripts\Activate.ps1"
|
||||
|
||||
# Upgrade pip
|
||||
python -m pip install --upgrade pip | Out-Null
|
||||
|
||||
# Install Python dependencies
|
||||
Write-Host "[4/8] Installing Python dependencies..." -ForegroundColor Yellow
|
||||
pip install -r "$RepoRoot\requirements.txt"
|
||||
Write-Host " ✓ Python dependencies installed" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "[3/8] Skipping Python setup" -ForegroundColor Gray
|
||||
Write-Host "[4/8] Skipping Python dependencies" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Build SDK Bridge
|
||||
if (-not $SkipDotnet) {
|
||||
Write-Host "[5/8] Building SDK Bridge (.NET gRPC service)..." -ForegroundColor Yellow
|
||||
|
||||
$sdkBridgePath = "$RepoRoot\src\sdk-bridge\GeViScopeBridge"
|
||||
if (Test-Path "$sdkBridgePath\GeViScopeBridge.csproj") {
|
||||
Push-Location $sdkBridgePath
|
||||
dotnet restore
|
||||
dotnet build --configuration Debug
|
||||
Pop-Location
|
||||
Write-Host " ✓ SDK Bridge built successfully" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " ⚠ SDK Bridge project not found, skipping" -ForegroundColor Yellow
|
||||
}
|
||||
} else {
|
||||
Write-Host "[5/8] Skipping .NET build" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Setup PostgreSQL Database
|
||||
if (-not $SkipDatabase) {
|
||||
Write-Host "[6/8] Setting up PostgreSQL database..." -ForegroundColor Yellow
|
||||
|
||||
if (Test-Command psql) {
|
||||
# Create database
|
||||
Write-Host " Creating database 'geutebruck_api'..." -ForegroundColor Cyan
|
||||
$createDbCommand = @"
|
||||
CREATE DATABASE geutebruck_api;
|
||||
CREATE USER geutebruck WITH PASSWORD 'geutebruck';
|
||||
GRANT ALL PRIVILEGES ON DATABASE geutebruck_api TO geutebruck;
|
||||
"@
|
||||
|
||||
Write-Host " Run these commands manually in psql:" -ForegroundColor Yellow
|
||||
Write-Host $createDbCommand -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host " Then run: alembic upgrade head" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host " ⚠ PostgreSQL not found. Install PostgreSQL 14+ manually" -ForegroundColor Yellow
|
||||
Write-Host " Download from: https://www.postgresql.org/download/windows/" -ForegroundColor Yellow
|
||||
}
|
||||
} else {
|
||||
Write-Host "[6/8] Skipping database setup" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Check Redis
|
||||
if (-not $SkipRedis) {
|
||||
Write-Host "[7/8] Checking Redis..." -ForegroundColor Yellow
|
||||
|
||||
if (Test-Command redis-server) {
|
||||
Write-Host " ✓ Redis found" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host " ⚠ Redis not found. Install Redis for Windows:" -ForegroundColor Yellow
|
||||
Write-Host " Option 1: choco install redis-64" -ForegroundColor Yellow
|
||||
Write-Host " Option 2: Download from https://redis.io/download" -ForegroundColor Yellow
|
||||
}
|
||||
} else {
|
||||
Write-Host "[7/8] Skipping Redis check" -ForegroundColor Gray
|
||||
}
|
||||
|
||||
# Summary
|
||||
Write-Host "[8/8] Setup complete!" -ForegroundColor Yellow
|
||||
Write-Host ""
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "Next Steps:" -ForegroundColor Cyan
|
||||
Write-Host "========================================" -ForegroundColor Cyan
|
||||
Write-Host "1. Edit .env file with your GeViServer credentials" -ForegroundColor White
|
||||
Write-Host "2. Ensure PostgreSQL is running and database is created" -ForegroundColor White
|
||||
Write-Host "3. Run database migrations: alembic upgrade head" -ForegroundColor White
|
||||
Write-Host "4. Ensure Redis is running: redis-server" -ForegroundColor White
|
||||
Write-Host "5. Start services: .\scripts\start_services.ps1" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Development Environment Ready! 🚀" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user