-
Notifications
You must be signed in to change notification settings - Fork 44
/
docker-compose.yml
64 lines (64 loc) · 1.93 KB
/
docker-compose.yml
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
version: "3"
services:
zookeeper:
image: wurstmeister/zookeeper:3.4.6
container_name: kafka-nodejs-example-zookeeper
ports:
- 2181:2181
kafka:
image: wurstmeister/kafka:2.11-1.1.0
container_name: kafka-nodejs-example-kafka
depends_on:
- zookeeper
environment:
KAFKA_ADVERTISED_HOST_NAME: kafka
KAFKA_CREATE_TOPICS: sales-topic:1:1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
ports:
- 9092:9092
volumes:
- /var/run/docker.sock:/var/run/docker.sock
database:
image: postgres:10.4-alpine
container_name: kafka-nodejs-example-database
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- 8000:5432
volumes:
- ./services/database/schema.sql:/docker-entrypoint-initdb.d/1-schema.sql
- ./services/database/seed.sql:/docker-entrypoint-initdb.d/2-seed.sql
producer:
build: ./services/producer
container_name: kafka-nodejs-example-producer
command: sh -c "dockerize -wait tcp://zookeeper:2181 -wait tcp://kafka:9092 -wait tcp://database:5432 npm start"
depends_on:
- zookeeper
- kafka
- database
environment:
PGHOST: database
PGPORT: 5432
PGUSER: ${POSTGRES_USER}
PGDATABASE: ${POSTGRES_USER}
PGPASSWORD: ${POSTGRES_PASSWORD}
PRODUCER_PORT: ${PRODUCER_PORT}
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
ports:
- ${PRODUCER_PORT}:${PRODUCER_PORT}
consumer:
build: ./services/consumer
container_name: kafka-nodejs-example-consumer
command: sh -c "dockerize -wait tcp://zookeeper:2181 -wait tcp://kafka:9092 -wait tcp://database:5432 npm start"
depends_on:
- zookeeper
- kafka
- database
environment:
PGHOST: database
PGPORT: 5432
PGUSER: ${POSTGRES_USER}
PGDATABASE: ${POSTGRES_USER}
PGPASSWORD: ${POSTGRES_PASSWORD}
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181