Files
mnote/LightRAG/start-lightrag-7777.ps1
T

37 lines
1.4 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
$ErrorActionPreference = "Stop"
# 说明:
# 1) LightRAG Server 启动时会在控制台打印 Emoji/彩色字符,Windows 默认编码(GBK)可能导致启动失败。
# 2) 本脚本强制使用 UTF-8,并确保存在一个到 supabase-db 的端口转发(host:15433 -> supabase-db:5432)。
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
$env:PYTHONUTF8 = "1"
$env:PYTHONIOENCODING = "utf-8"
$env:PYTHONLEGACYWINDOWSSTDIO = "1"
Set-Location -Path $PSScriptRoot
function Ensure-SupabaseDbForwarder {
$name = "supabase-db-forward"
$exists = (docker ps -a --format "{{.Names}}" | Where-Object { $_ -eq $name }) -ne $null
if (-not $exists) {
Write-Host "创建端口转发容器:$name15433 -> supabase-db:5432"
docker run -d --name $name --restart unless-stopped --network supabase_default -p 15433:5432 alpine/socat -v TCP-LISTEN:5432,fork,reuseaddr TCP:supabase-db:5432 | Out-Null
} else {
$running = (docker ps --format "{{.Names}}" | Where-Object { $_ -eq $name }) -ne $null
if (-not $running) {
Write-Host "启动端口转发容器:$name"
docker start $name | Out-Null
}
}
}
Ensure-SupabaseDbForwarder
Write-Host "启动 LightRAG Serverhttp://127.0.0.1:7777"
Write-Host "提示:API-Key 使用 X-API-Key: aimnote-local(可在 .env 中调整 LIGHTRAG_API_KEY"
& ".\.venv\Scripts\lightrag-server.exe"