-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
69 lines (66 loc) · 2.17 KB
/
docker-compose.yml
File metadata and controls
69 lines (66 loc) · 2.17 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
services:
main-db:
image: postgres:16.1
container_name: ewm_main_db
environment:
POSTGRES_DB: main
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- "6542:5432"
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U user -d main" ]
interval: 10s
timeout: 5s
retries: 5
main-db-init:
image: postgres:16.1
container_name: main-db-init
depends_on:
main-db:
condition: service_healthy
environment:
PGPASSWORD: password
entrypoint:
- bash
- -c
- |
set -e
psql -h main-db -p 5432 -U user -d main -v ON_ERROR_STOP=1 <<-EOSQL
CREATE DATABASE ewm_event_db;
CREATE DATABASE ewm_request_db;
CREATE DATABASE ewm_user_db;
CREATE DATABASE ewm_comment_db;
CREATE DATABASE ewm_ratings_db;
EOSQL
echo "Databases created successfully!"
kafka:
image: confluentinc/confluent-local:7.4.3
hostname: kafka
container_name: kafka-ewm
ports:
- "9092:9092" # for client connections
- "9101:9101" # JMX
restart: unless-stopped
environment:
KAFKA_NODE_ID: 1
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092'
KAFKA_JMX_PORT: 9101
KAFKA_JMX_HOSTNAME: localhost
KAFKA_PROCESS_ROLES: 'broker,controller'
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093'
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092'
CLUSTER_ID: 'K0EA9p0yEe6MkAAAAkKsEg'
kafka-init-topics-graduation:
image: confluentinc/confluent-local:7.4.3
container_name: kafka-init-topics-graduation
depends_on:
- kafka
command: "bash -c \
'kafka-topics --create --topic stats.user-actions.v1 \
--partitions 1 --replication-factor 1 --if-not-exists \
--bootstrap-server kafka:29092 && \
kafka-topics --create --topic stats.events-similarity.v1 \
--partitions 1 --replication-factor 1 --if-not-exists \
--bootstrap-server kafka:29092'"
init: true