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
|
services:
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
postgres:
image: postgres:16-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-trading}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-trading}
POSTGRES_DB: ${POSTGRES_DB:-trading}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD", "pg_isready", "-U", "trading"]
interval: 5s
timeout: 3s
retries: 5
data-collector:
build:
context: .
dockerfile: services/data-collector/Dockerfile
env_file: .env
ports:
- "8080:8080"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
strategy-engine:
build:
context: .
dockerfile: services/strategy-engine/Dockerfile
env_file: .env
ports:
- "8081:8081"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8081/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
order-executor:
build:
context: .
dockerfile: services/order-executor/Dockerfile
env_file: .env
ports:
- "8082:8082"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8082/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
portfolio-manager:
build:
context: .
dockerfile: services/portfolio-manager/Dockerfile
env_file: .env
ports:
- "8083:8083"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8083/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
api:
build:
context: .
dockerfile: services/api/Dockerfile
env_file: .env
ports:
- "8000:8000"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
news-collector:
build:
context: .
dockerfile: services/news-collector/Dockerfile
env_file: .env
ports:
- "8084:8084"
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8084/health')"]
interval: 10s
timeout: 5s
retries: 3
restart: unless-stopped
loki:
image: grafana/loki:latest
profiles: ["monitoring"]
ports:
- "3100:3100"
volumes:
- ./monitoring/loki/loki-config.yaml:/etc/loki/local-config.yaml
- loki_data:/loki
command: -config.file=/etc/loki/local-config.yaml
promtail:
image: grafana/promtail:latest
profiles: ["monitoring"]
volumes:
- ./monitoring/promtail/promtail-config.yaml:/etc/promtail/config.yaml
- /var/run/docker.sock:/var/run/docker.sock:ro
command: -config.file=/etc/promtail/config.yaml
depends_on:
- loki
prometheus:
image: prom/prometheus:latest
profiles: ["monitoring"]
ports:
- "9090:9090"
volumes:
- ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
depends_on:
- data-collector
- strategy-engine
- order-executor
- portfolio-manager
grafana:
image: grafana/grafana:latest
profiles: ["monitoring"]
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: admin
GF_AUTH_ANONYMOUS_ENABLED: "true"
volumes:
- ./monitoring/grafana/provisioning:/etc/grafana/provisioning
- ./monitoring/grafana/dashboards:/var/lib/grafana/dashboards
depends_on:
- prometheus
volumes:
redis_data:
postgres_data:
loki_data:
|