widgettdc-api / scripts /deploy_windows.ps1.local
Kraft102's picture
fix: sql.js Docker/Alpine compatibility layer for PatternMemory and FailureMemory
5a81b95
# WidgeTDC Windows Deployment Script
Write-Host "Starting WidgeTDC Deployment Protocol (Windows Mode)..." -ForegroundColor Cyan
# 1. Setup Directories
$DataDir = ".\data"
$CivicSchemaDir = "$DataDir\civic_schema"
$ThreatFeedDir = "$DataDir\threat_feeds"
$SourceIntelDir = ".\source_intel"
if (-not (Test-Path $CivicSchemaDir)) { New-Item -ItemType Directory -Force -Path $CivicSchemaDir | Out-Null }
if (-not (Test-Path $ThreatFeedDir)) { New-Item -ItemType Directory -Force -Path $ThreatFeedDir | Out-Null }
# 2. Data Sanitization
$SourceSql = "$DataDir\full_schema.sql"
$TargetSql = "$CivicSchemaDir\init.sql"
if (Test-Path $SourceSql) {
Write-Host "Scrubbing 'full_schema.sql'..." -ForegroundColor Yellow
$content = Get-Content $SourceSql -Raw
$content = $content -replace 'cia_user', 'civic_reader'
$content = $content -replace 'cia', 'civic_vault'
$content = $content -replace 'Citizen Intelligence Agency', 'Civic Insight Node'
Set-Content -Path $TargetSql -Value $content
Write-Host "[OK] Civic Vault Sanitized." -ForegroundColor Green
} else {
Write-Host "[WARN] 'full_schema.sql' not found. Civic Node will start empty." -ForegroundColor Red
"CREATE TABLE IF NOT EXISTS system_status (status VARCHAR(50));" | Set-Content $TargetSql
}
# 3. Threat Feed Staging
if (Test-Path $SourceIntelDir) {
$feeds = Get-ChildItem "$SourceIntelDir\*.md"
if ($feeds) {
Write-Host "Staging Threat Intelligence..." -ForegroundColor Yellow
Copy-Item "$SourceIntelDir\*.md" -Destination $ThreatFeedDir -Force
Write-Host "[OK] Intel Feeds staged." -ForegroundColor Green
}
}
# 4. Launch Docker
Write-Host "Launching Containers..." -ForegroundColor Cyan
docker-compose up -d --build