|
| 1 | +# Deployment Guide |
| 2 | + |
| 3 | +This page covers production-oriented setups for Bub, including local process management and Docker Compose. |
| 4 | + |
| 5 | +## 1) Prerequisites |
| 6 | + |
| 7 | +- Python 3.12+ |
| 8 | +- `uv` installed |
| 9 | +- A valid model provider key (for example `OPENROUTER_API_KEY` or `LLM_API_KEY`) |
| 10 | + |
| 11 | +Quick bootstrap: |
| 12 | + |
| 13 | +```bash |
| 14 | +git clone https://github.com/psiace/bub.git |
| 15 | +cd bub |
| 16 | +uv sync |
| 17 | +cp env.example .env |
| 18 | +``` |
| 19 | + |
| 20 | +Minimum `.env`: |
| 21 | + |
| 22 | +```bash |
| 23 | +BUB_MODEL=openrouter:qwen/qwen3-coder-next |
| 24 | +OPENROUTER_API_KEY=sk-or-... |
| 25 | +``` |
| 26 | + |
| 27 | +## 2) Deployment Modes |
| 28 | + |
| 29 | +Choose one mode based on your operation target: |
| 30 | + |
| 31 | +1. Interactive local operator: |
| 32 | + `uv run bub chat` |
| 33 | +2. Channel service (Telegram/Discord): |
| 34 | + `uv run bub message` |
| 35 | +3. Scheduler-only autonomous runtime: |
| 36 | + `uv run bub idle` |
| 37 | + |
| 38 | +One-shot operation: |
| 39 | + |
| 40 | +```bash |
| 41 | +uv run bub run "summarize changes in this repo" |
| 42 | +``` |
| 43 | + |
| 44 | +## 3) Message Channel Deployment |
| 45 | + |
| 46 | +Enable channels in `.env` first. |
| 47 | + |
| 48 | +Telegram: |
| 49 | + |
| 50 | +```bash |
| 51 | +BUB_TELEGRAM_ENABLED=true |
| 52 | +BUB_TELEGRAM_TOKEN=123456:token |
| 53 | +BUB_TELEGRAM_ALLOW_FROM='["123456789","your_username"]' |
| 54 | +BUB_TELEGRAM_ALLOW_CHATS='["123456789","-1001234567890"]' |
| 55 | +``` |
| 56 | + |
| 57 | +Discord: |
| 58 | + |
| 59 | +```bash |
| 60 | +BUB_DISCORD_ENABLED=true |
| 61 | +BUB_DISCORD_TOKEN=discord_bot_token |
| 62 | +BUB_DISCORD_ALLOW_FROM='["123456789012345678","your_discord_name"]' |
| 63 | +BUB_DISCORD_ALLOW_CHANNELS='["123456789012345678"]' |
| 64 | +``` |
| 65 | + |
| 66 | +Start channel service: |
| 67 | + |
| 68 | +```bash |
| 69 | +uv run bub message |
| 70 | +``` |
| 71 | + |
| 72 | +## 4) Docker Compose Deployment |
| 73 | + |
| 74 | +The repository already provides `Dockerfile`, `docker-compose.yml`, and `entrypoint.sh`. |
| 75 | + |
| 76 | +Build and run: |
| 77 | + |
| 78 | +```bash |
| 79 | +docker compose up -d --build |
| 80 | +docker compose logs -f app |
| 81 | +``` |
| 82 | + |
| 83 | +Behavior in container: |
| 84 | + |
| 85 | +- If `/workspace/startup.sh` exists, container starts `bub idle` in background, then executes `startup.sh`. |
| 86 | +- Otherwise, container starts `bub message`. |
| 87 | + |
| 88 | +Default mounts in `docker-compose.yml`: |
| 89 | + |
| 90 | +- `${BUB_WORKSPACE_PATH:-.}:/workspace` |
| 91 | +- `${BUB_HOME:-${HOME}/.bub}:/data` |
| 92 | +- `${BUB_AGENT_HOME:-${HOME}/.agent}:/root/.agent` |
| 93 | + |
| 94 | +## 5) Operational Checks |
| 95 | + |
| 96 | +Health checklist: |
| 97 | + |
| 98 | +1. Process is running: |
| 99 | + `ps aux | rg "bub (chat|message|idle)"` |
| 100 | +2. Model key is loaded: |
| 101 | + `rg -n "BUB_MODEL|OPENROUTER_API_KEY|LLM_API_KEY" .env` |
| 102 | +3. Channel flags are correct: |
| 103 | + `rg -n "BUB_TELEGRAM_ENABLED|BUB_DISCORD_ENABLED" .env` |
| 104 | +4. Logs show channel startup: |
| 105 | + `uv run bub message` and confirm `channel.manager.start` output. |
| 106 | + |
| 107 | +## 6) Safe Upgrade Procedure |
| 108 | + |
| 109 | +```bash |
| 110 | +git fetch --all --tags |
| 111 | +git pull |
| 112 | +uv sync |
| 113 | +uv run ruff check . |
| 114 | +uv run mypy |
| 115 | +uv run pytest -q |
| 116 | +``` |
| 117 | + |
| 118 | +Then restart your runtime (`chat`, `message`, or container service). |
0 commit comments