forge
Explore
Log in

Don't you dare go Hollow

hezarfen_rule_based_chatbot

Clone
★ 0

0 watching0 forksPython1.2 MiBdaf5582Kadir Yönak3 months ago37 commits

run-stack.ps158 lines, 2.2 KiBHistoryRawDownload
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
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$compose = Join-Path $PSScriptRoot "compose.yaml"
21$parent = Resolve-Path (Join-Path $PSScriptRoot "..\..")
22
23& $PODMAN machine start *> $null 2>&1
24
25Write-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")
32foreach ($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
40foreach ($img in $bases) {
41 Write-Host " pull $img"
42 & $PODMAN pull $img *> $null 2>&1
43}
44
45Write-Host "`n[2/3] podman compose up -d --build (backend Rust ilk seferde uzun sürer)..."
46& $PODMAN compose -f $compose up -d --build
47if ($LASTEXITCODE -ne 0) { throw "compose up başarısız (build log'una bak)." }
48
49Write-Host "`n[3/3] Doğrulama..."
50Start-Sleep -Seconds 6
51& $PODMAN ps --format "{{.Names}} {{.Status}}"
52foreach ($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}
58Write-Host "`n✅ Hazır. Test: http://localhost:5173 (giriş: admin / admin123)"