-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker-start.sh
72 lines (59 loc) · 1.88 KB
/
docker-start.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
#!/bin/bash
set -euo pipefail
# How long to wait for cassandra on server startup
CASSANDRA_TIMEOUT=240
TIMECRYPT_TIMEOUT=240
export TIMECRYPT_CASSANDRA_HOST=${TIMECRYPT_CASSANDRA_HOST:=cassandra}
export TIMECRYPT_CASSANDRA_PORT=${TIMECRYPT_CASSANDRA_PORT:=9042}
export TIMECRYPT_HOST=${TIMECRYPT_HOST:=timecrypt-server}
export TIMECRYPT_PORT=${TIMECRYPT_PORT:=15000}
export TIMECRYPT_KEYSTORE_PASSWORD=${TIMECRYPT_KEYSTORE_PASSWORD:=asdfghjklasdfghjkl}
ACTION="${1:-}"
case "$ACTION" in
server)
# Wait for Cassandra to be available
echo "Starting server - waiting for cassandra"
wait-for-it -t $CASSANDRA_TIMEOUT $TIMECRYPT_CASSANDRA_HOST:$TIMECRYPT_CASSANDRA_PORT
echo "Cassandra up"
java -jar $SERVER_JAR_NAME
;;
bash)
/bin/bash
;;
producer)
echo "Starting producer - waiting for server"
wait-for-it -t $TIMECRYPT_TIMEOUT $TIMECRYPT_HOST:$TIMECRYPT_PORT
echo "Server up"
java -jar $TESTBED_JAR_NAME --verbose "${@:2}"
;;
example1)
echo "Starting example 1 - waiting for server"
wait-for-it -t $TIMECRYPT_TIMEOUT $TIMECRYPT_HOST:$TIMECRYPT_PORT
echo "Server up"
java -jar $EXAMPLE1_JAR_NAME
;;
client)
echo "Starting client - waiting for server"
wait-for-it -t $TIMECRYPT_TIMEOUT $TIMECRYPT_HOST:$TIMECRYPT_PORT
echo "Server up"
java -jar $CLIENT_JAR_NAME "${@:2}"
;;
benchclient)
echo "Starting client - waiting for server"
wait-for-it -t $TIMECRYPT_TIMEOUT $TIMECRYPT_HOST:$TIMECRYPT_PORT
echo "Server up"
java -jar $BENCH_JAR_NAME "${@:2}"
;;
*)
echo "Action '$ACTION' undefined."
echo ""
echo "Usage: $0 <server|client|bash>"
echo ""
echo "server start the TimeCrypt server"
echo "client start a timecrypt client"
echo "producer start a producer (timecrypt testbed)"
echo "bash starts a bash session"
echo ""
exit 1
esac
exit 0