-
-
Notifications
You must be signed in to change notification settings - Fork 556
/
docker-compose.yml
75 lines (72 loc) · 2.52 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
65
66
67
68
69
70
71
72
73
74
75
version: "3.8"
networks:
application_team:
driver: bridge
services:
# Start a consumer and producer node with ockam.
#
# Read kafka_ockam.dockerfile and run_ockam.sh to understand
# how the node is set up.
consumer:
build:
context: .
dockerfile: ../kafka_ockam.dockerfile
environment:
ENROLLMENT_TICKET: ${CONSUMER_ENROLLMENT_TICKET:-}
CONFLUENT_CLOUD_KAFKA_CLUSTER_API_KEY: ${CONFLUENT_CLOUD_KAFKA_CLUSTER_API_KEY:-}
CONFLUENT_CLOUD_KAFKA_CLUSTER_API_SECRET: ${CONFLUENT_CLOUD_KAFKA_CLUSTER_API_SECRET:-}
networks:
- application_team
command:
- -c
- (
sleep 10;
echo "";
echo "Messages sent from producers will appear shortly.";
echo "It may take a couple of minutes for the first message to appear.";
echo "=======================================================================";
echo "Press Ctrl+C to stop the container at any time, then execute "\
"'./run.sh cleanup' to remove all containers.";
echo "";
kafka-console-consumer.sh --topic demo --bootstrap-server 127.0.0.1:9092 --consumer.config kafka.config --max-messages 8;
if [ "$?" == "0" ]; then
echo "The example run was successful 🥳";
fi;
echo "Messages received successfully, please Ctrl+C to exit";
tail -f /dev/null;
)
producer:
build:
context: .
dockerfile: ../kafka_ockam.dockerfile
environment:
ENROLLMENT_TICKET: ${PRODUCER_ENROLLMENT_TICKET:-}
CONFLUENT_CLOUD_KAFKA_CLUSTER_API_KEY: ${CONFLUENT_CLOUD_KAFKA_CLUSTER_API_KEY:-}
CONFLUENT_CLOUD_KAFKA_CLUSTER_API_SECRET: ${CONFLUENT_CLOUD_KAFKA_CLUSTER_API_SECRET:-}
networks:
- application_team
command:
- -c
- (
MESSAGES=(
"Message - 🔥"
"Message - 🌟"
"Message - 🚀"
"Message - 🐷"
"Message - 🦁"
"Message - 🦊"
"Message - 🐰"
"Message - 🐮"
);
kafka-topics.sh --bootstrap-server 127.0.0.1:9092 --command-config kafka.config --create --topic demo;
sleep 10;
for n in {0..7}; do
sleep 2;
echo -n $${MESSAGES[n]} | kafka-console-producer.sh
--topic demo
--producer.config kafka.config
--bootstrap-server 127.0.0.1:9092
--producer-property request.timeout.ms=30000;
done;
tail -f /dev/null
)