Move 150+ scripts from root and scripts/ into client/project directories: - clients/dataforth/scripts/ (110 files: AD2, sync, SSH, DB, DOS scripts) - clients/bg-builders/scripts/ (14 files: Lesley mgmt, Exchange, termination) - clients/internal-infrastructure/scripts/ (10 files: GDAP, Gitea, backups) - projects/msp-tools/scripts/ (9 files: CIPP, MSP onboarding, Datto) - projects/gururmm-agent/scripts/ (3 files: API test, JWT, record counts) - clients/glaztech/scripts/ (1 file: CentraStage removal) Also reorganized: - VPN scripts → infrastructure/vpn-configs/ - Retrieved API/JS files → api/ - Forum posts → projects/community-forum/forum-posts/ - SSH docs → clients/internal-infrastructure/docs/ - NWTOC/CTONW docs → projects/wrightstown-smarthome/docs/ - ACG website files → projects/internal/acg-website-2025/ - Dataforth docs → clients/dataforth/docs/ - schema-retrieved.sql → docs/database/ Deleted 24 tmp_*.ps1 one-off debug scripts (preserved in git history). Root reduced from 220+ files to 62 items (docs + directories only). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
58 lines
3.3 KiB
PowerShell
58 lines
3.3 KiB
PowerShell
# Deploy Database Performance Optimizations to AD2 (SMB only)
|
|
$password = ConvertTo-SecureString 'Paper123!@#' -AsPlainText -Force
|
|
$cred = New-Object System.Management.Automation.PSCredential('INTRANET\sysadmin', $password)
|
|
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host "Test Database Performance Optimization" -ForegroundColor Cyan
|
|
Write-Host "========================================`n" -ForegroundColor Cyan
|
|
|
|
# Step 1: Mount AD2 share
|
|
Write-Host "[1/4] Mounting AD2 C$ share..." -ForegroundColor Green
|
|
New-PSDrive -Name AD2 -PSProvider FileSystem -Root "\\192.168.0.6\C$" -Credential $cred -ErrorAction Stop | Out-Null
|
|
Write-Host " [OK] Share mounted" -ForegroundColor Green
|
|
|
|
# Step 2: Backup existing api.js
|
|
Write-Host "`n[2/4] Backing up existing api.js..." -ForegroundColor Green
|
|
$timestamp = Get-Date -Format "yyyy-MM-dd-HHmmss"
|
|
$backupPath = "AD2:\Shares\testdatadb\routes\api.js.backup-$timestamp"
|
|
Copy-Item "AD2:\Shares\testdatadb\routes\api.js" $backupPath
|
|
Write-Host " [OK] Backup created: api.js.backup-$timestamp" -ForegroundColor Green
|
|
|
|
# Step 3: Deploy optimized api.js
|
|
Write-Host "`n[3/4] Deploying optimized api.js..." -ForegroundColor Green
|
|
$optimizedContent = Get-Content "D:\ClaudeTools\api-js-optimized.js" -Raw
|
|
$optimizedContent | Set-Content "AD2:\Shares\testdatadb\routes\api.js" -Encoding UTF8
|
|
Write-Host " [OK] Optimized api.js deployed" -ForegroundColor Green
|
|
|
|
# Step 4: Verify deployment
|
|
Write-Host "`n[4/4] Verifying deployment..." -ForegroundColor Green
|
|
$deployedFile = Get-Item "AD2:\Shares\testdatadb\routes\api.js"
|
|
Write-Host " [OK] File size: $($deployedFile.Length) bytes" -ForegroundColor Green
|
|
Write-Host " [OK] Modified: $($deployedFile.LastWriteTime)" -ForegroundColor Green
|
|
|
|
# Cleanup
|
|
Remove-PSDrive -Name AD2 -ErrorAction SilentlyContinue
|
|
|
|
Write-Host "`n========================================" -ForegroundColor Cyan
|
|
Write-Host "Deployment Complete" -ForegroundColor Cyan
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|
Write-Host "[OK] Backup created" -ForegroundColor Green
|
|
Write-Host "[OK] Optimized code deployed" -ForegroundColor Green
|
|
Write-Host "`nOptimizations Applied:" -ForegroundColor Cyan
|
|
Write-Host " - Connection timeout: 10 seconds" -ForegroundColor Cyan
|
|
Write-Host " - WAL mode: Enabled (better concurrency)" -ForegroundColor Cyan
|
|
Write-Host " - Cache size: 64MB" -ForegroundColor Cyan
|
|
Write-Host " - Memory-mapped I/O: 256MB" -ForegroundColor Cyan
|
|
Write-Host " - Synchronous mode: NORMAL (faster, safe)" -ForegroundColor Cyan
|
|
Write-Host "`n[ACTION REQUIRED] Restart Node.js Server:" -ForegroundColor Yellow
|
|
Write-Host " 1. Connect to AD2 (SSH or RDP)" -ForegroundColor Yellow
|
|
Write-Host " 2. Stop existing Node.js process:" -ForegroundColor Yellow
|
|
Write-Host " taskkill /F /IM node.exe" -ForegroundColor Cyan
|
|
Write-Host " 3. Start server:" -ForegroundColor Yellow
|
|
Write-Host " cd C:\Shares\testdatadb" -ForegroundColor Cyan
|
|
Write-Host " node server.js" -ForegroundColor Cyan
|
|
Write-Host "`nWeb Interface: http://192.168.0.6:3000" -ForegroundColor Green
|
|
Write-Host "`nRollback (if needed):" -ForegroundColor Yellow
|
|
Write-Host " Copy-Item C:\Shares\testdatadb\routes\api.js.backup-$timestamp C:\Shares\testdatadb\routes\api.js" -ForegroundColor Cyan
|
|
Write-Host "========================================`n" -ForegroundColor Cyan
|