-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
176 lines (168 loc) · 4.87 KB
/
docker-compose.yml
File metadata and controls
176 lines (168 loc) · 4.87 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
services:
# Python-based application with FastAPI, Streamlit, and Prefect
hubmail-app:
build:
context: ./python_app
dockerfile: Dockerfile
container_name: email-app
restart: unless-stopped
ports:
- "${API_PORT:-3001}:3001" # FastAPI
- "${UI_PORT:-8501}:8501" # Streamlit UI
volumes:
- ./python_app:/app
- ./python_app/.env:/app/.env:ro # Mount .env file as read-only
env_file:
- ./python_app/.env # Load all environment variables from .env file
environment:
# Only override specific values that need container-specific settings
- REDIS_HOST=redis
- REDIS_PORT=6379
- OLLAMA_HOST=ollama
- OLLAMA_CONTAINER_PORT=11434
- API_HOST=localhost
- PYTHONUNBUFFERED=1
networks:
- hubmail-network
depends_on:
- redis
- ollama
# Node-RED for visualization and workflow management
node-red:
image: nodered/node-red:latest
container_name: email-node-red
restart: unless-stopped
ports:
- "${NODERED_PORT:-1880}:1880"
volumes:
- node-red-data:/data
- ./config/node-red:/config
environment:
- TZ=${NODERED_TZ:-Europe/Warsaw}
- NODE_RED_ENABLE_PROJECTS=${NODERED_ENABLE_PROJECTS:-true}
networks:
- hubmail-network
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:1880/ || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
# Ollama for LLM processing
ollama:
image: ollama/ollama:latest
container_name: email-ollama
restart: unless-stopped
ports:
- "${OLLAMA_PORT:-11435}:11434"
volumes:
- ollama-data:/root/.ollama
environment:
- OLLAMA_ORIGINS=${OLLAMA_ORIGINS:-*}
networks:
- hubmail-network
healthcheck:
test: ["CMD-SHELL", "curl -s -f http://localhost:11434/api/version || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Prometheus for metrics collection
prometheus:
image: prom/prometheus:latest
container_name: email-prometheus
restart: unless-stopped
user: "root"
ports:
- "${PROMETHEUS_PORT:-9090}:9090"
volumes:
- ./config/prometheus:/etc/prometheus
- prometheus-data:/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.enable-lifecycle'
- '--storage.tsdb.retention.time=${PROMETHEUS_RETENTION:-30d}'
- '--web.console.templates=/etc/prometheus/consoles'
- '--web.console.libraries=/etc/prometheus/console_libraries'
networks:
- hubmail-network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:9090/-/healthy"]
interval: 30s
timeout: 10s
retries: 3
# Grafana for visualization
grafana:
image: grafana/grafana:latest
container_name: email-grafana
restart: unless-stopped
user: "${DOCKER_UID:-1000}:${DOCKER_GID:-1000}"
ports:
- "${GRAFANA_PORT:-3000}:3000"
volumes:
- grafana-data:/var/lib/grafana
- ./config/grafana/datasources:/etc/grafana/provisioning/datasources
- ./config/grafana/dashboards:/etc/grafana/provisioning/dashboards
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_ADMIN_PASSWORD:-admin}
- GF_USERS_ALLOW_SIGN_UP=${GRAFANA_ALLOW_SIGN_UP:-false}
- GF_INSTALL_PLUGINS=${GRAFANA_PLUGINS:-grafana-piechart-panel}
networks:
- hubmail-network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
# Redis for caching and message queuing
redis:
image: redis:alpine
container_name: email-redis
restart: unless-stopped
ports:
- "${REDIS_PORT:-6379}:6379"
volumes:
- redis-data:/data
command: redis-server --appendonly yes
environment:
- REDIS_PASSWORD=${REDIS_PASSWORD:-}
networks:
- hubmail-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Configuration Dashboard service
config-dashboard:
build:
context: ./config-dashboard
dockerfile: Dockerfile
container_name: email-config-dashboard
restart: unless-stopped
ports:
- "${CONFIG_DASHBOARD_PORT:-8502}:8502"
volumes:
- ./config-dashboard:/app
- ./.env:/app/.env:ro
- ./docker-compose.yml:/app/docker-compose.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro # Mount Docker socket
environment:
- PYTHONUNBUFFERED=1
networks:
- hubmail-network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://localhost:8502"]
interval: 30s
timeout: 10s
retries: 3
volumes:
node-red-data:
ollama-data:
prometheus-data:
grafana-data:
redis-data:
networks:
hubmail-network:
driver: bridge