-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
230 lines (224 loc) · 7.65 KB
/
Copy pathdocker-compose.dev.yml
File metadata and controls
230 lines (224 loc) · 7.65 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
services:
# MySQL
mysql:
image: mysql:5.7
container_name: lmeterx-mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: lmeterx123
MYSQL_DATABASE: lmeterx
TZ: Asia/Shanghai
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
- ./init_db.sql:/docker-entrypoint-initdb.d/init_db.sql
command: ["mysqld", "--default-authentication-plugin=mysql_native_password", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--init-connect=SET NAMES utf8mb4", "--default-time-zone=+08:00"]
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-plmeterx123"]
interval: 10s
timeout: 20s
retries: 10
start_period: 60s
# VictoriaMetrics - lightweight time-series database for monitoring metrics
victoria-metrics:
image: victoriametrics/victoria-metrics:v1.106.1
container_name: lmeterx-victoria-metrics
restart: unless-stopped
ports:
- "8428:8428"
environment:
TZ: Asia/Shanghai
volumes:
- vm_data:/victoria-metrics-data
command:
- "-retentionPeriod=7d"
- "-search.maxUniqueTimeseries=50000"
- "-memory.allowedPercent=60"
- "-search.latencyOffset=1s"
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 64M
healthcheck:
test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8428/health"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
# backend service
backend:
build:
context: .
dockerfile: backend/Dockerfile
args:
BASE_IMAGE: ${BACKEND_BASE_IMAGE:-charmy1220/lmeterx-be-base:latest}
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
victoria-metrics:
condition: service_healthy
environment:
- TZ=Asia/Shanghai
- DB_HOST=mysql
- DB_PORT=3306
- DB_USER=root
- DB_PASSWORD=lmeterx123
- DB_NAME=lmeterx
- VICTORIA_METRICS_URL=http://victoria-metrics:8428
# Standalone defaults: no SLS, no OSS, no Kubernetes reconcile, no LDAP.
- SLS_ENABLED=false
- OSS_ENABLED=false
- K8S_RECONCILE_ENABLED=false
- LDAP_ENABLED=false
# Required for encrypted A2A/MCP request headers.
# Format must be key-id:fernet-key (e.g. v1:<key>). Generate a Fernet key:
# python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
- AGENT_CREDENTIAL_ENCRYPTION_KEYS=v1:KhYMLSiss3x5KAa0Dp-5Upma6W3Nr0UKKr67C0PCm5g=
# Uncomment and configure the following only when LDAP_ENABLED=true:
# - LDAP_SERVER=ldap://ldap.example.com
# - LDAP_PORT=389
# - LDAP_USE_SSL=false
# - LDAP_TIMEOUT=5
# - LDAP_SEARCH_BASE=dc=example,dc=com
# - LDAP_SEARCH_FILTER=(sAMAccountName={username})
# Method 1: Direct bind (simple LDAP)
# - LDAP_USER_DN_TEMPLATE=cn={username},ou=users,dc=example,dc=com
# Method 2: Service account bind (Active Directory)
# - LDAP_BIND_DN=cn=service,ou=users,dc=example,dc=com
# - LDAP_BIND_PASSWORD=service_password
# Use a strong random JWT secret before enabling LDAP.
# - JWT_SECRET_KEY=change-me-to-a-random-string
# - JWT_EXPIRE_MINUTES=10080
# Set secure=true when the browser accesses LMeterX over HTTPS.
# - JWT_COOKIE_SECURE=false
# - JWT_COOKIE_SAMESITE=lax
# - JWT_COOKIE_DOMAIN=
# - JWT_COOKIE_PATH=/
# Only checked when LDAP is on:
# - ENGINE_API_TOKEN=
# - LMETERX_AUTH_TOKEN=
# Admin list is only used when LDAP is on. Empty = no admins.
# Ignored when LDAP is off — everyone is treated as admin.
# - ADMIN_USERNAMES=
volumes:
- ./logs:/app/logs
- ./upload_files:/app/upload_files
healthcheck:
test: [ "CMD", "curl", "-s", "-f", "http://localhost:5001/health" ]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s
# engine service
engine:
build:
context: .
dockerfile: st_engine/Dockerfile
restart: unless-stopped
depends_on:
mysql:
condition: service_healthy
backend:
condition: service_healthy
victoria-metrics:
condition: service_healthy
environment:
TZ: Asia/Shanghai
# Single-node API mode: poll the local Backend. db mode is deprecated.
ENGINE_MODE: api
BACKEND_URL: "http://backend:5001"
# Local Engine identity, not a remote/multi-cluster setup.
CLUSTER_ID: local
# Empty while LDAP is off. Set the same value on Backend when LDAP is on.
ENGINE_API_TOKEN: ""
VICTORIA_METRICS_URL: "http://victoria-metrics:8428"
SLS_ENABLED: false
OSS_ENABLED: false
# Each replica derives a unique ENGINE_ID from its container hostname.
# Set a fixed ID only for a single-instance deployment:
# ENGINE_ID: "engine-01"
# --- DB mode settings (deprecated, only used when ENGINE_MODE=db) ---
# DB_HOST: mysql
# DB_PORT: 3306
# DB_USER: root
# DB_PASSWORD: lmeterx123
# DB_NAME: lmeterx
# Multi-process configuration
ENABLE_MULTIPROCESS: auto
LOCUST_CPU_CORES: 2.0 # Must match deploy.resources.limits.cpus
MULTIPROCESS_THRESHOLD: 1000 # Enable only when users exceed 1000
MIN_USERS_PER_PROCESS: 500 # Each process handles at least 500 users
# Engine polling and heartbeat
ENGINE_HEARTBEAT_INTERVAL: 10 # Backend heartbeat interval (seconds)
TASK_POLL_INTERVAL: 3 # New-task polling interval (seconds)
STOP_POLL_INTERVAL: 5 # Stop-request polling interval (seconds)
RESOURCE_COLLECT_INTERVAL: 2 # Resource metrics interval (seconds)
# Process management and stability
PYTHONUNBUFFERED: 1 # Ensure immediate log output
# Memory and performance tuning
MALLOC_ARENA_MAX: 2 # Limit memory arenas for stability
PYTHONMALLOC: malloc # Use system malloc for better memory management
DETAIL_LOG_LEVEL: "DEBUG"
ulimits:
nofile:
soft: 65536
hard: 65536
volumes:
- ./logs:/app/logs
- ./upload_files:/app/upload_files
# Mount image directory for ShareGPT dataset
- ./data:/app/data
# Resource limits for the container
deploy:
resources:
limits:
cpus: '2.0' # Must match LOCUST_CPU_CORES
memory: 4G
reservations:
cpus: '1.0'
memory: 1G
healthcheck:
test: [ "CMD", "curl", "-s", "-f", "http://localhost:5002/health" ]
interval: 10s
timeout: 10s
retries: 5
start_period: 30s
# frontend service
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: lmeterx-frontend
restart: unless-stopped
depends_on:
backend:
condition: service_healthy
ports:
- "8080:80"
environment:
- TZ=Asia/Shanghai
- VITE_API_BASE_URL=/api
# Must match backend SLS_ENABLED. false/off = UI skips SLS log endpoints.
- VITE_SLS_ENABLED=false
# Must match backend LDAP_ENABLED. false/off = no login UI.
- VITE_LDAP_ENABLED=false
- VITE_PERSIST_ACCESS_TOKEN=true
healthcheck:
test: [ "CMD", "curl", "-s", "-f", "http://localhost:80" ]
interval: 10s
timeout: 5s
retries: 3
volumes:
- ./upload_files:/usr/share/nginx/html/uploads
volumes:
mysql_data:
vm_data:
networks:
default:
name: lmeterx-network