hezarfen_rule_based_chatbot
Clone
https://git.tahinli.com/archive/hezarfen_rule_based_chatbot.git
0 watching0 forksPython1.2 MiB3c4e59dKadir Yönak3 months ago15 commits
| 1 | # Hezarfen — Podman stack'i ayağa kaldırır. |
| 2 | # 1) Tüm Containerfile base imajlarını pre-pull eder (docker.io anonim-pull auth |
| 3 | # hatalarını build sırasında yaşamamak için). |
| 4 | # 2) podman compose up -d --build. |
| 5 | # 3) Doğrular ve localhost adreslerini basar. |
| 6 | # Ön koşul: deploy/setup-podman-wsl.ps1 bir kez çalıştırılmış olmalı. |
| 7 | # Çalıştır: pwsh -File deploy/run-stack.ps1 |
| 8 | $ErrorActionPreference = "Stop" |
| 9 | |
| 10 | function Find-Podman { |
| 11 | $c = (Get-Command podman -ErrorAction SilentlyContinue).Source |
| 12 | if ($c) { return $c } |
| 13 | foreach ($p in @("$env:LOCALAPPDATA\Programs\Podman\podman.exe", |
| 14 | "$env:ProgramFiles\RedHat\Podman\podman.exe")) { |
| 15 | if (Test-Path $p) { return $p } |
| 16 | } |
| 17 | throw "podman.exe bulunamadı." |
| 18 | } |
| 19 | $PODMAN = Find-Podman |
| 20 | $compose = Join-Path $PSScriptRoot "compose.yaml" |
| 21 | $parent = Resolve-Path (Join-Path $PSScriptRoot "..\..") |
| 22 | |
| 23 | & $PODMAN machine start *> $null 2>&1 |
| 24 | |
| 25 | Write-Host "[1/3] Base imajlar pre-pull ediliyor..." |
| 26 | $cfiles = @( |
| 27 | (Join-Path $parent "hezarfen_backend\Containerfile"), |
| 28 | (Join-Path $parent "hezarfen_frontend\Containerfile"), |
| 29 | (Join-Path $parent "Hezarfen-Rule-Based-Chatbot\Containerfile") |
| 30 | ) |
| 31 | $bases = @("docker.io/surrealdb/surrealdb:v3") |
| 32 | foreach ($cf in $cfiles) { |
| 33 | if (Test-Path $cf) { |
| 34 | Select-String -Path $cf -Pattern '^\s*FROM\s+(\S+)' | ForEach-Object { |
| 35 | $bases += $_.Matches[0].Groups[1].Value |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | $bases = $bases | Sort-Object -Unique |
| 40 | foreach ($img in $bases) { |
| 41 | Write-Host " pull $img" |
| 42 | & $PODMAN pull $img *> $null 2>&1 |
| 43 | } |
| 44 | |
| 45 | Write-Host "`n[2/3] podman compose up -d --build (backend Rust ilk seferde uzun sürer)..." |
| 46 | & $PODMAN compose -f $compose up -d --build |
| 47 | if ($LASTEXITCODE -ne 0) { throw "compose up başarısız (build log'una bak)." } |
| 48 | |
| 49 | Write-Host "`n[3/3] Doğrulama..." |
| 50 | Start-Sleep -Seconds 6 |
| 51 | & $PODMAN ps --format "{{.Names}} {{.Status}}" |
| 52 | foreach ($p in 8080,5173) { |
| 53 | try { |
| 54 | $code = (Invoke-WebRequest -UseBasicParsing -Uri "http://localhost:$p/" -TimeoutSec 6).StatusCode |
| 55 | Write-Host " localhost:$p -> HTTP $code" |
| 56 | } catch { Write-Host " localhost:$p -> erişilemedi ($($_.Exception.Message))" } |
| 57 | } |
| 58 | Write-Host "`n✅ Hazır. Test: http://localhost:5173 (giriş: admin / admin123)" |