Files
javis_bot/docker/run-pulse.sh
javis-bot 35e754d6ee fix(docker): in-container Gemini CLI OAuth, broadcast audio, ports + hardening
Makes the all-in-one image actually run the new real-time-search features and
closes review gaps:
- Gemini OAuth path: install Node 22 + @google/gemini-cli (pinned 0.46.0) in the
  image; mount a DEDICATED host dir (~/.config/javis/gemini) holding only the
  OAuth creds to /root/.gemini (not the whole ~/.gemini). Verified in-container:
  `gemini -p ... -o json` returns a grounded answer with no API key.
- Broadcast audio: add PulseAudio + a headless null-sink (run-pulse.sh, new
  supervisor program); export XDG_RUNTIME_DIR/PULSE_SERVER so Chrome playback
  and the selfbot `ffmpeg -f pulse -i @DEFAULT_MONITOR@` share one daemon.
  Verified: default sink virtual_speaker, monitor present, ffmpeg capture OK.
- Bind the brain bridge to 127.0.0.1 only (internal, unauthenticated API).
- VNC host port is overridable; this server pins VNC_PORT=5902 (.env) since the
  host already runs Xvnc on 5901.

Verified in-container with CDI GPU passthrough: RTX 5050 visible, NVENC
encoders (h264/hevc/av1) available.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 01:36:30 +09:00

24 lines
929 B
Bash
Executable File

#!/usr/bin/env bash
# Headless PulseAudio for the broadcast audio path.
#
# The selfbot streamer captures desktop audio with `ffmpeg -f pulse -i
# @DEFAULT_MONITOR@` (bot/src/stream/selfbot.ts). In a container there is no
# real sound card, so we run a PulseAudio daemon with a null sink set as the
# default: Chrome/desktop play into it, and its `.monitor` source is what
# ffmpeg captures. Without this the broadcast fails to start when STREAM_AUDIO=1.
set -e
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/0}"
mkdir -p "$XDG_RUNTIME_DIR/pulse"
chmod 700 "$XDG_RUNTIME_DIR"
exec pulseaudio \
--exit-idle-time=-1 \
--disallow-exit \
--disable-shm \
-n \
--load="module-native-protocol-unix auth-anonymous=1 socket=${XDG_RUNTIME_DIR}/pulse/native" \
--load="module-null-sink sink_name=virtual_speaker sink_properties=device.description=Virtual_Speaker" \
--load="module-always-sink" \
--log-target=stderr