s
This commit is contained in:
@@ -269,8 +269,9 @@ def build_profile() -> dict:
|
||||
def suggest_video_encoder(profile: dict) -> str:
|
||||
"""在 Linux 上根据 ffmpeg 能力与探测结果给出可选硬件编码器名(供 douyin→YouTube 读取 LIVE_VIDEO_ENCODER)。
|
||||
|
||||
优先级:RKMPP(常见 ARM SoC)→ V4L2M2M(通用 ARM/部分板)→ VA-API(x86 核显)→ QSV(Intel x86)。
|
||||
优先级:RKMPP(常见 ARM SoC)→ V4L2M2M(通用 ARM/部分板)→ VA-API(x86 核显)。
|
||||
NVIDIA 由 douyin_youtube_ffplay 内单独检测 h264_nvenc,此处不重复写入。
|
||||
QSV 在部分 Linux 发行版上需要额外的设备/滤镜链路,本项目默认不自动启用,以优先保证跨机兼容性。
|
||||
"""
|
||||
if platform.system().lower() != "linux":
|
||||
return ""
|
||||
@@ -291,8 +292,6 @@ def suggest_video_encoder(profile: dict) -> str:
|
||||
return ""
|
||||
if "h264_vaapi" in text and render_ok and "vaapi" in hwaccels:
|
||||
return "h264_vaapi"
|
||||
if machine in ("x86_64", "amd64") and "h264_qsv" in text:
|
||||
return "h264_qsv"
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ DOCKER_NODE_IMAGE = os.environ.get("WEB_CONSOLE_NODE_IMAGE", "node:20-bookworm-s
|
||||
sys.path.insert(0, str(ROOT))
|
||||
sys.path.insert(0, str(SCRIPTS_DIR))
|
||||
import env_check # noqa: E402
|
||||
from src.runtime_bootstrap import raise_nofile_limit # noqa: E402
|
||||
from src.runtime_bootstrap import ensure_runtime_layout, raise_nofile_limit # noqa: E402
|
||||
|
||||
|
||||
def load_runtime_env() -> None:
|
||||
@@ -495,6 +495,15 @@ def run_prod(host: str, port: str, skip_build: bool, reload: bool) -> None:
|
||||
def main() -> None:
|
||||
load_runtime_env()
|
||||
raise_nofile_limit()
|
||||
runtime_issues = ensure_runtime_layout(ROOT)
|
||||
if runtime_issues:
|
||||
print("[launch] warning: some runtime directories are not writable by the current user:", file=sys.stderr)
|
||||
for issue in runtime_issues:
|
||||
print(f"[launch] - {issue}", file=sys.stderr)
|
||||
print(
|
||||
"[launch] hint: fix deployment ownership for runtime dirs such as config/logs/backup_config/.pm2/.process_runner/downloads/backup",
|
||||
file=sys.stderr,
|
||||
)
|
||||
|
||||
default_port = os.environ.get("PORT", "8001")
|
||||
ap = argparse.ArgumentParser(description="直播控制台一键启动")
|
||||
|
||||
@@ -16,6 +16,7 @@ ENABLE_NETDATA=0
|
||||
|
||||
ensure_live_user
|
||||
normalize_repo_root
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
install_base_packages
|
||||
install_media_packages
|
||||
configure_adb_udev
|
||||
@@ -40,4 +41,5 @@ prepare_srs
|
||||
run_hardware_probe
|
||||
# 与 install-hub 一致:装 Caddy live-edge,http://live.local:80 → 本机控制平面 PORT(默认 8001)
|
||||
install_live_edge_proxy
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
print_summary "business"
|
||||
|
||||
@@ -13,6 +13,7 @@ ENABLE_SRS=0
|
||||
|
||||
ensure_live_user
|
||||
normalize_repo_root
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
install_base_packages
|
||||
install_media_packages
|
||||
configure_adb_udev
|
||||
@@ -42,4 +43,5 @@ prepare_homepage
|
||||
prepare_filebrowser
|
||||
run_hardware_probe
|
||||
install_live_edge_proxy
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
print_summary "hub"
|
||||
|
||||
@@ -460,6 +460,24 @@ normalize_repo_root() {
|
||||
WEBTTY_SHELL="$ROOT_DIR/scripts/linux/webtty_shell.sh"
|
||||
}
|
||||
|
||||
ensure_runtime_dirs_owned_by_live() {
|
||||
local rel path
|
||||
for rel in \
|
||||
config \
|
||||
logs \
|
||||
downloads \
|
||||
backup \
|
||||
backup_config \
|
||||
.pm2 \
|
||||
.process_runner \
|
||||
services/neko/data
|
||||
do
|
||||
path="$ROOT_DIR/$rel"
|
||||
mkdir -p "$path"
|
||||
chown -R live:live "$path" 2>/dev/null || true
|
||||
done
|
||||
}
|
||||
|
||||
install_base_packages() {
|
||||
log "Installing base packages"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
@@ -12,6 +12,7 @@ load_env
|
||||
|
||||
# git pull 若以 root 执行,避免 live 用户无法写 venv / node_modules
|
||||
chown -R live:live "$ROOT_DIR" || true
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
|
||||
log "Refreshing Python venv + requirements"
|
||||
prepare_python_runtime
|
||||
@@ -30,6 +31,8 @@ else
|
||||
log "ENABLE_LIVE_EDGE_PROXY is not 1 — skipping live-edge (direct :${PORT})"
|
||||
fi
|
||||
|
||||
ensure_runtime_dirs_owned_by_live
|
||||
|
||||
ok=0
|
||||
for _ in 1 2 3 4 5 6; do
|
||||
if curl -sf -m 6 "http://127.0.0.1:${PORT}/health" >/dev/null; then
|
||||
|
||||
Reference in New Issue
Block a user