- appsettings.Production.json: Photos:RootPath -> C:\gerbil-data\photos so photo files land on a stable host path when ASPNETCORE_ENVIRONMENT=Production - Start-GerbilManager.ps1: creates data dirs, sets Production env, launches AppHost minimised; saves PID for Stop script - Stop-GerbilManager.ps1: kills AppHost + Vite node processes by PID / port - Register-AutoStart.ps1: Windows Scheduled Task on user logon (RunLevel Highest) - Register-BackupTask.ps1: daily 03:00 Scheduled Task for Backup script - deploy/README.md: Julian ops guide — start/stop commands, phone URL, DHCP reservation, firewall rule (Public-profile Wi-Fi), backup/restore procedures, prerequisites checklist, troubleshooting table (German) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
73 lines
2.5 KiB
PowerShell
73 lines
2.5 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Startet GerbilManager im Produktionsmodus (API + Datenbank + Frontend).
|
|
|
|
.DESCRIPTION
|
|
Setzt die Produktionsumgebung, legt Datenverzeichnisse an und startet den
|
|
Aspire AppHost im Hintergrund. Der Prozess laeuft als minimiertes Fenster.
|
|
Der Pfad zum AppHost wird relativ zu diesem Skript aufgeloest.
|
|
|
|
.NOTES
|
|
Erfordert: .NET SDK 10+, Docker Desktop (running), Node.js 18+
|
|
Startet auf: http://<LAN-IP>:5173 (Frontend), http://<LAN-IP>:5179 (API)
|
|
#>
|
|
param(
|
|
[switch]$Wait # Blockiert bis Ctrl+C wenn gesetzt (fuer manuelle Starts)
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$projectRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
|
|
|
|
# --- Datenverzeichnisse sicherstellen ---
|
|
$dataRoot = "C:\gerbil-data"
|
|
$photosDir = "$dataRoot\photos"
|
|
$backupsDir = "$dataRoot\backups"
|
|
|
|
foreach ($dir in @($photosDir, $backupsDir)) {
|
|
if (-not (Test-Path $dir)) {
|
|
New-Item -ItemType Directory -Force -Path $dir | Out-Null
|
|
Write-Host "Verzeichnis angelegt: $dir"
|
|
}
|
|
}
|
|
|
|
# --- Produktionsumgebung setzen ---
|
|
$env:ASPNETCORE_ENVIRONMENT = "Production"
|
|
$env:DOTNET_ENVIRONMENT = "Production"
|
|
|
|
# Aspire Dashboard-Browser nicht automatisch oeffnen
|
|
$env:DOTNET_LAUNCH_BROWSER = "false"
|
|
# Kein Aspire Dashboard im Produktionsbetrieb (Dashboard-Port auf 0 → kein Start)
|
|
# Entfernen Sie die naechste Zeile, wenn Sie das Dashboard behalten moechten.
|
|
$env:ASPIRE_ALLOW_UNSECURED_TRANSPORT = "true"
|
|
|
|
# --- AppHost starten ---
|
|
$appHostProject = Join-Path $projectRoot "GerbilManager.AppHost"
|
|
|
|
Write-Host "Starte GerbilManager..."
|
|
Write-Host " Projekt : $appHostProject"
|
|
Write-Host " Umgebung: $($env:ASPNETCORE_ENVIRONMENT)"
|
|
Write-Host " Fotos : $photosDir"
|
|
Write-Host ""
|
|
|
|
if ($Wait) {
|
|
# Interaktiver Modus: blockiert bis Ctrl+C
|
|
dotnet run --project $appHostProject --no-launch-profile
|
|
} else {
|
|
# Hintergrundmodus: startet minimiertes Fenster
|
|
$pidFile = Join-Path $PSScriptRoot "..\gerbilmanager.pid"
|
|
$proc = Start-Process "cmd.exe" `
|
|
-ArgumentList "/c", "dotnet run --project `"$appHostProject`" --no-launch-profile" `
|
|
-WorkingDirectory $projectRoot `
|
|
-WindowStyle Minimized `
|
|
-PassThru
|
|
$proc.Id | Out-File -FilePath $pidFile -Encoding UTF8 -Force
|
|
Write-Host "GerbilManager gestartet (PID $($proc.Id))."
|
|
Write-Host "Frontend : http://localhost:5173"
|
|
Write-Host "API : http://localhost:5179"
|
|
Write-Host "PID-Datei: $pidFile"
|
|
Write-Host ""
|
|
Write-Host "Zum Beenden: deploy\scripts\Stop-GerbilManager.ps1"
|
|
}
|