-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
60 lines (55 loc) · 1.83 KB
/
entrypoint.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
#!/bin/sh
if [ "$CERT_FILE" == "" ]; then
if [ "$CERT_HOST" == "" ]; then
CERT_HOST="localhost"
fi
SUBJECT="/O=Global Security/CN=$CERT_HOST"
export CERT_FILE=/usr/local/openresty/cert-gateway.crt
export CERT_KEY=/usr/local/openresty/cert-gateway.key
echo "Running openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $CERT_KEY -out $CERT_FILE -subj \"$SUBJECT\""
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout $CERT_KEY -out $CERT_FILE -subj "$SUBJECT"
echo "Using generated self-signed certificates"
else
echo "Using pre-defined certificates"
fi
export ERROR_LEVEL=${ERROR_LEVEL:-warn}
export WORKER_CONNECTIONS=${WARNING_CONNECTIONS:-16384}
export KIBANA_HOST=${KIBANA_HOST:-127.0.0.1}
export KIBANA_PORT=${KIBANA_PORT:-5601}
export GRAFANA_HOST=${GRAFANA_HOST:-127.0.0.1}
export GRAFANA_PORT=${GRAFANA_PORT:-3000}
export VISUALIZER_HOST=${VISUALIZER_HOST:-127.0.0.1}
export VISUALIZER_PORT=${VISUALIZER_PORT:-8080}
export QIX_SESSION_HOST=${QIX_SESSION_HOST:-qix-session}
export QIX_SESSION_PORT=${QIX_SESSION_PORT:-9455}
export AUTH_HOST=${AUTH_HOST:-auth}
export AUTH_PORT=${AUTH_PORT:-3000}
echo "Waiting for Kibana..."
./wait-for.sh $KIBANA_HOST:$KIBANA_PORT
echo "Waiting for Grafana..."
./wait-for.sh $GRAFANA_HOST:$GRAFANA_PORT
echo "Waiting for Visualizer..."
./wait-for.sh $VISUALIZER_HOST:$VISUALIZER_PORT
echo "Waiting for QIX Session Service..."
./wait-for.sh $QIX_SESSION_HOST:$QIX_SESSION_PORT
echo "Waiting for Authentication Service..."
./wait-for.sh $AUTH_HOST:$AUTH_PORT
envsubst '\
$ERROR_LEVEL \
$WORKER_CONNECTIONS \
$KIBANA_HOST \
$KIBANA_PORT \
$GRAFANA_HOST \
$GRAFANA_PORT \
$VISUALIZER_HOST \
$VISUALIZER_PORT \
$QIX_SESSION_HOST \
$QIX_SESSION_PORT \
$AUTH_HOST \
$AUTH_PORT \
$CERT_FILE \
$CERT_KEY \
' \
< nginx.conf.template \
> nginx.conf
../bin/openresty -g "daemon off;" -c nginx.conf