-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yaml
184 lines (173 loc) · 4.24 KB
/
docker-compose.yaml
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
networks:
cassandra-net:
chat-system:
volumes:
cassandra_seed1_data:
cassandra_node1_data:
redis_data:
services:
cassandra-seed1:
image: cassandra:latest
container_name: cassandra-seed1
ports:
- "7000:7000" # JMX port
- "9042:9042" # CQL port
environment:
- CASSANDRA_CLUSTER_NAME=chat-app
- CASSANDRA_LISTEN_ADDRESS=auto
- CASSANDRA_BROADCAST_ADDRESS=cassandra-seed1
volumes:
- cassandra_seed1_data:/var/lib/cassandra
networks:
- cassandra-net
healthcheck:
test: ["CMD-SHELL", "cqlsh -e 'describe keyspaces'"]
interval: 30s
timeout: 10s
retries: 10
start_period: 40s
cassandra-node1:
image: cassandra:latest
container_name: cassandra-node1
ports:
- "9043:9042"
environment:
- CASSANDRA_CLUSTER_NAME=chat-app
- CASSANDRA_LISTEN_ADDRESS=auto
- CASSANDRA_SEEDS=cassandra-seed1
- CASSANDRA_BROADCAST_ADDRESS=cassandra-node1
volumes:
- cassandra_node1_data:/var/lib/cassandra
depends_on:
- cassandra-seed1
networks:
- cassandra-net
healthcheck:
test: ["CMD-SHELL", "cqlsh -e 'describe keyspaces'"]
interval: 30s
timeout: 10s
retries: 10
start_period: 40s
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
networks:
- chat-system
wait-for-it:
image: willwill/wait-for-it
container_name: wait-for-it
depends_on:
cassandra-node1:
condition: service_healthy
redis:
condition: service_healthy
command:
[
"cassandra-node1:9043",
"redis:6379",
"--",
"echo",
"All services are up and healthy",
]
networks:
- chat-system
- cassandra-net
chat-service:
image: cme/chat-service
build:
context: .
dockerfile: Dockerfile.dev
container_name: chat-service
working_dir: /app
ports:
- "8000:8000"
volumes:
- .:/app # Mount the source code directory into the container for hot reload
depends_on:
- wait-for-it
healthcheck:
test:
["CMD-SHELL", "curl -f http://localhost:8000/api/v1/health || exit 1"]
interval: 30s
timeout: 600s
retries: 20
start_period: 40s
labels:
logging: "promtail"
logging_jobname: "containerlogs"
networks:
- chat-system
- cassandra-net
nginx:
image: nginx:latest
container_name: nginx
ports:
- "80:80"
labels:
logging: "promtail"
logging_jobname: "containerlogs"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
chat-service:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost/api/v1/health || exit 1"]
interval: 30s
timeout: 600s
retries: 20
start_period: 40s
networks:
- chat-system
prometheus:
image: prom/prometheus
container_name: prometheus
volumes:
- ./infrastructure/config/prometheus.yaml:/etc/prometheus/prometheus.yaml
ports:
- "9090:9090"
networks:
- chat-system
grafana:
image: grafana/grafana
container_name: grafana
ports:
- "3000:3000"
environment:
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_AUTH_DISABLE_LOGIN_FORM=true
volumes:
- ./infrastructure/config/grafana-datasources.yaml:/etc/grafana/provisioning/datasources/datasources.yaml
networks:
- chat-system
loki:
image: grafana/loki
container_name: loki
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
networks:
- chat-system
promtail:
image: grafana/promtail
container_name: promtail
volumes:
- ./infrastructure/config/promtail.yaml:/etc/promtail/docker-config.yaml
- /var/lib/docker/containers:/var/lib/docker/containers:ro
- /var/run/docker.sock:/var/run/docker.sock
command: -config.file=/etc/promtail/docker-config.yaml
depends_on:
- loki
networks:
- chat-system