-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
200 lines (194 loc) · 6.38 KB
/
docker-compose.dev.yml
File metadata and controls
200 lines (194 loc) · 6.38 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
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: --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"]
timeout: 20s
retries: 10
# 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: ./backend
dockerfile: 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
- DATABASE_URL=mysql://root:lmeterx123@mysql:3306/lmeterx
- DB_HOST=mysql
- DB_PORT=3306
- DB_USER=root
- DB_PASSWORD=lmeterx123
- DB_NAME=lmeterx
- VICTORIA_METRICS_URL=http://victoria-metrics:8428
# ================= LDAP Authentication Configuration =================
# Set to 'on' to enable LDAP authentication
- LDAP_ENABLED=off
# Uncomment and configure the following when LDAP is enabled:
# - 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
# JWT configuration
# - JWT_SECRET_KEY=change-me-to-a-random-string
# - JWT_EXPIRE_MINUTES=10080
# Service Token for Skill/Agent programmatic access (binds to "agent" user)
# - LMETERX_AUTH_TOKEN=localhost_lmeterx
# Admin usernames (comma-separated). Admins can manage all tasks regardless of ownership.
# Leave empty for no admin accounts. Example: ADMIN_USERNAMES=admin,superuser
# - 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: ./st_engine
dockerfile: Dockerfile
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"
# automatically gets a unique ID derived from its container hostname.
# To use a fixed ID (single-instance only), uncomment the line below:
# ENGINE_ID: "engine-01"
# Multi-process configuration
ENABLE_MULTIPROCESS: auto
LOCUST_CPU_CORES: 2.0 # Must match deploy.resources.limits.cpus
MULTIPROCESS_THRESHOLD: 1000 # Enable multiprocess only for 1000+ users
MIN_USERS_PER_PROCESS: 500 # Each process handles at least 500 users
# Process management and stability
PYTHONUNBUFFERED: 1 # Ensure immediate log output
LOCUST_WORKER_HEARTBEAT_INTERVAL: 3 # Worker heartbeat interval (seconds)
LOCUST_MASTER_HEARTBEAT_INTERVAL: 3 # Master heartbeat check interval
LOCUST_MASTER_HEARTBEAT_TIMEOUT: 60 # Heartbeat timeout (seconds)
# Memory and performance tuning
MALLOC_ARENA_MAX: 2 # Limit memory arenas for stability
PYTHONMALLOC: malloc # Use system malloc for better memory management
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: 2G
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
# Set to 'on' to enable LDAP login UI (must match backend LDAP_ENABLED)
- VITE_LDAP_ENABLED=off
- 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