-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_local.sh
executable file
·24 lines (21 loc) · 1.01 KB
/
start_local.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
#!/bin/bash
set -e
function is_kafka_ready() {
if [[ -z "$(curl -s http://localhost:8081/subjects)" ]]; then
# no output - Kafka is not ready yet
return 1
else
# Kafka responds!
printf "Creating Kafka registry schemas\n"
curl -d '{"schema":"{\"name\":\"openslava\",\"type\":\"record\",\"fields\":[{\"name\":\"mentorName\",\"type\":\"string\"},{\"name\":\"attendeeName\",\"type\":\"string\"}]}"}' -H "Content-Type: application/vnd.schemaregistry.v1+json" -X POST http://localhost:8081/subjects/openslava-value/versions
printf "\n"
curl -d '{"schema":"{\"name\":\"openslava\",\"type\":\"record\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"}]}"}' -H "Content-Type: application/vnd.schemaregistry.v1+json" -X POST http://localhost:8081/subjects/openslava-value/versions
printf "\n"
return 0
fi
}
docker-compose down; docker-compose up -d --build
while ! is_kafka_ready; do
printf "Waiting for Kafka Schema Registry..\n"
sleep 1
done