Document and add multi-bot Docker workflows with env layering scripts, and update agent/tool configuration handling to make MCP/email/calendar behavior more robust for day-to-day operations. Made-with: Cursor
3.9 KiB
3.9 KiB
Verifying Docker Multi-Bot Setup
✅ Configuration Check
1. Environment Files
.env.shared - Contains:
- ✅ Provider settings (custom/Ollama)
- ✅ Agent defaults (model, workspace, temperature, etc.)
- ✅ Tool settings
- ✅ Gateway settings
- ✅ Email IMAP/SMTP settings (shared)
.env.user1 - Contains:
- ✅ Telegram token (bot-specific)
- ✅ Email credentials (bot-specific override)
- ⚠️ Issue:
ALLOW_FROMshould NOT be in env files (arrays don't work in env vars)
2. Config Files
~/.nanobot-user1/config.json - Contains:
- ✅ Telegram
allowFromarray (correct location) - ✅ Email
allowFromarray (correct location)
3. Docker Compose
docker-compose.multi.env.yml - Correctly configured:
- ✅ Loads
.env.sharedfirst - ✅ Loads
.env.user1second (overrides shared) - ✅ Mounts
~/.nanobot-user1:/root/.nanobot(maps host config to container)
🔍 How Nanobot Loads Config in Docker
-
Environment Variables (from
.env.sharedand.env.user1):- Loaded by Docker Compose into container environment
- Nanobot's Pydantic
BaseSettingsreads them automatically - Format:
NANOBOT_CHANNELS__TELEGRAM__TOKEN=...
-
Config File (
config.json):- Path inside container:
/root/.nanobot/config.json - Maps to host:
~/.nanobot-user1/config.json - Loaded by
load_config()which callsget_config_path() get_config_path()returnsPath.home() / ".nanobot" / "config.json"- In Docker,
Path.home()=/root, so it reads/root/.nanobot/config.json - This is mounted from
~/.nanobot-user1/config.jsonon host ✅
- Path inside container:
⚠️ Issues Found
Issue 1: ALLOW_FROM in env file
Problem: .env.user1 has:
NANOBOT_CHANNELS__TELEGRAM__ALLOW_FROM=["TADec2023"]
NANOBOT_CHANNELS__EMAIL__ALLOW_FROM=["adayear2025@gmail.com"]
Why it's wrong: Environment variables can't handle JSON arrays. These will be treated as strings, not arrays.
Fix: Remove these from .env.user1 - they're already correctly in config.json:
{
"channels": {
"telegram": {
"allowFrom": ["TADec2023"]
},
"email": {
"allowFrom": ["adayear2025@gmail.com"]
}
}
}
Issue 2: Duplicate email settings
Problem: Email IMAP/SMTP settings are in both .env.shared and .env.user1
Recommendation:
- If all bots use same email account → Keep only in
.env.shared - If each bot uses different email → Keep only in
.env.userXfiles
✅ Verification Steps
-
Check env files don't have ALLOW_FROM:
grep ALLOW_FROM .env.user1 # Should return nothing or be removed -
Check config files have allowFrom:
cat ~/.nanobot-user1/config.json | jq '.channels.telegram.allowFrom' # Should show: ["TADec2023"] -
Verify Docker mounts:
docker compose -f docker-compose.multi.env.yml config | grep -A 5 "nanobot-user1" # Should show volume mount: ~/.nanobot-user1:/root/.nanobot -
Test config loading in container:
docker run --rm -v ~/.nanobot-user1:/root/.nanobot \ -e NANOBOT_CHANNELS__TELEGRAM__TOKEN=test \ nanobot gateway --help
🎯 Summary
What's Correct:
- ✅ Docker Compose loads env files correctly
- ✅ Config files are in correct locations
- ✅ Volume mounts map host configs to container paths
- ✅ Nanobot will read from
/root/.nanobot/config.jsoninside container
What Needs Fixing:
- ⚠️ Remove
ALLOW_FROMfrom.env.user1(keep only in config.json) - ⚠️ Decide: Email settings in
.env.sharedOR.env.userX(not both)
How It Works:
- Docker Compose loads
.env.shared→ sets environment variables - Docker Compose loads
.env.user1→ overrides with bot-specific vars - Container starts → mounts
~/.nanobot-user1to/root/.nanobot - Nanobot starts → reads env vars (from Docker) + config.json (from mount)
- Result: Bot uses combined settings from env vars + config.json ✅