# Linux Install Profiles ## Quick Start Use one of these entrypoints from the repo root on Debian, Ubuntu, or Armbian: ```bash sudo bash install-hub.sh sudo bash install-business.sh sudo bash install-all.sh ``` ### Acceptance After Install On the target Linux node, run the built-in health checks: ```bash sudo bash doctor.sh sudo bash probe-live.sh ``` From a dev machine, you can also verify the remote node over SSH: ```bash LIVE_DEPLOY_HOST=192.168.x.x python3 tools/verify_live_console.py ``` The control plane now exposes a structured acceptance report at: ```text http://127.0.0.1:8001/deploy/check ``` It focuses on the real delivery path for this project: - `127.0.0.1:8001/health` - `127.0.0.1:80/health` - `http://live.local/health` - `http://live.local:8001/health` - exported `web-console/out/index.html` - `config/system-stack.env` ### After `git pull` (no full reinstall) 刷新依赖、重建前端、重启 `live-console` 与 `live-edge`(**不要**为此再跑 `install-all.sh`,除非你要重做整机栈): ```bash cd /home/live/douyinyoutube # 或你的克隆路径 sudo bash upgrade-live.sh ``` 若仓库只更新了 **`live-console.service` 模板**(例如 `StartLimitIntervalSec`),可单独刷新单元: ```bash sudo bash refresh-live-unit.sh ``` ## What Each Script Does ### `install-hub.sh` Use this when the Linux device should become the reusable super hub first. - Creates and refreshes the `live` account - Installs the shared control plane runtime - Enables `live.local` - Creates the default Wi-Fi profile `live / 12345678` when `wlan0` exists - Installs ShellCrash, WebTTY, Cockpit, File Browser, Homepage, and Netdata - Installs the Android web panel based on `web-scrcpy` - Builds the web console and enables `live-console.service` ### `install-business.sh` Use this when the device should only run the Douyin or YouTube business stack. - Creates and refreshes the `live` account - Installs the shared control plane runtime - Installs ffmpeg, mpv, ADB, Chromium - Installs the Android web panel based on `web-scrcpy` - Starts SRS - Builds the web console and enables `live-console.service` - Installs **Caddy** `live-edge.service` so **`http://live.local`** (port 80) reverse-proxies to the control plane (same as hub) - Generates the hardware profile for adaptive ARM or X86 defaults ### `http://live.local` returns 502 502 means the edge proxy reached nothing usable on the upstream port (default `127.0.0.1:8001`). 1. Check the control plane: `sudo systemctl status live-console.service` and `journalctl -u live-console.service -n 80 --no-pager`. 2. Check the edge: `sudo systemctl status live-edge.service` and confirm `config/system-stack.env` **`PORT`** matches what Caddy uses (regenerate with `sudo bash scripts/linux/reinstall_live_edge.sh` from the repo root). 3. Quick probe: `curl -sf http://127.0.0.1:8001/health` — if this fails, fix `live-console` first (Python venv, `web-console/out`, or `scripts/launch.py` errors in the journal). **Older business installs** (before `install_live_edge_proxy` was included) never installed Caddy; if you still see 502 on port 80, you likely had a prior hub/edge install—run `sudo bash scripts/linux/reinstall_live_edge.sh` after pulling the latest repo. ### Browser: `live.local` — **refused to connect** (not 502) That means the TCP connection was **rejected or nothing listens** on the address you used (often **port 80** on the box’s IP). 1. On the **device**, run: `sudo bash probe-live.sh` (or `scripts/linux/probe_live_access.sh`) and read the `:80` / `:8001` lines. 2. If **`:8001` works** but **`:80` fails**: `live-edge` (Caddy) is down — `sudo systemctl restart live-edge.service` or `sudo bash scripts/linux/reinstall_live_edge.sh`. 3. If **both fail**: `live-console` is down — `sudo systemctl restart live-console.service` and `journalctl -u live-console.service -n 80`. 4. From a **laptop/phone**, open **`http://:8001/`** first (same Wi‑Fi). If that works but `http://live.local` does not, the problem is **mDNS** (Windows often needs Bonjour) or you’re not on the same LAN — use the IP bookmark. 5. **Firewall** (nftables/ufw) blocking **80/8001** from Wi‑Fi will also show as “refused” from other hosts while loopback still works. ### PM2:单频道与多频道 Pro(Linux ARM / x86_64) - **单频道**:在项目根启用一个业务进程即可,例如取消注释 `ecosystem.config.cjs` 里的 `youtube` 或 `tiktok`,执行 `pm2 start ecosystem.config.cjs && pm2 save`。 - **多频道 Pro**:每路直播需要**独立的** `config/youtube.ini` 与 `config/URL_config.ini`(或整份独立工作目录)。为第二路及以后各复制一份目录(或符号链接脚本外的配置),在 PM2 里为每个 app 设置不同的 `cwd`,`name` 与 Web 控制台 Pro 线路建议名一致(如 `youtube2__`)。 - **硬件编码**:`sudo python3 scripts/hardware_probe.py --write` 会写入 `config/hardware.env` 与 `hardware-profile.json`;推流侧可选 `LIVE_VIDEO_ENCODER`(RKMPP / V4L2M2M / VA-API / QSV 等,见 `config/hardware.env.example`)。NVIDIA 一般由 `douyin_youtube_ffplay.py` 自动走 NVENC。 - **音频链**:与 GitLab 分支 `ffmpegAudioRMFoode` 中 `douyin_youtube_ffplay.py` 的 FFmpeg 处理思路一致(`fast_audio`、arnndn、EQ 等);当前主线在 Linux 上还包含板载编码探测与推流稳定性增强,以前端无需对齐 Electron 为准。 ### `install-all.sh` Use this when the node should be both the super hub and the livestream business node. - Runs `install-hub.sh` - Runs `install-business.sh` - Reuses shared modules instead of replacing them ## Shared Config All install profiles read the same shared file: - `config/system-stack.env` If the file does not exist, the installer copies: - `config/system-stack.env.example` This keeps host identity, ports, Wi-Fi, ShellCrash path, and module toggles centralized. ## Default Access URLs With the default hostname and ports, a fresh hub exposes: - `http://live.local:8001` main control plane - `http://live.local:8001/shellcrash` ShellCrash editor route - `http://live.local:8001/android` Android device center route - `http://live.local:7681` WebTTY - `http://live.local:8082` File Browser, default login `live / 12345678` - `http://live.local:19999` Netdata The ShellCrash and Android pages are separate routes on purpose, so they can be bookmarked directly instead of sharing the same tabbed root URL. ## Separation Rules - The hub profile must keep working without SRS. - The business profile must keep working without Cockpit, Homepage, File Browser, or Netdata. - The control plane should show degraded modules as unavailable instead of crashing. - Every service must be removable by systemd or compose boundaries.