forge
Explore
Log in

Don't you dare go Hollow

hezarfen_rule_based_chatbot

Clone
★ 0

0 watching0 forksPython1.2 MiBa039b60Ahmet Kaan Gümüş2 months ago64 commits

run-stack.ps161 lines, 2.7 KiBHistoryRawDownload
1# Hezarfen — Podman stack'i PROJE-BAZLI ayağa kaldırır (all-in-one compose YOK).
2# 1) Base imajları pre-pull (docker.io anonim-pull auth hatalarını önlemek için).
3# 2) Her repoyu kendi compose'uyla, doğru sırada başlatır:
4# hezarfen_backend (db+backend, ağı yaratır) -> hezarfen_frontend -> chatbot bridge
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
10function 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$parent = Resolve-Path (Join-Path $PSScriptRoot "..\..")
21$backend = Join-Path $parent "hezarfen_backend"
22$frontend = Join-Path $parent "hezarfen_frontend"
23$chatbot = Join-Path $parent "Hezarfen-Rule-Based-Chatbot"
24
25& $PODMAN machine start *> $null 2>&1
26
27Write-Host "[1/3] Base imajlar pre-pull ediliyor..."
28$bases = @("docker.io/surrealdb/surrealdb:v3")
29foreach ($cf in @((Join-Path $backend "Containerfile"),
30 (Join-Path $frontend "Containerfile"),
31 (Join-Path $chatbot "Containerfile"))) {
32 if (Test-Path $cf) {
33 Select-String -Path $cf -Pattern '^\s*FROM\s+(\S+)' | ForEach-Object {
34 $bases += $_.Matches[0].Groups[1].Value
35 }
36 }
37}
38foreach ($img in ($bases | Sort-Object -Unique)) {
39 Write-Host " pull $img"; & $PODMAN pull $img *> $null 2>&1
40}
41
42Write-Host "`n[2/3] Proje-bazlı up (backend Rust ilk seferde uzun sürer)..."
43function Compose-Up([string]$dir, [string[]]$extra) {
44 Push-Location $dir
45 try { & $PODMAN compose @extra up -d --build; if ($LASTEXITCODE -ne 0) { throw "compose up başarısız: $dir" } }
46 finally { Pop-Location }
47}
48Compose-Up $backend @() # ağı (hezarfen_backend_default) yaratır
49Compose-Up $frontend @() # backend ağına bağlanır
50Compose-Up $chatbot @() # yalnız bridge; backend ağına dial-in eder
51
52Write-Host "`n[3/3] Doğrulama..."
53Start-Sleep -Seconds 6
54& $PODMAN ps --format "{{.Names}} {{.Status}}"
55foreach ($p in 7656,5173) {
56 try {
57 $code = (Invoke-WebRequest -UseBasicParsing -Uri "http://localhost:$p/" -TimeoutSec 6).StatusCode
58 Write-Host " localhost:$p -> HTTP $code"
59 } catch { Write-Host " localhost:$p -> erişilemedi ($($_.Exception.Message))" }
60}
61Write-Host "`n✅ Hazır. Test: http://localhost:5173 (giriş: admin / admin123)"