mydocker/OPENCLAW_SETUP.md

5.7 KiB

OpenClaw Setup Guide

OpenClaw: Personal AI Assistant that executes actions (emails, calendar, shell commands, API integrations)

Quick Setup

1. Configure Secrets

Edit ~/.openclaw_secrets with your API keys:

nano ~/.openclaw_secrets

Fill in:

  • ANTHROPIC_API_KEY - Claude API from Anthropic
  • OPENAI_API_KEY - GPT-4 / Codex from OpenAI
  • GITHUB_TOKEN - GitHub Copilot API access
  • TWILIO_* - WhatsApp integration (optional)
  • TELEGRAM_* - Telegram bot integration (optional)

2. Load Secrets

source ~/.openclaw_secrets

Or they auto-load when you open a new shell (bashrc sources them).

3. Start Service

cd ~/mydocker
docker-compose up -d openclaw

Access OpenClaw

Web UI

CLI

# Helper function (auto-loaded)
openclaw-cli "do something"

# Or directly
docker-compose exec openclaw openclaw "command"

WhatsApp

Send message to configured Twilio number → OpenClaw responds and executes

Telegram

Send message to bot (if TELEGRAM_BOT_TOKEN configured)

API

curl -X POST http://localhost:3001/api/execute \
  -H "Content-Type: application/json" \
  -d '{"action":"email","to":"user@example.com","subject":"test"}'

Bash Helpers

Auto-added to ~/.bashrc:

# Check which integrations are configured
openclaw-secrets

# Start the service
openclaw-start

# View logs
openclaw-logs

# Execute command via CLI
openclaw-cli "send email to john@example.com saying hello"

Configuration

File: /home/seba/mydocker/openclaw-config.json

Key settings:

  • ai.provider - Default AI model (claude, gpt, copilot)
  • integrations - Enable/disable services (WhatsApp, Telegram, Gmail, GitHub, etc.)
  • system.sandbox - Run in sandbox mode (safe)
  • system.shellAccess - Allow shell command execution
  • webUI.port - Web interface port (3000)
  • api.port - REST API port (3001)

AI Models Priority

OpenClaw tries in order:

  1. Claude (Anthropic) - Recommended, most capable
  2. GPT-4 (OpenAI) - Alternative
  3. Copilot (GitHub) - Code-focused

Configure via OPENCLAW_MODEL env var or config file.

Persistent Memory

  • Location: /data/memory (Docker volume)
  • Survives restarts: Yes
  • Clearable: docker-compose down won't delete it

Memory stores:

  • Your preferences
  • Past conversations
  • Learned patterns
  • Custom skills

Security & Sandbox

⚠️ Important:

  • OpenClaw runs with shell access (configurable via system.shellAccess)
  • Docker container is sandboxed from host
  • API keys stored in environment (not in code)
  • Config file mounted read-only

To disable shell access (safer): Edit openclaw-config.json:

"system": {
  "shellAccess": false
}

Then restart:

docker-compose restart openclaw

Skills & Plugins

OpenClaw can:

  • Read/write files
  • Execute shell commands (if enabled)
  • Call APIs (50+ integrations)
  • Send emails, messages
  • Manage calendars
  • Write its own plugins (with safe limits)

Troubleshooting

Check Secrets Are Loaded

openclaw-secrets

View Logs

openclaw-logs

Rebuild Image

docker-compose build --no-cache openclaw

Full Reset (deletes memory)

docker-compose down openclaw
docker volume rm mydocker_openclaw_memory
docker-compose up -d openclaw

Integration Examples

Send Email (via Gmail)

openclaw-cli "send email to boss@company.com subject 'report' body 'attached is...'"

Check Calendar

openclaw-cli "what's on my calendar tomorrow"

Execute Command

openclaw-cli "run git status in /home/seba/project"

GitHub Action

openclaw-cli "create pull request to close issue #123"

Environment Variables

All OpenClaw settings via .env:

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GITHUB_TOKEN=ghp_...
TWILIO_ACCOUNT_SID=AC...
TWILIO_AUTH_TOKEN=...
TELEGRAM_BOT_TOKEN=...

Docker Commands

# Start
docker-compose up -d openclaw

# Stop
docker-compose stop openclaw

# Restart
docker-compose restart openclaw

# View logs
docker-compose logs -f openclaw

# Shell access
docker-compose exec openclaw /bin/bash

# Delete service (keeps memory/config)
docker-compose down openclaw

# Rebuild
docker-compose build --no-cache openclaw && docker-compose up -d openclaw

Next Steps

  1. Add your API keys to ~/.openclaw_secrets
  2. Run source ~/.openclaw_secrets
  3. Start service: openclaw-start
  4. Access Web UI: https://openclaw.sebson.space
  5. Try CLI: openclaw-cli "hello"
  6. Set up WhatsApp/Telegram (optional)

Useful Resources

Domeny

Web UI

  • Domain: openclaw.sebson.space (dodane do DNS)
  • Internal: http://localhost:3000
  • Via Traefik: https://openclaw.sebson.space

API

  • Internal: http://localhost:3007 (changed from 3001 to avoid Grafana conflict)
  • Via Traefik: https://api.openclaw.sebson.space (optional - requires DNS record)

Port Mapping

Host   → Container
3000   → 3000 (Web UI)
3007   → 3001 (API)

Komunikacja

Telegram (primary)

  • Enabled
  • Wymaga: TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID
  • Bot will respond to messages and execute actions

WhatsApp (placeholder)

  • Disabled (ale możesz włączyć)
  • Wymaga: Twilio account + TWILIO_* variables
  • Jeśli będziesz chcieć - wystarczy zmienić "enabled": false na true w config

CLI (always available)

openclaw-cli "send message to telegram: hello"