-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
300 lines (274 loc) · 8.44 KB
/
Copy pathdocker-compose.yml
File metadata and controls
300 lines (274 loc) · 8.44 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
version: '3.8'
services:
# =============================================================================
# PLAYWRIGHT TEST RUNNER
# =============================================================================
playwright-runner:
build:
context: .
target: testing
container_name: playwright-runner
volumes:
- ./reports:/app/reports
- ./logs:/app/logs
- ./.env:/app/.env:ro
environment:
- ENVIRONMENT=testing
- LOG_LEVEL=INFO
- HEADLESS=true
- PARALLEL_WORKERS=2
- BASE_URL=${BASE_URL:-https://example.com}
networks:
- playwright-network
depends_on:
- playwright-postgres
- playwright-redis
command: ["python", "-m", "pytest", "tests/", "--tb=short", "--junitxml=reports/junit-xml/results.xml"]
# =============================================================================
# PLAYWRIGHT DEVELOPMENT ENVIRONMENT
# =============================================================================
playwright-dev:
build:
context: .
target: development
container_name: playwright-dev
volumes:
- .:/app
- ./reports:/app/reports
- ./logs:/app/logs
- ./.env:/app/.env:ro
ports:
- "8000:8000"
environment:
- ENVIRONMENT=development
- LOG_LEVEL=DEBUG
- HEADLESS=false
- PARALLEL_WORKERS=1
- BASE_URL=${BASE_URL:-http://localhost:3000}
networks:
- playwright-network
depends_on:
- playwright-postgres
- playwright-redis
- playwright-appium
command: ["tail", "-f", "/dev/null"] # Keep container running
# =============================================================================
# DATABASE SERVICES
# =============================================================================
# PostgreSQL Database
playwright-postgres:
image: postgres:15-alpine
container_name: playwright-postgres
environment:
POSTGRES_DB: testdb
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpass
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./scripts/init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
networks:
- playwright-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U testuser -d testdb"]
interval: 10s
timeout: 5s
retries: 5
# Redis Cache
playwright-redis:
image: redis:7-alpine
container_name: playwright-redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- playwright-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# MongoDB Database
playwright-mongodb:
image: mongo:7-jammy
container_name: playwright-mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: password
MONGO_INITDB_DATABASE: testdb
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
- ./scripts/init-mongo.js:/docker-entrypoint-initdb.d/init-mongo.js:ro
networks:
- playwright-network
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
# =============================================================================
# MOBILE TESTING SERVICES
# =============================================================================
# Appium Server for Mobile Testing
playwright-appium:
image: appium/appium:latest
container_name: playwright-appium
ports:
- "4723:4723"
environment:
- APPIUM_ARGS=--address 0.0.0.0 --port 4723 --log-level info
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- playwright-network
depends_on:
- playwright-android
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4723/status"]
interval: 30s
timeout: 10s
retries: 5
# Android Emulator for Mobile Testing
playwright-android:
image: budtmo/docker-android-x86-11.0
container_name: playwright-android
privileged: true
ports:
- "6080:6080" # VNC
- "5554:5554" # ADB
- "5555:5555" # ADB
environment:
- DEVICE=Samsung Galaxy S6
- APPIUM=true
- AUTO_UPDATE=true
volumes:
- android_data:/tmp/android-unknown
networks:
- playwright-network
healthcheck:
test: ["CMD", "adb", "devices"]
interval: 30s
timeout: 10s
retries: 5
# =============================================================================
# MONITORING AND LOGGING SERVICES
# =============================================================================
# Grafana for Monitoring Dashboards
playwright-grafana:
image: grafana/grafana:latest
container_name: playwright-grafana
ports:
- "3001:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_ALLOW_SIGN_UP=false
volumes:
- grafana_data:/var/lib/grafana
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning:ro
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards:ro
networks:
- playwright-network
depends_on:
- playwright-prometheus
# Prometheus for Metrics Collection
playwright-prometheus:
image: prom/prometheus:latest
container_name: playwright-prometheus
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- prometheus_data:/prometheus
networks:
- playwright-network
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
# =============================================================================
# UTILITY SERVICES
# =============================================================================
# Selenium Grid Hub (for cross-browser testing)
playwright-selenium-hub:
image: selenium/hub:4.15.0
container_name: playwright-selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
environment:
- SE_EVENT_BUS_HOST=playwright-selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
networks:
- playwright-network
# Selenium Chrome Node
playwright-selenium-chrome:
image: selenium/node-chrome:4.15.0
container_name: playwright-selenium-chrome
depends_on:
- playwright-selenium-hub
environment:
- SE_EVENT_BUS_HOST=playwright-selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_HOST=playwright-selenium-chrome
volumes:
- /dev/shm:/dev/shm
networks:
- playwright-network
# Selenium Firefox Node
playwright-selenium-firefox:
image: selenium/node-firefox:4.15.0
container_name: playwright-selenium-firefox
depends_on:
- playwright-selenium-hub
environment:
- SE_EVENT_BUS_HOST=playwright-selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
- SE_NODE_HOST=playwright-selenium-firefox
volumes:
- /dev/shm:/dev/shm
networks:
- playwright-network
# =============================================================================
# VOLUMES
# =============================================================================
volumes:
postgres_data:
redis_data:
mongodb_data:
android_data:
grafana_data:
prometheus_data:
# =============================================================================
# NETWORKS
# =============================================================================
networks:
playwright-network:
driver: bridge
# =============================================================================
# USAGE EXAMPLES
# =============================================================================
# Run tests:
# docker-compose up playwright-runner
# Development environment:
# docker-compose up playwright-dev
# Full testing environment with all services:
# docker-compose up -d
# Stop all services:
# docker-compose down
# View logs:
# docker-compose logs -f playwright-runner
# Scale test runners:
# docker-compose up --scale playwright-runner=3
# Run specific test file:
# docker-compose run --rm playwright-runner python -m pytest tests/test_login.py -v