https://github.com/milkbotai/claw-install
Production installer for OpenClaw -- autonomous AI coding agent on Ubuntu 24.04 LTS
https://github.com/milkbotai/claw-install
ai autonomous-agents bash devops installer llm monitoring streamlit systemd ubuntu
Last synced: 2 months ago
JSON representation
Production installer for OpenClaw -- autonomous AI coding agent on Ubuntu 24.04 LTS
- Host: GitHub
- URL: https://github.com/milkbotai/claw-install
- Owner: milkbotai
- Created: 2026-02-08T00:19:05.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-02-08T09:25:58.000Z (2 months ago)
- Last Synced: 2026-02-08T09:39:53.953Z (2 months ago)
- Topics: ai, autonomous-agents, bash, devops, installer, llm, monitoring, streamlit, systemd, ubuntu
- Language: Shell
- Homepage: https://github.com/milkbotai/Milkbot
- Size: 159 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/milkbotai/claw-install/actions)
[](https://github.com/milkbotai/claw-install/releases)
[](LICENSE)
[](https://github.com/milkbotai/claw-install/commits/main)
[](https://github.com/milkbotai/claw-install)
# MilkBotClaw Installer
Production deployment system for an autonomous AI coding agent on Ubuntu 24.04 LTS. Single command installs and configures MilkBotClaw with multi-provider LLM routing, system monitoring, automated backups, and Telegram alerts.
## What This Does
This installer sets up a complete autonomous AI agent environment:
- **MilkBotClaw Agent** - AI coding agent (v2026.2.14) that reads workspace instructions, routes tasks to LLM providers, and manages its own memory
- **Multi-Provider LLM Routing** - MiniMax M2.5 (primary coding), Kimi K2.5 via OpenRouter (thinking/planning + validation)
- **Search & Research** - Brave Search (quick lookups), Perplexity Pro (deep research)
- **Redis & PostgreSQL** - Inter-agent communication (pub/sub), task queues, heartbeats, and persistent state
- **Monitoring Dashboard** - Streamlit dashboard with real-time system metrics, crew status, mission control, log viewer, and mobile responsive layout
- **Automated Backups** - Workspace and config backed up to Google Drive every 6 hours (token-based Python upload, gdrive, or rclone; 30 local copies)
- **Health Checks** - Service, API, disk, memory, and workspace validation every 30 minutes with circuit breaker auto-recovery
- **Twitter/X Integration** - Post tweets and monitor mentions for @MilkBot_ai (OAuth2 PKCE, 1500 tweets/mo)
- **Webhook Receiver** - HTTP event ingestion on localhost:8502 with HMAC-SHA256 signature validation
- **Daily Digest** - Rich Telegram status summary at 8 AM (system metrics, missions, backups, model performance)
- **Discord + Telegram Bot Commander** - Interactive `/status` command with multi-section dashboard (DEFCON, services, missions, budget, system)
- **Telegram Alerts** - Rate-limited notifications for health issues, backup status, circuit breaker events
- **Cloudflare Tunnel** - Public access to the dashboard at dashboard.milkbot.ai
- **Security Hardening** - Dedicated service user (`milkbot`), whitelisted sudo access, 640 permissions on secrets
## System Requirements
| Resource | Minimum |
|----------|---------|
| OS | Ubuntu 24.04 LTS |
| CPU | 2 cores |
| RAM | 4 GB |
| Disk | 50 GB free |
| Network | Internet access |
## API Keys Required
The installer wizard will prompt for each key interactively:
| Provider | Purpose | Signup |
|----------|---------|--------|
| MiniMax | Primary coding LLM — M2.5 (Coding Plan Plus) | [minimax.io](https://www.minimax.io) |
| OpenRouter | Kimi K2.5 (thinking + validation) | [openrouter.ai](https://openrouter.ai) |
| Brave Search | Web search API | [brave.com/search/api](https://brave.com/search/api) |
| Perplexity | Deep research API | [perplexity.ai](https://www.perplexity.ai) |
| Telegram | Bot alerts (create via @BotFather) | [t.me/BotFather](https://t.me/BotFather) |
| Cloudflare | Tunnel for dashboard | [cloudflare.com](https://www.cloudflare.com) |
## Quick Start
```bash
git clone https://github.com/milkbotai/claw-install.git
cd claw-install
sudo ./installer/install.sh
```
The installer runs 14 steps in order:
1. **Pre-flight validation** - OS, CPU, RAM, disk, network, required packages
2. **VPS security hardening** - SSH key-only auth, UFW firewall, automatic security updates
3. **Swap configuration** - 4GB swap file for long-running agent stability
4. **Service user setup** - Creates `milkbot` with whitelisted sudo access
5. **API key configuration** - Interactive wizard for all provider keys
6. **Integration setup** - GitHub SSH, Gmail app password, Google Drive OAuth
7. **MilkBotClaw installation** - Node.js (via NodeSource), npm, `openclaw@latest`
8. **Redis & PostgreSQL** - Inter-agent communication, task queues, persistent state
9. **Workspace deployment** - Agent identity files, onboarding templates, memory
10. **Dashboard & monitoring** - Streamlit dashboard, Python venv, resource monitor
11. **Backup configuration** - Google Drive upload via gdrive/rclone, 6-hour schedule
12. **Cloudflare tunnel** - Public dashboard exposure at dashboard.milkbot.ai
13. **Systemd services** - openclaw, dashboard, health timer, backup timer
14. **Post-install validation** - Verifies all components are running
The installer is **resume-aware** -- if interrupted, re-run the same command and it skips completed steps.
## Post-Installation
```bash
# Check agent status
systemctl status openclaw
# Follow live logs
journalctl -u openclaw -f
# Dashboard (local)
http://localhost:8501
# Run health check manually
sudo -u milkbot /opt/openclaw/scripts/health-check.sh
# Run validation suite
sudo ./installer/validate.sh
```
## Directory Structure
```
/opt/openclaw/ # Installation root
config/
.env # API keys (640 permissions)
providers/ # LLM provider configs (JSON)
context-limits.json # Per-provider context window limits
failover.json # Model failover rules (400/429/500+)
scripts/
health-check.sh # API + system health validation
alert-telegram.sh # Rate-limited Telegram notifications
backup-to-drive.sh # Google Drive backup upload
auto-resume.sh # Task detection on restart
resource-monitor.sh # Disk/RAM/CPU threshold alerts
memory-prune.sh # Agent memory file management
github-commit.sh # Automated workspace commits
context-optimizer.sh # Context overflow monitoring
mission-worker.sh # Mission step polling and execution
event-reactor.sh # Event-driven rule matching
heartbeat-bridge.sh # Redis liveness bridge
outcome-learner.sh # Daily outcome analysis
daily-digest.sh # Telegram status summary (8 AM)
twitter-post.sh # Post tweets to @MilkBot_ai
twitter-monitor.sh # Monitor Twitter mentions
webhook-receiver.py # HTTP event ingestion (port 8502)
google-drive-upload.py # Token-based Drive upload
google-oauth.py # Google OAuth flow setup
workspace/ # Agent personality & state
SOUL.md, IDENTITY.md # Core identity files
MEMORY.md # Agent memory (auto-managed)
AGENTS.md, TOOLS.md # Capabilities and tool access
EMPLOYEE_*.md # Agent onboarding and identity files
AGENT_COMMUNICATION.md # Redis-based inter-agent protocol
dashboard/
app.py # Streamlit Bloomberg-style dashboard
pages/ # Multi-page dashboard (Mission Queue, Learning, Agents, ROI)
logs/ # Service and health logs
backups/ # Local backup archives
```
## Systemd Services
| Service | Type | Schedule |
|---------|------|----------|
| `openclaw.service` | Long-running | Always on |
| `openclaw-dashboard.service` | Long-running | Always on |
| `openclaw-atlas.service` | Long-running | Always on |
| `openclaw-scout.service` | Long-running | Always on |
| `openclaw-mission-worker.service` | Long-running | Always on |
| `openclaw-event-reactor.service` | Long-running | Always on |
| `openclaw-heartbeat-bridge.service` | Long-running | Always on |
| `openclaw-twitter-monitor.service` | Long-running | Always on (optional) |
| `openclaw-webhook.service` | Long-running | Always on (optional) |
| `openclaw-bot-commander.service` | Long-running | Always on (optional) |
| `openclaw-health.timer` | Oneshot | Every 30 minutes |
| `openclaw-backup.timer` | Oneshot | Every 6 hours |
| `openclaw-learning.timer` | Oneshot | Daily at 2:00 AM |
| `cloudflared.service` | Long-running | Always on |
## Uninstalling
```bash
sudo ./installer/uninstall.sh
```
This stops all services, removes `/opt/openclaw`, the `milkbot` user, sudoers config, systemd units, and logrotate config.
## Testing
```bash
# Static analysis (~520 tests)
bash tests/test_bash_scripts.sh
# Behavioral unit tests (48 tests)
bash tests/test_unit_functions.sh
# Integration tests (18 tests)
bash tests/test_integration.sh
# Dashboard tests (~194 tests, requires venv)
python3 -m venv /tmp/test-venv
/tmp/test-venv/bin/pip install pytest pyyaml
/tmp/test-venv/bin/pytest tests/test_dashboard.py -v
# Live API integration tests (requires .env.test with real keys)
bash tests/test_live_integration.sh
# Shellcheck
shellcheck -x installer/*.sh scripts/*.sh
```
## Documentation
| Document | Description |
|----------|-------------|
| [API Setup](docs/API_SETUP.md) | How to obtain and configure each API key |
| [Architecture](docs/ARCHITECTURE.md) | System components, provider routing, limitations |
| [Troubleshooting](docs/TROUBLESHOOTING.md) | Common issues and fixes |
| [Monitoring](docs/MONITORING.md) | Health checks, alerts, resource thresholds |
| [Runbook](docs/RUNBOOK.md) | Operational procedures |
| [Disaster Recovery](docs/DISASTER_RECOVERY.md) | Backup restoration, service recovery |
| [Upgrading](docs/UPGRADING.md) | Version upgrade procedures |
| [Mission System](docs/MISSION_SYSTEM.md) | Task queue and agent coordination |
| [Outcome Learning](docs/OUTCOME_LEARNING.md) | Automated performance analysis |
| [Agent Communication](docs/AGENT_COMMUNICATION.md) | Redis-based inter-agent protocol |
| [Developer Guide](docs/DEVELOPER.md) | Repository structure and development |
| [Deploy Guide](docs/DEPLOY.md) | Production deployment procedures |
| [Changelog](docs/CHANGELOG.md) | Release history |
| [SLA](docs/SLA.md) | Service level agreements |
## Support
- **Issues:** [GitHub Issues](https://github.com/milkbotai/claw-install/issues)
- **Troubleshooting:** [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
- **Runbook:** [docs/RUNBOOK.md](docs/RUNBOOK.md)
## License
[MIT](LICENSE)