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

@@ -4,8 +4,12 @@ set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
PID_DIR="runtime/pids"
LOG_DIR="runtime/logs"
ENV_FILE="${ENV_FILE:-.env}"
ENV_TEMPLATE_FILE="${ENV_TEMPLATE_FILE:-.env.example}"
EDGE_RUNTIME_DIR="${EDGE_RUNTIME_DIR:-runtime}"
PID_DIR="${EDGE_RUNTIME_DIR}/pids"
LOG_DIR="${EDGE_RUNTIME_DIR}/logs"
WORKER_PID_FILE="${PID_DIR}/worker.pid"
EDGE_CLIENT_PID_FILE="${PID_DIR}/edge_client.pid"
WORKER_LOG="${LOG_DIR}/worker.log"
@@ -13,9 +17,9 @@ EDGE_CLIENT_LOG="${LOG_DIR}/edge_client.log"
mkdir -p "$PID_DIR" "$LOG_DIR"
if [ ! -f .env ]; then
cp .env.example .env
echo "[INFO] .env missing, created from .env.example"
if [ ! -f "$ENV_FILE" ]; then
cp "$ENV_TEMPLATE_FILE" "$ENV_FILE"
echo "[INFO] ${ENV_FILE} missing, created from ${ENV_TEMPLATE_FILE}"
fi
if [ ! -d .venv ]; then
@@ -25,11 +29,12 @@ fi
source .venv/bin/activate
set -a
source .env
source "$ENV_FILE"
set +a
# Edge device should not expose a public ingress service.
APP_HOST="${APP_HOST:-127.0.0.1}"
# Edge device must not expose ingress service to external network.
# Force localhost bind even if APP_HOST is configured differently.
APP_HOST="127.0.0.1"
APP_PORT="${APP_PORT:-8000}"
DISPATCH_WS_URL="${DISPATCH_WS_URL:-}"
WORKER_BASE_URL="${WORKER_BASE_URL:-http://127.0.0.1:${APP_PORT}}"