G-1: 메신저 Webhook Relay + _send_to_room 실제 httpx 호출 구현 G-2: POST /api/tasks/bulk SR 대량작업 엔드포인트 (최대 100건) G-3: 라이선스 만료 알림 스케줄러 (매일 09:00 KST) G-4: 체험판 upgrade_banner 필드 + license.py 배너 로직 G-5: core/auto_rca.py + incidents/problem auto-rca 엔드포인트 G-6: core/deploy_impact.py + vibe impact-analysis 엔드포인트 G-7: core/ticket_classifier.py + SR 생성 시 AI 분류 + ai-suggestion API G-8: VulnPatchRecord 모델 + vuln_scan 패치추적 4개 엔드포인트 G-9: core/jira_sync.py + gateway Jira/Confluence 연동 엔드포인트 G-10: core/push_notify.py + routers/push.py + PushSubscription 모델 G-11: approvals 다중승인 (위임/서명/기한초과/마감연장) G-12: alembic.ini + migrations/ + cicd/migrate_to_postgres.sh 하네스: guardia-orchestrator 확장기능 Phase 반영 봇명령어: /sr /status /license /bulk 슬래시 명령어 추가 설치스크립트: setup/ (Ubuntu, CentOS, RHEL, Windows) --test 옵션 포함 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
128 lines
5.8 KiB
PowerShell
128 lines
5.8 KiB
PowerShell
# GUARDiA ITSM — Ollama 로컬 LLM 환경 구축 스크립트
|
||
# 실행: PowerShell 관리자 권한으로 실행
|
||
# .\setup.ps1
|
||
|
||
param(
|
||
[switch]$SkipInstall,
|
||
[switch]$PullModels,
|
||
[string]$Model = "llama3.1:8b"
|
||
)
|
||
|
||
$ErrorActionPreference = "Stop"
|
||
$OLLAMA_URL = "https://ollama.com/download/OllamaSetup.exe"
|
||
$OLLAMA_DIR = "$env:LOCALAPPDATA\Programs\Ollama"
|
||
$GUARDIA_PORT = 11434
|
||
|
||
Write-Host "==================================================" -ForegroundColor Cyan
|
||
Write-Host " GUARDiA ITSM × Ollama 로컬 LLM 환경 구축" -ForegroundColor Cyan
|
||
Write-Host "==================================================" -ForegroundColor Cyan
|
||
|
||
# ── 1. Ollama 설치 확인 ─────────────────────────────────────────
|
||
Write-Host "`n[1/5] Ollama 설치 확인..." -ForegroundColor Yellow
|
||
|
||
$ollamaCmd = Get-Command ollama -ErrorAction SilentlyContinue
|
||
if ($ollamaCmd) {
|
||
$version = & ollama --version 2>&1
|
||
Write-Host " ✅ Ollama 이미 설치됨: $version" -ForegroundColor Green
|
||
} elseif (-not $SkipInstall) {
|
||
Write-Host " 📥 Ollama 다운로드 중..." -ForegroundColor Yellow
|
||
$installer = "$env:TEMP\OllamaSetup.exe"
|
||
Invoke-WebRequest -Uri $OLLAMA_URL -OutFile $installer -UseBasicParsing
|
||
Write-Host " 🔧 Ollama 설치 중..." -ForegroundColor Yellow
|
||
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
|
||
$env:PATH += ";$OLLAMA_DIR"
|
||
Write-Host " ✅ Ollama 설치 완료" -ForegroundColor Green
|
||
Remove-Item $installer -Force
|
||
} else {
|
||
Write-Host " ⚠️ Ollama 미설치. https://ollama.com 에서 수동 설치 후 재실행" -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
|
||
# ── 2. Ollama 서비스 시작 ────────────────────────────────────────
|
||
Write-Host "`n[2/5] Ollama 서비스 시작..." -ForegroundColor Yellow
|
||
|
||
$ollamaProcess = Get-Process -Name "ollama" -ErrorAction SilentlyContinue
|
||
if (-not $ollamaProcess) {
|
||
Start-Process -FilePath "ollama" -ArgumentList "serve" -WindowStyle Hidden
|
||
Start-Sleep -Seconds 3
|
||
Write-Host " ✅ Ollama 서비스 시작됨 (포트: $GUARDIA_PORT)" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " ✅ Ollama 서비스 이미 실행 중" -ForegroundColor Green
|
||
}
|
||
|
||
# ── 3. 서비스 헬스체크 ───────────────────────────────────────────
|
||
Write-Host "`n[3/5] 서비스 헬스체크..." -ForegroundColor Yellow
|
||
|
||
$maxRetry = 10
|
||
$retry = 0
|
||
$healthy = $false
|
||
while ($retry -lt $maxRetry) {
|
||
try {
|
||
$resp = Invoke-RestMethod -Uri "http://localhost:$GUARDIA_PORT/api/tags" -TimeoutSec 3
|
||
$healthy = $true
|
||
break
|
||
} catch {
|
||
$retry++
|
||
Start-Sleep -Seconds 2
|
||
Write-Host " 대기 중... ($retry/$maxRetry)" -ForegroundColor DarkGray
|
||
}
|
||
}
|
||
|
||
if (-not $healthy) {
|
||
Write-Host " ❌ Ollama 서비스 응답 없음. 수동으로 'ollama serve' 실행하세요." -ForegroundColor Red
|
||
exit 1
|
||
}
|
||
Write-Host " ✅ Ollama API 응답 정상 (http://localhost:$GUARDIA_PORT)" -ForegroundColor Green
|
||
|
||
# ── 4. 모델 다운로드 ─────────────────────────────────────────────
|
||
Write-Host "`n[4/5] GUARDiA 추천 모델 다운로드..." -ForegroundColor Yellow
|
||
|
||
$models = @(
|
||
@{ Name = "llama3.1:8b"; Desc = "일반 에이전트 (균형잡힌 성능)"; Size = "~4.7GB" },
|
||
@{ Name = "codellama:7b"; Desc = "코드 생성 에이전트 (Developer용)"; Size = "~3.8GB" }
|
||
)
|
||
|
||
foreach ($m in $models) {
|
||
Write-Host " 📦 $($m.Name) — $($m.Desc) [$($m.Size)]" -ForegroundColor White
|
||
|
||
# 이미 있는지 확인
|
||
$existingModels = & ollama list 2>&1
|
||
if ($existingModels -match $m.Name.Split(":")[0]) {
|
||
Write-Host " ✅ 이미 설치됨" -ForegroundColor Green
|
||
continue
|
||
}
|
||
|
||
if ($PullModels) {
|
||
Write-Host " 📥 다운로드 중 (시간이 걸릴 수 있습니다)..." -ForegroundColor Yellow
|
||
& ollama pull $m.Name
|
||
Write-Host " ✅ 다운로드 완료" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " ⏭️ 스킵 (다운로드하려면 -PullModels 옵션 사용)" -ForegroundColor DarkGray
|
||
}
|
||
}
|
||
|
||
# ── 5. GUARDiA 커스텀 모델 생성 ─────────────────────────────────
|
||
Write-Host "`n[5/5] GUARDiA 커스텀 모델 생성..." -ForegroundColor Yellow
|
||
|
||
$modelfilePath = "$PSScriptRoot\Modelfile.guardia"
|
||
if (Test-Path $modelfilePath) {
|
||
& ollama create guardia-agent -f $modelfilePath
|
||
Write-Host " ✅ guardia-agent 모델 생성 완료" -ForegroundColor Green
|
||
} else {
|
||
Write-Host " ⚠️ Modelfile.guardia 없음 — 커스텀 모델 생성 스킵" -ForegroundColor DarkGray
|
||
}
|
||
|
||
# ── 완료 요약 ────────────────────────────────────────────────────
|
||
Write-Host "`n==================================================" -ForegroundColor Cyan
|
||
Write-Host " ✅ Ollama 환경 구축 완료!" -ForegroundColor Cyan
|
||
Write-Host "==================================================" -ForegroundColor Cyan
|
||
Write-Host ""
|
||
Write-Host " Ollama API: http://localhost:$GUARDIA_PORT" -ForegroundColor White
|
||
Write-Host " 설치된 모델: $(& ollama list 2>&1 | Select-Object -Skip 1 | Measure-Object -Line | Select-Object -ExpandProperty Lines)개" -ForegroundColor White
|
||
Write-Host ""
|
||
Write-Host " 다음 단계: GUARDiA ITSM 시작" -ForegroundColor Yellow
|
||
Write-Host " cd C:\GUARDiA\itsm" -ForegroundColor Gray
|
||
Write-Host " uvicorn main:app --reload --port 8000" -ForegroundColor Gray
|
||
Write-Host ""
|
||
Write-Host " 에이전트 대시보드: http://localhost:8000/agents" -ForegroundColor Yellow
|