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
# ZeptoClaw Multi-Tenant Deployment
#
# Each tenant runs in their own container with complete isolation.
# ZeptoClaw is ~4MB binary, ~6MB RSS - hundreds of tenants on a single VPS.
#
# Setup:
# 1. Build the image: docker build -t zeptoclaw .
# 2. Create tenant configs: ./scripts/add-tenant.sh tenant-name BOT_TOKEN API_KEY
# 3. Start all tenants: docker compose -f docker-compose.multi-tenant.yml up -d
# 4. Add more tenants: Run add-tenant.sh again, then docker compose up -d
#
# Each tenant gets:
# - Own container (process + filesystem isolation)
# - Own config.json (API keys, bot token, tool settings)
# - Own persistent volume (sessions, memory, workspace)
# - Own resource limits (CPU, memory)
x-zeptoclaw-defaults:
image: zeptoclaw:latest
restart: unless-stopped
logging:
driver: json-file
options:
max-size: "10m"
max-file: "3"
deploy:
resources:
limits:
memory: 128M
cpus: "0.25"
reservations:
memory: 32M
cpus: "0.05"
services:
# =========================================================================
# Tenant: shop-ahmad
# Telegram bot for Ahmad's Shopee store
# =========================================================================
tenant-shop-ahmad:
<<: *defaults
container_name: zc-shop-ahmad
volumes:
- shop-ahmad-data:/data
- ./tenants/shop-ahmad/config.json:/data/config.json:ro
environment:
- RUST_LOG=zeptoclaw=info
- RUST_LOG_FORMAT=json
- ZEPTOCLAW_HEALTH_PORT=9090
labels:
com.zeptoclaw.tenant: shop-ahmad
com.zeptoclaw.version: "0.1.0"
com.zeptoclaw.env: production
healthcheck:
test:
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
command:
# =========================================================================
# Tenant: shop-fatimah
# Telegram bot for Fatimah's online bakery
# =========================================================================
tenant-shop-fatimah:
<<: *defaults
container_name: zc-shop-fatimah
volumes:
- shop-fatimah-data:/data
- ./tenants/shop-fatimah/config.json:/data/config.json:ro
environment:
- RUST_LOG=zeptoclaw=info
- RUST_LOG_FORMAT=json
- ZEPTOCLAW_HEALTH_PORT=9090
labels:
com.zeptoclaw.tenant: shop-fatimah
com.zeptoclaw.version: "0.1.0"
com.zeptoclaw.env: production
healthcheck:
test:
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
command:
# =========================================================================
# Tenant: shop-ali
# Telegram bot for Ali's electronics store
# =========================================================================
tenant-shop-ali:
<<: *defaults
container_name: zc-shop-ali
volumes:
- shop-ali-data:/data
- ./tenants/shop-ali/config.json:/data/config.json:ro
environment:
- RUST_LOG=zeptoclaw=info
- RUST_LOG_FORMAT=json
- ZEPTOCLAW_HEALTH_PORT=9090
labels:
com.zeptoclaw.tenant: shop-ali
com.zeptoclaw.version: "0.1.0"
com.zeptoclaw.env: production
healthcheck:
test:
interval: 30s
timeout: 5s
retries: 3
start_period: 10s
command:
# =========================================================================
# Add more tenants by copying a block above and changing:
# 1. Service name: tenant-<name>
# 2. Container name: zc-<name>
# 3. Volume names: <name>-data
# 4. Config path: ./tenants/<name>/config.json
# 5. Labels: com.zeptoclaw.tenant: <name>
#
# Then add the volume to the volumes section below.
# =========================================================================
volumes:
shop-ahmad-data:
shop-fatimah-data:
shop-ali-data: