forked from vkondepati/fleet-route-optimizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
125 lines (116 loc) · 3.04 KB
/
docker-compose.test.yml
File metadata and controls
125 lines (116 loc) · 3.04 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
version: "3.8"
services:
# Test Database
postgres-test:
image: postgres:14-alpine
environment:
POSTGRES_DB: openroute_test
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_password
ports:
- "5433:5432"
volumes:
- postgres_test_data:/var/lib/postgresql/data
- ./test-scripts/init-test-db.sql:/docker-entrypoint-initdb.d/init.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U test_user -d openroute_test"]
interval: 10s
timeout: 5s
retries: 5
# Test Redis
redis-test:
image: redis:6-alpine
ports:
- "6380:6379"
command: ["redis-server", "--appendonly", "yes"]
volumes:
- redis_test_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# Test WebSocket Server
websocket-test:
build:
context: .
dockerfile: test-dockerfiles/Dockerfile.websocket-test
ports:
- "8082:8081"
environment:
NODE_ENV: test
WS_PORT: 8081
depends_on:
- redis-test
volumes:
- ./test-scripts:/app/test-scripts
# Test API Server
api-test:
build:
context: .
dockerfile: Dockerfile.api
ports:
- "8001:3001" # host:container; API listens on 3001 in container
environment:
NODE_ENV: production
DATABASE_URL: postgres://test_user:test_password@postgres-test:5432/openroute_test
REDIS_URL: redis://redis-test:6379
JWT_SECRET: test-secret-key
depends_on:
postgres-test:
condition: service_healthy
redis-test:
condition: service_healthy
volumes:
- ./packages:/app/packages
- ./test-scripts:/app/test-scripts
command: ["node", "dist/src/api/start.js"] # matches your tsconfig output
healthcheck:
test: ["CMD-SHELL", "curl -fsS http://localhost:3001/health || exit 1"]
interval: 10s
timeout: 5s
retries: 5
# Test Web Interface
web-test:
build:
context: ./packages/web
dockerfile: ../../test-dockerfiles/Dockerfile.web-test
ports:
- "3001:3000"
environment:
NODE_ENV: test
REACT_APP_API_URL: http://localhost:8001
REACT_APP_WS_URL: ws://localhost:8082
depends_on:
- api-test
- websocket-test
volumes:
- ./packages/web/src:/app/src
# Test Load Balancer
nginx-test:
image: nginx:alpine
ports:
- "8080:80"
volumes:
- ./test-configs/nginx-test.conf:/etc/nginx/nginx.conf
depends_on:
- api-test
- web-test
# Test Monitoring
prometheus-test:
image: prom/prometheus:latest
ports:
- "9091:9090"
volumes:
- ./test-configs/prometheus-test.yml:/etc/prometheus/prometheus.yml
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
volumes:
postgres_test_data:
redis_test_data:
networks:
default:
name: openroute-test-network