-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yaml
145 lines (142 loc) · 4.18 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
version: "3"
services:
# Zookeper, needed for Kafka
zookeeper:
image: confluentinc/cp-zookeeper:latest
ports:
- '22181:2181'
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
# Kafka, needed for auth, chat, apache camel microservices and aggregated messages consumer
kafka:
image: confluentinc/cp-kafka:latest
depends_on:
- zookeeper
ports:
- '29092:29092'
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka:9092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
healthcheck:
test: kafka-topics --bootstrap-server kafka:9092 --list
interval: 30s
timeout: 10s
retries: 4
# Cassandra Database, needed for chat microservice
cassandra:
image: 'cassandra:4.0'
volumes:
- messaging_db_volume:/var/lib/cassandra
environment:
- CASSANDRA_CLUSTER_NAME=book
ports:
- '9042:9042'
# Postgres Authentication Database, needed for auth microservice
auth_db:
image: postgres
volumes:
- auth_db_volume:/var/lib/postgresql/data
environment:
POSTGRES_DB: auth_microservice
POSTGRES_USER: auth_microservice
POSTGRES_PASSWORD: auth_microservice
ports:
- '5433:5432'
healthcheck:
# The pg_isready command is a PostgreSQL utility used to check
# the status of a PostgreSQL server and determine if it is ready
# to accept connections. When used with the -U flag followed by a username
# as in pg_isready -U auth_microservice, it checks whether the PostgreSQL
# server is ready to accept connections for the specified user.
test: ["CMD-SHELL", "pg_isready -U auth_microservice"]
interval: 5s
timeout: 10s
retries: 5
# Aggregated messages consumer, needed for Firestore
consumer:
build:
context: aggregated-messages-consumer
dockerfile: ./Dockerfile
environment:
BOOSTRAP_SERVER: kafka:9092
CONTAINER_MODE: "1"
depends_on:
- kafka
# Auth microservice REST API, needed for UI clients
auth_microservice:
build:
context: auth-microservice
dockerfile: ./Dockerfile
environment:
PROJECT_NAME: AUTHENTICATION-MICROSERVICE
POSTGRES_HOST: auth_db
POSTGRES_PORT: 5432
POSTGRES_DB: auth_microservice
POSTGRES_USER: auth_microservice
POSTGRES_PASSWORD: auth_microservice
FIRST_USER_USERNAME: charlyjazz
FIRST_USER_PASSWORD: 123456789
SECRET_KEY: 12345689
ACCESS_TOKEN_EXPIRE_MINUTES: 300
ALGORITHM: HS256
ports:
- '8000:8000'
depends_on:
auth_db:
condition: service_healthy
# Chat microservice REST API, needed for UI clients and Firestore
chat_microservices:
build:
context: chat-microservice
dockerfile: ./Dockerfile
environment:
PROJECT_NAME: CHAT-MICROSERVICE
SECRET_KEY: 12345689
ACCESS_TOKEN_EXPIRE_MINUTES: 30
ALGORITHM: HS256
CASSANDRA_PORT: 9042
CQLENG_ALLOW_SCHEMA_MANAGEMENT: 1
CASSANDRA_KEYSPACE: chat_messages
CASSANDRA_PROTOCOL_VERSION: 4
CASSANDRA_CLUSTER_ADDRESS: cassandra
KAFKA_BOOTSTRAP_SERVER: kafka:9092
ports:
- '9000:9000'
depends_on:
kafka:
condition: service_healthy
# Apache Camel Server
apache_camel_microservices:
build:
context: apache-camel-service-bus
dockerfile: ./Dockerfile
environment:
camel.component.kafka.brokers: kafka:9092
depends_on:
kafka:
condition: service_healthy
# Front End Next JS
front_end_next_js:
build:
context: frontend-web
dockerfile: ./Dockerfile
depends_on:
kafka:
condition: service_healthy
ports:
- '3000:3000'
env_file: .env
volumes:
zookeeper_data:
driver: local
kafka_data:
driver: local
auth_db_volume:
driver: local
messaging_db_volume:
driver: local