-
Notifications
You must be signed in to change notification settings - Fork 4
/
run.sh
executable file
·60 lines (44 loc) · 2.09 KB
/
run.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
58
59
60
#! /usr/bin/env bash
docker-compose up -d
# wait for a container to be healthy
MAX_HEALTH_CHECK_TRIES=20
wait_for_pulsar(){
for (( i=1 ; i <= MAX_HEALTH_CHECK_TRIES; i++ )); do
RESULT=$(curl -f http://localhost:8080/admin/namespaces/public)
if [[ ${RESULT} == *"public"* ]]; then
echo -e "$1 is healthy!\n"
break
else
echo "$1 not healthy. Trying $i of ${MAX_HEALTH_CHECK_TRIES}. Sleeping 5 seconds."
if [[ "$i" != "${MAX_HEALTH_CHECK_TRIES}" ]]; then
sleep 5
fi
fi
if [[ "$i" == "${MAX_HEALTH_CHECK_TRIES}" ]]; then
echo -e "ERROR: $1 not healthy. Aborting"
exit 1
fi
done
}
wait_for_pulsar
echo "Creating the public/neutron namespace"
docker-compose exec -T pulsar bin/pulsar-admin namespaces create public/neutron
echo "Setting BACKWARD schema compatibility strategy for the public/neutron namespace"
docker-compose exec -T pulsar bin/pulsar-admin namespaces set-schema-compatibility-strategy -c BACKWARD public/neutron
echo "Creating the public/nope namespace"
docker-compose exec -T pulsar bin/pulsar-admin namespaces create public/nope
echo "Setting ALWAYS_INCOMPATIBLE schema compatibility strategy for the public/nope namespace"
docker-compose exec -T pulsar bin/pulsar-admin namespaces set-schema-compatibility-strategy -c ALWAYS_INCOMPATIBLE public/nope
echo "Creating 'dedup' topic"
docker-compose exec -T pulsar bin/pulsar-admin topics create persistent://public/default/dedup
echo "Enabling deduplication on 'dedup' topic"
docker-compose exec -T pulsar bin/pulsar-admin topics enable-deduplication dedup
#echo "Running deduplication checks"
#docker-compose exec -T pulsar bin/pulsar-admin topics get-deduplication persistent://public/default/dedup
#echo "standalone.conf values"
#docker-compose exec -T pulsar cat conf/standalone.conf | grep 'topicLevelPolicies'
#docker-compose exec -T pulsar cat conf/standalone.conf | grep 'systemTopic'
#echo "broker.conf values"
#docker-compose exec -T pulsar cat conf/broker.conf | grep 'topicLevelPolicies'
#docker-compose exec -T pulsar cat conf/broker.conf | grep 'systemTopic'
echo "Done"