Files
javis_bot/docker-compose.yml
javis-bot 03375a77d0 fix(docker+brain): make container Chrome search work, harden, improve toggle
Addresses review findings on the dockerized stack:
- Container Chrome search was dead: add --remote-debugging-port + a non-default
  --user-data-dir (Chrome 136+ refuses CDP on the default profile), add the
  playwright dep (browse-search.mjs connectOverCDP) with browser download
  skipped, and connect to 127.0.0.1 not "localhost" (container localhost -> ::1
  while Chrome binds IPv4). Verified: browse-search returns real results.
- Broadcast toggle reliability: always offer setBroadcast in screen-share mode
  (the embedding/keyword router dropped it for non-English utterances) and make
  its description force a tool call. "방송 꺼줘"->stop now 5/5; no false triggers.
- Stop the broadcast on voice leave (no orphaned stream).
- Security: bind VNC/noVNC to loopback by default (VNC_BIND override) and the
  bridge to the container loopback (BRIDGE_HOST=127.0.0.1), not published.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-11 10:44:56 +09:00

101 lines
4.3 KiB
YAML

# ============================================================================
# Javis Bot — Docker Compose
# ollama : the LLM backend for the jarvis brain
# ollama-init : one-shot, auto-pulls the chat + embed models on startup
# javis : all-in-one container (VNC desktop + Chrome + bridge + bot)
#
# Just bring it up — everything (incl. Ollama models) comes up automatically:
# docker compose up -d --build
#
# The Discord token can be added LAST: without it the desktop, brain bridge,
# Ollama and models all run; only the bot waits. Then put DISCORD_BOT_TOKEN in
# .env and re-run `docker compose up -d`.
#
# Watch the desktop: VNC viewer -> localhost:5901 (or browser -> localhost:6080)
# ============================================================================
services:
ollama:
image: ollama/ollama:latest
restart: unless-stopped
volumes:
- ollama_models:/root/.ollama
# GPU: needs nvidia-container-toolkit on the host (CDI). Verified on the
# RTX 5050 (Blackwell sm_120) — Ollama offloads 100% to GPU.
devices:
- "nvidia.com/gpu=all"
# Auto-pull the models the brain needs, then exit. Idempotent (re-runnable).
ollama-init:
image: ollama/ollama:latest
depends_on:
- ollama
restart: "no"
environment:
OLLAMA_HOST: http://ollama:11434
CHAT_MODEL: ${OLLAMA_CHAT_MODEL:-qwen3:8b}
EMBED_MODEL: ${OLLAMA_EMBED_MODEL:-nomic-embed-text}
entrypoint: ["/bin/sh", "-c"]
command:
- |
echo "[ollama-init] waiting for ollama server...";
until ollama list >/dev/null 2>&1; do sleep 2; done;
echo "[ollama-init] pulling $$CHAT_MODEL";
ollama pull "$$CHAT_MODEL";
echo "[ollama-init] pulling $$EMBED_MODEL";
ollama pull "$$EMBED_MODEL";
echo "[ollama-init] models ready.";
javis:
build: .
restart: unless-stopped
env_file:
- path: .env
required: false
environment:
# Point the brain at the ollama service and the bot at the in-container bridge.
OLLAMA_BASE_URL: http://ollama:11434
OLLAMA_CHAT_MODEL: ${OLLAMA_CHAT_MODEL:-qwen3:8b}
OLLAMA_EMBED_MODEL: ${OLLAMA_EMBED_MODEL:-nomic-embed-text}
WHISPER_MODEL: ${WHISPER_MODEL:-small}
WHISPER_DEVICE: ${WHISPER_DEVICE:-cuda}
WHISPER_COMPUTE_TYPE: ${WHISPER_COMPUTE_TYPE:-float16}
BRIDGE_URL: http://127.0.0.1:8765
depends_on:
- ollama
# GPU: accelerates Whisper STT (and anything else CUDA) in this container.
# Verified: faster-whisper float16 works on the RTX 5050 (sm_120).
devices:
- "nvidia.com/gpu=all"
shm_size: "1gb" # Chrome needs a larger /dev/shm
ports:
# All published to loopback only by default — VNC/noVNC use a weak default
# password and the bridge is an unauthenticated internal API, so none
# should be reachable off-host. For remote access use an SSH tunnel, or
# set a strong VNC_PASSWORD and override the bind (e.g. VNC_BIND=0.0.0.0).
# Host VNC port is overridable; this server already runs Xvnc on 5901 so
# .env pins VNC_PORT=5902.
- "${VNC_BIND:-127.0.0.1}:${VNC_PORT:-5901}:5901" # VNC
- "${VNC_BIND:-127.0.0.1}:${NOVNC_PORT:-6080}:6080" # noVNC (browser)
# The brain bridge is NOT published: it binds the container's loopback
# (BRIDGE_HOST=127.0.0.1) and is only consumed by the bot in this same
# container, so it needs no host port and stays unreachable off-container.
volumes:
- javis_data:/data # jarvis db + memory
- whisper_cache:/root/.cache/huggingface # cached Whisper models
- piper_voices:/opt/piper-voices # TTS voices
# Gemini account login for GEMINI_AUTH=oauth real-time search. Mounts a
# DEDICATED dir holding only the Gemini OAuth creds (not the whole
# ~/.gemini), so the container can refresh its token without exposing
# unrelated host state. Seed it once with the host login:
# mkdir -p ~/.config/javis/gemini
# cp ~/.gemini/oauth_creds.json ~/.config/javis/gemini/
# Override GEMINI_OAUTH_DIR to point elsewhere. Only used when
# GEMINI_AUTH=oauth.
- ${GEMINI_OAUTH_DIR:-${HOME}/.config/javis/gemini}:/root/.gemini
volumes:
ollama_models:
javis_data:
whisper_cache:
piper_voices: