-
-
Notifications
You must be signed in to change notification settings - Fork 75
/
run-demo.sh
executable file
·57 lines (47 loc) · 1.71 KB
/
run-demo.sh
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
#!/bin/bash
docker rm -f $(docker ps -aq) > /dev/null 2>&1
docker-compose -f environment/docker-compose.yml pull
docker-compose -f environment/docker-compose.yml up -d zookeeper
zookeeperContainerId=`docker ps -f name=zookeeper | tail -n 1 | awk '{print $1}'`
# Waiting zookeeper is UP
echo "Waiting zookeper ..."
test=true
while test
do
ret=`echo ruok | docker exec -i ${zookeeperContainerId} nc localhost 2181 | awk '{print $1}'`
sleep 1
echo "Waiting zookeeper UP"
if $ret == 'imok'
then
test=false
fi
done
docker-compose -f environment/docker-compose.yml up -d broker
kafkaContainerId=`docker ps -f name=broker | tail -n 1 | awk '{print $1}'`
# Wait broker is UP
test=true
echo "Waiting kafka broker ..."
while test
do
ret=`echo dump | docker exec -i ${zookeeperContainerId} nc localhost 2181 | grep brokers | wc -l`
sleep 1
echo "Waiting kafka UP"
if $ret == 1
then
test=false
fi
done
docker-compose -f environment/docker-compose.yml up -d schema-registry akhq
docker exec -i ${kafkaContainerId} kafka-topics --bootstrap-server broker:29092 --topic input --create --partitions 4 --replication-factor 1 > /dev/null 2>&1
docker exec -i ${kafkaContainerId} kafka-topics --bootstrap-server broker:29092 --topic output --create --partitions 4 --replication-factor 1 > /dev/null 2>&1
echo "Topics created"
echo "List all topics ..."
docker exec -i ${kafkaContainerId} kafka-topics --bootstrap-server broker:29092 --list
echo "Restore, build and run demo sample"
dotnet dev-certs https
dotnet restore
dotnet build -f net6.0 --no-restore
if [ $# -gt 0 ]
then
dotnet run -f net6.0 --project launcher/sample-stream-demo/sample-stream-demo.csproj --no-build --no-restore
fi