diff --git a/README.md b/README.md index 07fff6a..7d1ab14 100644 --- a/README.md +++ b/README.md @@ -82,18 +82,19 @@ lightweight high-pass + soft-clip DSP path so streams still work. Until the 1 s window is full, hops use the DSP fallback so LiveKit is not silent on startup. -## systemd (optional, not enabled) +## systemd (enabled, 24/7) + +Two units, enabled for multi-user.target: + +- `livekit-server.service` — `/usr/local/bin/livekit-server` + `deploy/livekit-server.yaml` (:7880) +- `livekit-cameras.service` — `run.py` (Requires livekit-server) ```bash -sudo cp deploy/livekit-cameras.service /etc/systemd/system/ -sudo systemctl daemon-reload -# only if you want 24/7: -sudo systemctl enable --now livekit-cameras +systemctl status livekit-cameras livekit-server +journalctl -u livekit-cameras -f +systemctl restart livekit-cameras # pick up newly plugged cameras ``` -Requires a LiveKit server already listening (this host uses -`/tmp/livekit-server --config /tmp/livekit-test.yaml` on :7880). - ## Notes - Video uses MJPG directly from the UVC interface (`ffmpeg -f v4l2 diff --git a/deploy/livekit-cameras.service b/deploy/livekit-cameras.service index 9ad0f05..8672a7d 100644 --- a/deploy/livekit-cameras.service +++ b/deploy/livekit-cameras.service @@ -1,16 +1,20 @@ [Unit] Description=Publish C920 cameras (speechbrain audio) to LiveKit -After=network-online.target sound.target +After=network-online.target sound.target livekit-server.service Wants=network-online.target +Requires=livekit-server.service [Service] Type=simple WorkingDirectory=/home/fdenkena/livekit-cameras ExecStart=/home/fdenkena/livekit-cameras/.venv/bin/python /home/fdenkena/livekit-cameras/run.py -Restart=on-failure +Restart=always RestartSec=5 +TimeoutStopSec=30 +KillMode=control-group Environment=PYTHONUNBUFFERED=1 Environment=LIVEKIT_URL=ws://127.0.0.1:7880 +Environment=ENHANCE_MODE=force [Install] WantedBy=multi-user.target diff --git a/deploy/livekit-server.service b/deploy/livekit-server.service new file mode 100644 index 0000000..e7eeaae --- /dev/null +++ b/deploy/livekit-server.service @@ -0,0 +1,14 @@ +[Unit] +Description=LiveKit server for the C920 camera fleet +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +ExecStart=/usr/local/bin/livekit-server --config /home/fdenkena/livekit-cameras/deploy/livekit-server.yaml +Restart=always +RestartSec=2 +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target diff --git a/deploy/livekit-server.yaml b/deploy/livekit-server.yaml new file mode 100644 index 0000000..2c8bd6e --- /dev/null +++ b/deploy/livekit-server.yaml @@ -0,0 +1,13 @@ +port: 7880 +bind_addresses: + - 127.0.0.1 + - 10.200.0.20 +keys: + devkey: devsecret +rtc: + tcp_port: 7881 + udp_port: 7882 + use_external_ip: false + node_ip: 10.200.0.20 +logging: + level: info