-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.agents.yml
More file actions
168 lines (145 loc) · 5.1 KB
/
docker-compose.agents.yml
File metadata and controls
168 lines (145 loc) · 5.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
# OpenClaw Agent Instances for CORE Orchestration
# Usage: docker compose -f docker-compose.agents.yml up --scale agent=3 -d
# This creates 3 agent instances that CORE can manage
networks:
core-network:
external: true
name: core-network
services:
# Template service for OpenClaw agent instances
# Each instance gets unique config via mounted directories
agent:
build:
context: .
dockerfile: docker/agent/Dockerfile
image: core/openclaw-agent:latest
environment:
# Core integration
CORE_ENDPOINT: ${CORE_ENDPOINT:-http://core-backend:8000}
AGENT_ROLE: ${AGENT_ROLE:-general}
AGENT_ID: ${AGENT_ID}
# Bot tokens (unique per instance)
DISCORD_BOT_TOKEN: ${DISCORD_BOT_TOKEN}
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_APP_TOKEN: ${SLACK_APP_TOKEN}
# Model configuration
ANTHROPIC_API_KEY: ${ANTHROPIC_API_KEY}
OPENAI_API_KEY: ${OPENAI_API_KEY}
CLAUDE_AI_SESSION_KEY: ${CLAUDE_AI_SESSION_KEY}
# OpenClaw specific
OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
NODE_ENV: production
HOME: /home/openclaw
TERM: xterm-256color
# Agent customization
OPENCLAW_WORKSPACE_DIR: /home/openclaw/workspace
OPENCLAW_DEFAULT_MODEL: ${OPENCLAW_DEFAULT_MODEL:-anthropic/claude-sonnet-4}
OPENCLAW_FALLBACK_MODEL: ${OPENCLAW_FALLBACK_MODEL:-anthropic/claude-opus-4-5}
# Disable GUI features for containerized environment
BROWSER: echo
OPENCLAW_A2UI_SKIP_MISSING: 1
volumes:
# Agent-specific config directory (CORE manages these)
- ./config/agents/${AGENT_ID:-default}:/home/openclaw/.openclaw
- ./config/agents/${AGENT_ID:-default}/workspace:/home/openclaw/workspace
# Shared resources (read-only)
- ./config/shared:/home/openclaw/shared:ro
networks:
- core-network
# Dynamic port allocation - CORE will manage this
# Ports are allocated per container instance
expose:
- "18789" # Gateway port
- "18790" # Bridge port (for node connections)
# Resource limits to prevent any single agent from overwhelming the system
deploy:
resources:
limits:
memory: 1G
cpus: '0.5'
reservations:
memory: 512M
cpus: '0.25'
# Restart policy for reliability
restart: unless-stopped
# Proper init system for signal handling
init: true
# Health check integration with CORE monitoring
healthcheck:
test: ["CMD", "node", "dist/index.js", "health", "--gateway-url", "ws://localhost:18789"]
interval: 30s
timeout: 10s
start_period: 60s
retries: 3
# Logging configuration
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
# Security and performance
security_opt:
- no-new-privileges:true
read_only: false # OpenClaw needs to write to workspace
tmpfs:
- /tmp:size=100M,mode=1777
# Labels for CORE identification and management
labels:
- "core.service=openclaw-agent"
- "core.managed=true"
- "core.agent.role=${AGENT_ROLE:-general}"
- "core.agent.id=${AGENT_ID:-unknown}"
# Additional services for specialized agent types
# Discord-specific agent (example specialization)
discord-agent:
extends:
service: agent
environment:
AGENT_ROLE: discord-bot
OPENCLAW_DEFAULT_MODEL: anthropic/claude-sonnet-4
# Discord-specific channel configuration
OPENCLAW_CHANNELS_DISCORD_ENABLED: "true"
OPENCLAW_CHANNELS_TELEGRAM_ENABLED: "false"
OPENCLAW_CHANNELS_SLACK_ENABLED: "false"
volumes:
- ./config/agents/discord:/home/openclaw/.openclaw
- ./config/agents/discord/workspace:/home/openclaw/workspace
labels:
- "core.service=openclaw-discord-agent"
- "core.agent.role=discord-bot"
profiles:
- discord
# Development/Testing agent with additional tools
dev-agent:
extends:
service: agent
environment:
AGENT_ROLE: development
OPENCLAW_DEFAULT_MODEL: anthropic/claude-opus-4-5
NODE_ENV: development
# Enable additional development tools
OPENCLAW_BROWSER_ENABLED: "true"
OPENCLAW_SANDBOX_ENABLED: "true"
volumes:
- ./config/agents/dev:/home/openclaw/.openclaw
- ./config/agents/dev/workspace:/home/openclaw/workspace
- /var/run/docker.sock:/var/run/docker.sock:ro # For sandbox containers
labels:
- "core.service=openclaw-dev-agent"
- "core.agent.role=development"
profiles:
- development
# Example usage commands:
#
# Start 3 general agents:
# docker compose -f docker-compose.agents.yml up --scale agent=3 -d
#
# Start with Discord agent:
# docker compose -f docker-compose.agents.yml --profile discord up -d
#
# Start development environment:
# docker compose -f docker-compose.agents.yml --profile development up dev-agent -d
#
# Scale dynamically:
# docker compose -f docker-compose.agents.yml up --scale agent=5 -d