Files
geutebruck/geutebruck-api/scripts/setup_dev_environment.ps1
Administrator 14893e62a5 feat: Geutebruck GeViScope/GeViSoft Action Mapping System - MVP
This MVP release provides a complete full-stack solution for managing action mappings
in Geutebruck's GeViScope and GeViSoft video surveillance systems.

## Features

### Flutter Web Application (Port 8081)
- Modern, responsive UI for managing action mappings
- Action picker dialog with full parameter configuration
- Support for both GSC (GeViScope) and G-Core server actions
- Consistent UI for input and output actions with edit/delete capabilities
- Real-time action mapping creation, editing, and deletion
- Server categorization (GSC: prefix for GeViScope, G-Core: prefix for G-Core servers)

### FastAPI REST Backend (Port 8000)
- RESTful API for action mapping CRUD operations
- Action template service with comprehensive action catalog (247 actions)
- Server management (G-Core and GeViScope servers)
- Configuration tree reading and writing
- JWT authentication with role-based access control
- PostgreSQL database integration

### C# SDK Bridge (gRPC, Port 50051)
- Native integration with GeViSoft SDK (GeViProcAPINET_4_0.dll)
- Action mapping creation with correct binary format
- Support for GSC and G-Core action types
- Proper Camera parameter inclusion in action strings (fixes CrossSwitch bug)
- Action ID lookup table with server-specific action IDs
- Configuration reading/writing via SetupClient

## Bug Fixes
- **CrossSwitch Bug**: GSC and G-Core actions now correctly display camera/PTZ head parameters in GeViSet
- Action strings now include Camera parameter: `@ PanLeft (Comment: "", Camera: 101028)`
- Proper filter flags and VideoInput=0 for action mappings
- Correct action ID assignment (4198 for GSC, 9294 for G-Core PanLeft)

## Technical Stack
- **Frontend**: Flutter Web, Dart, Dio HTTP client
- **Backend**: Python FastAPI, PostgreSQL, Redis
- **SDK Bridge**: C# .NET 8.0, gRPC, GeViSoft SDK
- **Authentication**: JWT tokens
- **Configuration**: GeViSoft .set files (binary format)

## Credentials
- GeViSoft/GeViScope: username=sysadmin, password=masterkey
- Default admin: username=admin, password=admin123

## Deployment
All services run on localhost:
- Flutter Web: http://localhost:8081
- FastAPI: http://localhost:8000
- SDK Bridge gRPC: localhost:50051
- GeViServer: localhost (default port)

Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-31 18:10:54 +01:00

157 lines
5.9 KiB
PowerShell

# 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