fix: 修复部署问题

This commit is contained in:
Daniel
2026-04-07 17:01:13 +08:00
parent d22d6bb73b
commit 4879d2e8c5
15 changed files with 280 additions and 11 deletions

View File

@@ -0,0 +1,25 @@
APP_HOST=127.0.0.1
APP_PORT=8000
DISPATCH_WS_URL=ws://127.0.0.1:8060/ws/edge/edge-a4000-01
WORKER_BASE_URL=http://127.0.0.1:8000
EDGE_POLL_INTERVAL_SEC=1.0
EDGE_ALLOW_REMOTE_UPDATE=true
EDGE_ALLOW_REMOTE_RESTART=true
OUTPUT_DIR=./outputs
RUNTIME_DIR=./runtime
SQLITE_PATH=./runtime/tasks.db
LTX_MODEL_DIR=./models/ltx
HUNYUAN_MODEL_DIR=./models/hunyuan
DEFAULT_WIDTH=832
DEFAULT_HEIGHT=480
DEFAULT_FPS=16
DEFAULT_DURATION=5
DEFAULT_STEPS_PREVIEW=8
DEFAULT_STEPS_REFINE=12
LOG_LEVEL=INFO

View File

@@ -0,0 +1,44 @@
# Edge Node Project
边缘设备独立项目目录(主动连接中心 WS接收任务和运维指令
安全边界:
- 边缘仅主动连接中心(`DISPATCH_WS_URL`
- 边缘不提供外网入口Worker 固定绑定 `127.0.0.1`
## Linux / WSL
```bash
cd edge_node
bash scripts/start.sh
```
停止与重启:
```bash
bash scripts/stop.sh
bash scripts/restart.sh
```
## Windows PowerShell (WSL)
```powershell
cd edge_node
.\scripts\wsl.ps1 -Action start
```
常用:
```powershell
.\scripts\wsl.ps1 -Action status
.\scripts\wsl.ps1 -Action restart
.\scripts\wsl.ps1 -Action stop
```
## Config
首次启动会生成 `edge_node/.env`。请至少设置:
- `DISPATCH_WS_URL=ws://<center-host>:8060/ws/edge/<device-id>`
- `WORKER_BASE_URL=http://127.0.0.1:8000`

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd)"
PROJECT_DIR="${ROOT_DIR}/edge_node"
cd "$ROOT_DIR"
ENV_FILE="${PROJECT_DIR}/.env"
ENV_TEMPLATE_FILE="${PROJECT_DIR}/.env.example"
EDGE_RUNTIME_DIR="${PROJECT_DIR}/runtime"
ENV_FILE="$ENV_FILE" ENV_TEMPLATE_FILE="$ENV_TEMPLATE_FILE" EDGE_RUNTIME_DIR="$EDGE_RUNTIME_DIR" bash scripts/restart_edge_device_local.sh

View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd)"
PROJECT_DIR="${ROOT_DIR}/edge_node"
cd "$ROOT_DIR"
ENV_FILE="${PROJECT_DIR}/.env"
ENV_TEMPLATE_FILE="${PROJECT_DIR}/.env.example"
EDGE_RUNTIME_DIR="${PROJECT_DIR}/runtime"
ENV_FILE="$ENV_FILE" ENV_TEMPLATE_FILE="$ENV_TEMPLATE_FILE" EDGE_RUNTIME_DIR="$EDGE_RUNTIME_DIR" bash scripts/start_edge_device_local.sh

View File

@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../" && pwd)"
PROJECT_DIR="${ROOT_DIR}/edge_node"
cd "$ROOT_DIR"
EDGE_RUNTIME_DIR="${PROJECT_DIR}/runtime"
EDGE_RUNTIME_DIR="$EDGE_RUNTIME_DIR" bash scripts/stop_edge_device_local.sh

View File

@@ -0,0 +1,41 @@
param(
[ValidateSet("start", "stop", "restart", "status")]
[string]$Action = "start",
[string]$Distro = ""
)
$ErrorActionPreference = "Stop"
$Root = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path))
$ProjectRoot = Join-Path $Root "edge_node"
if (!(Get-Command wsl -ErrorAction SilentlyContinue)) {
throw "WSL command not found. Please install WSL first."
}
if ([string]::IsNullOrWhiteSpace($Distro)) {
$linuxRoot = (wsl -- wslpath -a "$Root").Trim()
} else {
$linuxRoot = (wsl -d $Distro -- wslpath -a "$Root").Trim()
}
if ([string]::IsNullOrWhiteSpace($linuxRoot)) {
throw "Failed to resolve WSL path for project root: $Root"
}
switch ($Action) {
"start" { $target = "edge_node/scripts/start.sh" }
"stop" { $target = "edge_node/scripts/stop.sh" }
"restart" { $target = "edge_node/scripts/restart.sh" }
"status" {
$bash = "cd '$linuxRoot' && if [ -f edge_node/runtime/pids/worker.pid ] && kill -0 `$(cat edge_node/runtime/pids/worker.pid) >/dev/null 2>&1; then echo '[OK] worker running'; else echo '[INFO] worker not running'; fi; if [ -f edge_node/runtime/pids/edge_client.pid ] && kill -0 `$(cat edge_node/runtime/pids/edge_client.pid) >/dev/null 2>&1; then echo '[OK] edge_client running'; else echo '[INFO] edge_client not running'; fi"
if ([string]::IsNullOrWhiteSpace($Distro)) { wsl -- bash -lc "$bash" } else { wsl -d $Distro -- bash -lc "$bash" }
exit 0
}
}
$bashCommand = "cd '$linuxRoot' && chmod +x edge_node/scripts/start.sh edge_node/scripts/stop.sh edge_node/scripts/restart.sh scripts/start_edge_device_local.sh scripts/stop_edge_device_local.sh scripts/restart_edge_device_local.sh && bash $target"
if ([string]::IsNullOrWhiteSpace($Distro)) {
wsl -- bash -lc "$bashCommand"
} else {
wsl -d $Distro -- bash -lc "$bashCommand"
}