-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
executable file
·306 lines (287 loc) · 7.87 KB
/
docker-compose.yml
File metadata and controls
executable file
·306 lines (287 loc) · 7.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
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
version: '3.4'
services:
proxy:
image: nginx:1.21.0-alpine
container_name: proxy
volumes:
- .config/proxy/default.conf:/etc/nginx/templates/default.conf.template
ports:
- $PROXY_PORT:80
depends_on:
- swagger
- auth-keycloak-acl
- employee-service
- time-record-service
- timecard-service
networks:
- timeclock
swagger:
build:
context: .
dockerfile: Dockerfile
command: go run main.go
ports:
- $SWAGGER_PORT:8080
volumes:
- ./swagger:/go/src/
networks:
- timeclock
auth-keycloak-acl:
build:
context: .
dockerfile: Dockerfile
command: go run main.go all
environment:
ENV: dev
ELASTIC_APM_SERVICE_NAME: auth-keycloak-acl
ports:
- $AUTH_GRPC_PORT:50051
- $AUTH_REST_PORT:8080
volumes:
# - service/auth-keycloak-acl:/go/src/
- ../auth-keycloak-acl:/go/src/
depends_on:
- keycloak
- kafka
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
employee-service:
build:
context: .
dockerfile: Dockerfile
command: go run main.go all
environment:
ENV: dev
ELASTIC_APM_SERVICE_NAME: employee-service
ports:
- $EMPLOYEE_GRPC_PORT:50051
- $EMPLOYEE_REST_PORT:8080
volumes:
# - service/employee-service:/go/src/
- ../employee-service:/go/src/
depends_on:
- postgres
- kafka
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
time-record-service:
build:
context: .
dockerfile: Dockerfile
command: go run main.go all
environment:
ENV: dev
ELASTIC_APM_SERVICE_NAME: time-record-service
ports:
- $TIME_RECORD_GRPC_PORT:50051
- $TIME_RECORD_REST_PORT:8080
volumes:
# - service/time-record-service:/go/src/
- ../time-record-service:/go/src/
depends_on:
- postgres
- kafka
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
company-service:
build:
context: .
dockerfile: Dockerfile
command: go run main.go all
environment:
ENV: dev
ELASTIC_APM_SERVICE_NAME: company-service
ports:
- $COMPANY_GRPC_PORT:50051
- $COMPANY_REST_PORT:8080
volumes:
# - service/company-service:/go/src/
- ../company-service:/go/src/
depends_on:
- postgres
- kafka
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
timecard-service:
build:
context: .
dockerfile: Dockerfile
command: go run main.go all
environment:
ENV: dev
ELASTIC_APM_SERVICE_NAME: timecard-service
ports:
- $TIMECARD_GRPC_PORT:50051
- $TIMECARD_REST_PORT:8080
volumes:
# - service/timecard-service:/go/src/
- ../timecard-service:/go/src/
depends_on:
- postgres
- kafka
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
keycloak:
image: quay.io/keycloak/keycloak:latest
environment:
DB_VENDOR: POSTGRES
DB_ADDR: postgres
DB_DATABASE: $KEYCLOAK_DB
DB_USER: $POSTGRES_USER
DB_SCHEMA: public
DB_PASSWORD: $POSTGRES_PASSWORD
KEYCLOAK_USER: $KEYCLOAK_USERNAME
KEYCLOAK_PASSWORD: $KEYCLOAK_PASSWORD
# Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
# JDBC_PARAMS: "ssl=true"
ports:
- 8080:8080
depends_on:
- postgres
networks:
- timeclock
postgres:
image: postgres:9.4
restart: always
tty: true
environment:
POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_USER: $POSTGRES_USER
POSTGRES_MULTIPLE_DATABASES: $POSTGRES_DBS
volumes:
- .config/db:/docker-entrypoint-initdb.d
- pgdata:/var/lib/postgresql/data
ports:
- $DB_PORT:5432
networks:
- timeclock
adminer:
image: adminer
restart: always
ports:
- 9000:8080
networks:
- timeclock
apm-server:
image: docker.elastic.co/apm/apm-server:7.12.1
depends_on:
- elasticsearch
- kibana
cap_add: ['CHOWN', 'DAC_OVERRIDE', 'SETGID', 'SETUID']
cap_drop: ['ALL']
ports:
- 8200:8200
networks:
- timeclock
environment:
- .config/elastic/apm-server.yml:/usr/share/apm-server/apm-server.yml
healthcheck:
interval: 10s
retries: 12
test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:8200/
kibana:
image: 'docker.elastic.co/kibana/kibana:7.12.1'
ports:
- 5601:5601
volumes:
- .config/elastic/kibana.yml:/usr/share/kibana/config/kibana.yml
depends_on:
- elasticsearch
networks:
- timeclock
healthcheck:
interval: 10s
retries: 20
test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:5601/api/status
elasticsearch:
image: 'docker.elastic.co/elasticsearch/elasticsearch:7.12.1'
ports:
- 9200:9200
volumes:
- .config/elastic/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- esdata:/usr/share/elasticsearch/data
environment:
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m' ## setting jvm heap memory limits, based on the type of nodes (master, data, etc.), you can tweak this to optimize resource usage vs. performance
- node.name=es-master ## node name needs to be unique, so setting it in env vars
ulimits:
memlock:
soft: -1
hard: -1
networks:
- timeclock
healthcheck:
interval: 20s
retries: 10
test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"'
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
networks:
- timeclock
kafka:
image: confluentinc/cp-kafka:latest
depends_on:
- zookeeper
ports:
- 9092:9092
- 9094:9094
environment:
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_LISTENERS: INTERNAL://:9092,OUTSIDE://:9094
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,OUTSIDE://host.docker.internal:9094
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
networks:
- timeclock
extra_hosts:
- 'host.docker.internal:172.17.0.1'
kafka-topics-generator:
image: confluentinc/cp-kafka:latest
depends_on:
- kafka
command: >
bash -c
"sleep 5s &&
kafka-topics --create --topic=NEW_EMPLOYEE --if-not-exists --bootstrap-server=kafka:9092 &&
kafka-topics --create --topic=UPDATE_EMPLOYEE --if-not-exists --bootstrap-server=kafka:9092 &&
kafka-topics --create --topic=NEW_USER --if-not-exists --bootstrap-server=kafka:9092 &&
kafka-topics --create --topic=NEW_COMPANY --if-not-exists --bootstrap-server=kafka:9092 &&
kafka-topics --create --topic=ADD_EMPLOYEE_TO_COMPANY --if-not-exists --bootstrap-server=kafka:9092 &&
kafka-topics --create --topic=NEW_TIME_RECORD --if-not-exists --bootstrap-server=kafka:9092
"
networks:
- timeclock
control-center:
image: confluentinc/cp-enterprise-control-center:6.0.1
hostname: control-center
depends_on:
- kafka
ports:
- 9021:9021
environment:
CONTROL_CENTER_BOOTSTRAP_SERVERS: kafka:9092
CONTROL_CENTER_REPLICATION_FACTOR: 1
PORT: 9021
networks:
- timeclock
volumes:
esdata:
driver: local
pgdata:
driver: local
networks:
timeclock:
driver: bridge