-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
290 lines (279 loc) · 10.4 KB
/
docker-compose.yml
File metadata and controls
290 lines (279 loc) · 10.4 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
# ============================================================================
# DAFU - Data Analytics Functional Utilities
# Docker Compose Configuration
# ============================================================================
#
# ⚠️ CURRENT STATUS: Infrastructure Prepared - Services Commented Out
#
# WHAT WORKS NOW:
# - ML Models (Isolation Forest, LSTM/GRU) - Use Python directly
# - Model training, prediction, persistence
# - Stream and batch processing
# - All fraud detection features
#
# HOW TO USE ML MODELS NOW:
# cd core/features/fraud_detection
# python3 -m venv venv
# source venv/bin/activate # Windows: venv\Scripts\activate
# pip install -r requirements.txt
# cd src/models
# python main.py # Interactive model selection
#
# DOCKER SERVICES STATUS:
# All services below are commented out until API-ML integration is complete.
#
# WHAT'S PREPARED (Ready to uncomment when integration is done):
# - Fraud Detection API (FastAPI) - Basic structure ready
# - PostgreSQL Database - Complete schema prepared
# - Redis Cache - Configuration ready
# - RabbitMQ Message Broker - Configuration ready
# - Celery Workers - Not implemented yet
# - Prometheus Monitoring - Configuration ready
# - Grafana Dashboards - Configuration ready
#
# TO ACTIVATE DOCKER SERVICES:
# 1. Complete ML-API integration in fraud_detection/src/api/main.py
# 2. Uncomment desired services below
# 3. Run: docker-compose up -d
#
# See DOCKER_STATUS.md for detailed information and integration roadmap
#
# ============================================================================
# All services are now active with auth, logs, reports, and product management
services:
# ==========================================================================
# Fraud Detection API Service
# ==========================================================================
fraud-detection-api:
build:
context: .
dockerfile: ./core/features/fraud_detection/deployment/Dockerfile
container_name: dafu-fraud-api
restart: unless-stopped
ports:
- "${API_PORT:-8000}:8000"
environment:
- FRAUD_DETECTION_ENV=${FRAUD_DETECTION_ENV:-development}
- LOG_LEVEL=${LOG_LEVEL:-INFO}
- API_WORKERS=${API_WORKERS:-4}
- DATABASE_URL=postgresql://${POSTGRES_USER:-dafu}:${POSTGRES_PASSWORD:-dafu_secure_password}@postgres:5432/${POSTGRES_DB:-dafu}
- REDIS_URL=redis://redis:6379/0
- MODEL_STORAGE_PATH=/app/models
- RESULTS_PATH=/app/results
- SECRET_KEY=${SECRET_KEY:-change-this-secret-key-in-production}
- API_KEY_ENABLED=${API_KEY_ENABLED:-false}
- ENABLE_MONITORING=${ENABLE_MONITORING:-true}
- ENABLE_RATE_LIMITING=${ENABLE_RATE_LIMITING:-true}
- MAX_WORKERS=${MAX_WORKERS:-4}
- WORKER_TIMEOUT=${WORKER_TIMEOUT:-300}
volumes:
- ./core/features/fraud_detection/models:/app/models
- ./core/features/fraud_detection/results:/app/results
- ./core/features/fraud_detection/logs:/app/logs
depends_on:
- postgres
- redis
networks:
- dafu-network
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# # ==========================================================================
# # Celery Worker Service
# # ==========================================================================
# celery-worker:
# build:
# context: ./fraud_detection
# dockerfile: deployment/Dockerfile
# container_name: dafu-celery-worker
# restart: unless-stopped
# command: celery -A src.tasks.celery_app worker --loglevel=info --concurrency=4
# environment:
# - FRAUD_DETECTION_ENV=${FRAUD_DETECTION_ENV:-development}
# - LOG_LEVEL=${LOG_LEVEL:-INFO}
# - DATABASE_URL=postgresql://${POSTGRES_USER:-dafu}:${POSTGRES_PASSWORD:-dafu_secure_password}@postgres:5432/${POSTGRES_DB:-dafu}
# - REDIS_URL=redis://redis:6379/0
# - RABBITMQ_URL=amqp://${RABBITMQ_USER:-dafu}:${RABBITMQ_PASSWORD:-dafu_rabbitmq_password}@rabbitmq:5672/
# - MODEL_STORAGE_PATH=/app/models
# - RESULTS_PATH=/app/results
# volumes:
# - ./fraud_detection/models:/app/models
# - ./fraud_detection/results:/app/results
# - ./fraud_detection/logs:/app/logs
# depends_on:
# - postgres
# - redis
# - rabbitmq
# networks:
# - dafu-network
# ==========================================================================
# PostgreSQL Database
# ==========================================================================
postgres:
image: postgres:15-alpine
container_name: dafu-postgres
restart: unless-stopped
ports:
- "${POSTGRES_PORT:-5432}:5432"
environment:
- POSTGRES_USER=${POSTGRES_USER:-dafu}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-dafu_secure_password}
- POSTGRES_DB=${POSTGRES_DB:-dafu}
- PGDATA=/var/lib/postgresql/data/pgdata
volumes:
- postgres-data:/var/lib/postgresql/data
- ./core/features/fraud_detection/deployment/init-db.sql:/docker-entrypoint-initdb.d/init.sql:ro
networks:
- dafu-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-dafu}"]
interval: 10s
timeout: 5s
retries: 5
# ==========================================================================
# Redis Cache
# ==========================================================================
redis:
image: redis:7-alpine
container_name: dafu-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
command: redis-server --appendonly yes ${REDIS_PASSWORD:+--requirepass $REDIS_PASSWORD}
volumes:
- redis-data:/data
networks:
- dafu-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
# # ==========================================================================
# # RabbitMQ Message Broker
# # ==========================================================================
# rabbitmq:
# image: rabbitmq:3.12-management-alpine
# container_name: dafu-rabbitmq
# restart: unless-stopped
# ports:
# - "${RABBITMQ_PORT:-5672}:5672"
# - "${RABBITMQ_MANAGEMENT_PORT:-15672}:15672"
# environment:
# - RABBITMQ_DEFAULT_USER=${RABBITMQ_USER:-dafu}
# - RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD:-dafu_rabbitmq_password}
# - RABBITMQ_DEFAULT_VHOST=/
# volumes:
# - rabbitmq-data:/var/lib/rabbitmq
# networks:
# - dafu-network
# healthcheck:
# test: ["CMD", "rabbitmq-diagnostics", "ping"]
# interval: 30s
# timeout: 10s
# retries: 5
# # ==========================================================================
# # Prometheus Monitoring
# # ==========================================================================
# prometheus:
# image: prom/prometheus:latest
# container_name: dafu-prometheus
# restart: unless-stopped
# ports:
# - "${PROMETHEUS_PORT:-9090}:9090"
# command:
# - '--config.file=/etc/prometheus/prometheus.yml'
# - '--storage.tsdb.path=/prometheus'
# - '--web.console.libraries=/usr/share/prometheus/console_libraries'
# - '--web.console.templates=/usr/share/prometheus/consoles'
# volumes:
# - ./fraud_detection/deployment/prometheus.yml:/etc/prometheus/prometheus.yml:ro
# - prometheus-data:/prometheus
# networks:
# - dafu-network
# depends_on:
# - fraud-detection-api
# # ==========================================================================
# # Grafana Dashboards
# # ==========================================================================
# grafana:
# image: grafana/grafana:latest
# container_name: dafu-grafana
# restart: unless-stopped
# ports:
# - "${GRAFANA_PORT:-3000}:3000"
# environment:
# - GF_SECURITY_ADMIN_USER=${GRAFANA_USER:-admin}
# - GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
# - GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
# volumes:
# - grafana-data:/var/lib/grafana
# - ./fraud_detection/deployment/grafana-dashboards:/etc/grafana/provisioning/dashboards:ro
# - ./fraud_detection/deployment/grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml:ro
# networks:
# - dafu-network
# depends_on:
# - prometheus
# # ==========================================================================
# # PgAdmin (Database Management UI)
# # ==========================================================================
# pgadmin:
# image: dpage/pgadmin4:latest
# container_name: dafu-pgadmin
# restart: unless-stopped
# ports:
# - "${PGADMIN_PORT:-5050}:80"
# environment:
# - PGADMIN_DEFAULT_EMAIL=${PGADMIN_EMAIL:-admin@dafu.local}
# - PGADMIN_DEFAULT_PASSWORD=${PGADMIN_PASSWORD:-admin}
# volumes:
# - pgadmin-data:/var/lib/pgadmin
# networks:
# - dafu-network
# depends_on:
# - postgres
# profiles:
# - tools
# # ==========================================================================
# # Redis Commander (Redis Management UI)
# # ==========================================================================
# redis-commander:
# image: rediscommander/redis-commander:latest
# container_name: dafu-redis-commander
# restart: unless-stopped
# ports:
# - "${REDIS_COMMANDER_PORT:-8081}:8081"
# environment:
# - REDIS_HOSTS=local:redis:6379${REDIS_PASSWORD:+:$REDIS_PASSWORD}
# networks:
# - dafu-network
# depends_on:
# - redis
# profiles:
# - tools
# ============================================================================
# Networks (Uncomment when services are active)
# ============================================================================
networks:
dafu-network:
driver: bridge
name: dafu-network
# ============================================================================
# Volumes (Uncomment when services are active)
# ============================================================================
volumes:
postgres-data:
name: dafu-postgres-data
redis-data:
name: dafu-redis-data
rabbitmq-data:
name: dafu-rabbitmq-data
prometheus-data:
name: dafu-prometheus-data
grafana-data:
name: dafu-grafana-data
pgadmin-data:
name: dafu-pgadmin-data