This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 292
/
nakadi.sh
executable file
·88 lines (80 loc) · 1.76 KB
/
nakadi.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/usr/bin/env bash
function waitForNakadi() {
echo "Waiting for Nakadi to start up"
x=1
while [[ x -lt 10 ]]; do
res=$(curl -s -w "%{http_code}" -o /dev/null http://localhost:8080/health)
if ((res == 200)); then
echo "Nakadi is fully started"
return
fi
echo "Nakadi boots up"
sleep 10
x=$((x + 1))
done
}
function startNakadi() {
export SPRING_PROFILES_ACTIVE=local
docker-compose up -d --build
waitForNakadi
}
function stopNakadi() {
docker-compose down
}
function startStorages() {
docker-compose up -d postgres zookeeper kafka
}
function acceptanceTests() {
export SPRING_PROFILES_ACTIVE=acceptanceTest
docker-compose up -d --build
waitForNakadi
if ./gradlew :acceptance-test:acceptanceTest
then
errcode=0
else
errcode=1
docker-compose logs nakadi
fi
docker-compose down
return $errcode
}
function buildNakadi() {
set -e
./gradlew clean
./gradlew :app:bootJar
set +e
}
function help() {
echo "Usage: ./nakadi.sh COMMAND"
echo ""
echo "Commands:"
echo " start-nakadi build Nakadi and start docker-compose services: nakadi, postgresql, zookeeper and kafka"
echo " stop-nakadi shutdown docker-compose services"
echo " start-storages start docker-compose services: postgres, zookeeper and kafka (useful for development purposes)"
echo " stop-storages shutdown docker-compose services"
echo " acceptance-tests start Nakadi configured for acceptance tests and run acceptance tests"
exit 1
}
COMMAND="${1}"
case $COMMAND in
start-nakadi)
buildNakadi
startNakadi
;;
stop-nakadi)
stopNakadi
;;
start-storages)
startStorages
;;
stop-storages)
stopStorages
;;
acceptance-tests)
buildNakadi
acceptanceTests
;;
*)
help
;;
esac