-
Notifications
You must be signed in to change notification settings - Fork 15
/
start-container.sh
executable file
·63 lines (57 loc) · 1.71 KB
/
start-container.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
#!/bin/bash
# Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
set -e
if [ $# -gt 1 ]; then
echo "Allowed arguments to entrypoint are {configserver,services}."
exit 1
fi
trap cleanup TERM INT
cleanup() {
/opt/vespa/bin/vespa-stop-services
exit $?
}
if [ -n "$1" ]; then
if [ -z "$VESPA_CONFIGSERVERS" ]; then
echo "VESPA_CONFIGSERVERS must be set with '-e VESPA_CONFIGSERVERS=<comma separated list of config servers>' argument to docker."
exit 1
fi
case $1 in
configserver)
cleanup() {
/opt/vespa/bin/vespa-stop-configserver
exit $?
}
/opt/vespa/bin/vespa-start-configserver
;;
services)
/opt/vespa/bin/vespa-start-services
;;
services,configserver | configserver,services)
cleanup() {
/opt/vespa/bin/vespa-stop-configserver
/opt/vespa/bin/vespa-stop-services
exit $?
}
/opt/vespa/bin/vespa-start-configserver
/opt/vespa/bin/vespa-start-services
;;
*)
echo 'Allowed arguments to entrypoint are "configserver", "services" or "configserver,services".'
exit 1
;;
esac
else
if [ -z "$VESPA_CONFIGSERVERS" ]; then
export VESPA_CONFIGSERVERS=$(hostname)
fi
/opt/vespa/bin/vespa-start-configserver
/opt/vespa/bin/vespa-start-services
fi
if [ "$VESPA_LOG_STDOUT" = "true" ]; then
FORMAT="${VESPA_LOG_FORMAT:-vespa}"
/opt/vespa/bin/vespa-logfmt --follow --format "$FORMAT" ${VESPA_LOGFMT_ARGUMENTS} &
wait
else
sleep infinity &
wait
fi