-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
221 lines (207 loc) · 5.19 KB
/
docker-compose.yml
File metadata and controls
221 lines (207 loc) · 5.19 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
version: '3.8'
services:
# PostgreSQL Cluster
postgres-master:
image: postgres:15
environment:
POSTGRES_DB: synapse
POSTGRES_USER: synapse
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
volumes:
- postgres_master_data:/var/lib/postgresql/data
- ./infra/postgres/master-init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5432:5432"
networks:
- backend
healthcheck:
test: ["CMD-SHELL", "pg_isready -U synapse"]
interval: 30s
timeout: 10s
retries: 3
postgres-slave:
image: postgres:15
environment:
POSTGRES_DB: synapse
POSTGRES_USER: synapse
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
volumes:
- postgres_slave_data:/var/lib/postgresql/data
- ./infra/postgres/slave-init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "5433:5432"
depends_on:
postgres-master:
condition: service_healthy
networks:
- backend
command: >
bash -c "
until pg_basebackup -h postgres-master -D /var/lib/postgresql/data -U synapse -vP -W; do
echo 'Waiting for master to connect...'
sleep 1
done
echo 'host replication synapse 0.0.0.0/0 md5' >> /var/lib/postgresql/data/pg_hba.conf
exec postgres -c config_file=/var/lib/postgresql/data/postgresql.conf
"
pgbouncer:
image: brainsam/pgbouncer:latest
environment:
DB_HOST: postgres-master
DB_PORT: 5432
DB_USER: synapse
DB_PASSWORD: ${POSTGRES_PASSWORD}
POOL_MODE: transaction
MAX_CLIENT_CONN: 1000
DEFAULT_POOL_SIZE: 20
ports:
- "6432:5432"
depends_on:
- postgres-master
networks:
- backend
# Redis Cluster
redis-1:
image: redis:7-alpine
command: redis-server --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
ports:
- "7001:6379"
volumes:
- redis_1_data:/data
networks:
- backend
redis-2:
image: redis:7-alpine
command: redis-server --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
ports:
- "7002:6379"
volumes:
- redis_2_data:/data
networks:
- backend
redis-3:
image: redis:7-alpine
command: redis-server --cluster-enabled yes --cluster-config-file nodes.conf --cluster-node-timeout 5000 --appendonly yes
ports:
- "7003:6379"
volumes:
- redis_3_data:/data
networks:
- backend
# Monitoring Stack
prometheus:
image: prom/prometheus:latest
ports:
- "9090:9090"
volumes:
- ./infra/monitoring/prometheus.yml:/etc/prometheus/prometheus.yml
- prometheus_data:/prometheus
networks:
- backend
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
grafana:
image: grafana/grafana:latest
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: ${GRAFANA_PASSWORD}
volumes:
- grafana_data:/var/lib/grafana
- ./infra/monitoring/grafana/provisioning:/etc/grafana/provisioning
networks:
- backend
depends_on:
- prometheus
# Microservices
mesh-gateway:
build:
context: ./services/mesh-gateway
dockerfile: Dockerfile
ports:
- "8080:8080"
volumes:
- ./services/mesh-gateway/config.yaml:/app/config.yaml
environment:
- CONFIG_PATH=/app/config.yaml
networks:
- backend
- mesh
depends_on:
- redis-1
- redis-2
- redis-3
ai-core:
build:
context: ./services/ai-core
dockerfile: Dockerfile
ports:
- "8081:8081"
volumes:
- ./services/ai-core/config.yaml:/app/config.yaml
- ai_models:/app/models
environment:
- CONFIG_PATH=/app/config.yaml
networks:
- backend
depends_on:
- redis-1
- redis-2
- redis-3
storage:
build:
context: ./services/storage
dockerfile: Dockerfile
ports:
- "8082:8082"
volumes:
- ./services/storage/config.yaml:/app/config.yaml
- storage_data:/app/storage
environment:
- CONFIG_PATH=/app/config.yaml
- STORAGE_DB_PASSWORD=${POSTGRES_PASSWORD}
- REDIS_PASSWORD=${REDIS_PASSWORD}
- JWT_SECRET=${JWT_SECRET}
networks:
- backend
depends_on:
- postgres-master
- redis-1
- redis-2
- redis-3
# Synapse (existing backend)
synapse:
build:
context: ./backend/synapse
dockerfile: Dockerfile
ports:
- "8008:8008"
volumes:
- synapse_data:/data
- ./backend/synapse/homeserver.yaml:/data/homeserver.yaml
environment:
- SYNAPSE_CONFIG_PATH=/data/homeserver.yaml
networks:
- backend
depends_on:
- postgres-master
volumes:
postgres_master_data:
postgres_slave_data:
redis_1_data:
redis_2_data:
redis_3_data:
prometheus_data:
grafana_data:
ai_models:
storage_data:
synapse_data:
networks:
backend:
driver: bridge
mesh:
driver: bridge