-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
180 lines (170 loc) · 6.54 KB
/
Copy pathdocker-compose.yaml
File metadata and controls
180 lines (170 loc) · 6.54 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
services:
order-service:
build:
context: ./order-service
dockerfile: Dockerfile
ports:
- "8081:8081"
environment:
SERVER_PORT: 8081
DB_URL: jdbc:postgresql://order-db:5432/order_db
DB_USERNAME: test
DB_PASSWORD: test
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
STORAGE_SERVICE_BASE_URL: http://storage-service:8082
STORAGE_GRPC_HOST: storage-service
STORAGE_GRPC_PORT: 9090
STORAGE_GRPC_TIMEOUT_MS: 2000
KEYCLOAK_ISSUER_URI: http://localhost:8180/realms/erofivan
KEYCLOAK_JWK_SET_URI: http://keycloak:8080/realms/erofivan/protocol/openid-connect/certs
depends_on:
order-db:
condition: service_healthy
kafka:
condition: service_healthy
otel-collector:
condition: service_started
storage-service:
build:
context: ./storage-service
dockerfile: Dockerfile
ports:
- "8082:8082"
environment:
SERVER_PORT: 8082
GRPC_SERVER_PORT: 9090
DB_URL: jdbc:postgresql://storage-db:5432/storage_db
DB_USERNAME: test
DB_PASSWORD: test
KAFKA_BOOTSTRAP_SERVERS: kafka:9092
OTEL_EXPORTER_OTLP_ENDPOINT: http://otel-collector:4318
KEYCLOAK_ISSUER_URI: http://localhost:8180/realms/erofivan
KEYCLOAK_JWK_SET_URI: http://keycloak:8080/realms/erofivan/protocol/openid-connect/certs
depends_on:
storage-db:
condition: service_healthy
kafka:
condition: service_healthy
otel-collector:
condition: service_started
order-db:
image: postgres:16
environment:
POSTGRES_DB: order_db
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U test -d order_db" ]
interval: 5s
timeout: 5s
retries: 5
storage-db:
image: postgres:16
environment:
POSTGRES_DB: storage_db
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U test -d storage_db" ]
interval: 5s
timeout: 5s
retries: 5
kafka:
image: apache/kafka:3.9.0
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,CONTROLLER://kafka:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
healthcheck:
test: [ "CMD-SHELL", "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092" ]
interval: 10s
timeout: 10s
retries: 5
keycloak:
build:
context: ./keycloak
dockerfile: Dockerfile
command: start-dev --import-realm
ports:
- "8180:8080"
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: ${KC_BOOTSTRAP_ADMIN_USERNAME}
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KC_BOOTSTRAP_ADMIN_PASSWORD}
healthcheck:
test: [ "CMD-SHELL", "bash -lc \"exec 3<>/dev/tcp/127.0.0.1/8080; printf 'GET /realms/master/.well-known/openid-configuration HTTP/1.1\\r\\nHost: localhost\\r\\nConnection: close\\r\\n\\r\\n' >&3; grep -q '200' <&3\"" ]
interval: 10s
timeout: 5s
retries: 15
start_period: 30s
keycloak-init:
image: quay.io/keycloak/keycloak:26.0
entrypoint: [ "/bin/sh", "-c" ]
depends_on:
keycloak:
condition: service_healthy
restart: "no"
environment:
KC_BOOTSTRAP_ADMIN_USERNAME: ${KC_BOOTSTRAP_ADMIN_USERNAME}
KC_BOOTSTRAP_ADMIN_PASSWORD: ${KC_BOOTSTRAP_ADMIN_PASSWORD}
command:
- |
set -e
until /opt/keycloak/bin/kcadm.sh config credentials --server http://keycloak:8080 --realm master --user "$KC_BOOTSTRAP_ADMIN_USERNAME" --password "$KC_BOOTSTRAP_ADMIN_PASSWORD"; do
sleep 2
done
/opt/keycloak/bin/kcadm.sh update realms/master --server http://keycloak:8080 -s sslRequired=NONE
/opt/keycloak/bin/kcadm.sh get realms/master --server http://keycloak:8080 | grep -E '"realm"|"sslRequired"'
otel-collector:
image: otel/opentelemetry-collector-contrib:0.126.0
command: [ "--config=/etc/otelcol-contrib/config.yaml" ]
volumes:
- ./observability/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml:ro
ports:
- "4317:4317"
- "4318:4318"
- "8889:8889"
depends_on:
tempo:
condition: service_started
tempo:
image: grafana/tempo:2.7.2
command: [ "-config.file=/etc/tempo.yaml" ]
volumes:
- ./observability/tempo-config.yaml:/etc/tempo.yaml:ro
ports:
- "3200:3200"
prometheus:
image: prom/prometheus:v3.3.1
command:
- "--config.file=/etc/prometheus/prometheus.yml"
volumes:
- ./observability/prometheus.yml:/etc/prometheus/prometheus.yml:ro
ports:
- "9090:9090"
depends_on:
otel-collector:
condition: service_started
grafana:
image: grafana/grafana:12.0.1
ports:
- "3000:3000"
environment:
GF_AUTH_ANONYMOUS_ENABLED: "true"
GF_AUTH_ANONYMOUS_ORG_ROLE: Admin
volumes:
- ./observability/grafana/provisioning:/etc/grafana/provisioning:ro
depends_on:
tempo:
condition: service_started
prometheus:
condition: service_started