forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·77 lines (65 loc) · 2.16 KB
/
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
73
74
75
76
77
#!/bin/bash
# Add default URI (http) scheme if needed
if ! echo $NEO4J_HOST | grep -q "://" ; then
NEO4J_HOST="http://$NEO4J_HOST"
fi
if [[ ! -z $ELASTICSEARCH_USERNAME ]] && [[ -z $ELASTICSEARCH_AUTH_HEADER ]]; then
AUTH_TOKEN=$(echo -ne "$ELASTICSEARCH_USERNAME:$ELASTICSEARCH_PASSWORD" | base64 --wrap 0)
ELASTICSEARCH_AUTH_HEADER="Authorization:Basic $AUTH_TOKEN"
fi
# Add default header if needed
if [[ -z $ELASTICSEARCH_AUTH_HEADER ]]; then
ELASTICSEARCH_AUTH_HEADER="Accept: */*"
fi
if [[ $ELASTICSEARCH_USE_SSL == true ]]; then
ELASTICSEARCH_PROTOCOL=https
else
ELASTICSEARCH_PROTOCOL=http
fi
WAIT_FOR_EBEAN=""
if [[ $SKIP_EBEAN_CHECK != true ]]; then
if [[ $ENTITY_SERVICE_IMPL == ebean ]] || [[ -z $ENTITY_SERVICE_IMPL ]]; then
WAIT_FOR_EBEAN=" -wait tcp://$EBEAN_DATASOURCE_HOST "
fi
fi
WAIT_FOR_CASSANDRA=""
if [[ $ENTITY_SERVICE_IMPL == cassandra ]] && [[ $SKIP_CASSANDRA_CHECK != true ]]; then
WAIT_FOR_CASSANDRA=" -wait tcp://$CASSANDRA_DATASOURCE_HOST "
fi
WAIT_FOR_KAFKA=""
if [[ $SKIP_KAFKA_CHECK != true ]]; then
WAIT_FOR_KAFKA=" -wait tcp://$(echo $KAFKA_BOOTSTRAP_SERVER | sed 's/,/ -wait tcp:\/\//g') "
fi
WAIT_FOR_NEO4J=""
if [[ $GRAPH_SERVICE_IMPL != elasticsearch ]] && [[ $SKIP_NEO4J_CHECK != true ]]; then
WAIT_FOR_NEO4J=" -wait $NEO4J_HOST "
fi
OTEL_AGENT=""
if [[ $ENABLE_OTEL == true ]]; then
OTEL_AGENT="-javaagent:opentelemetry-javaagent.jar "
fi
PROMETHEUS_AGENT=""
if [[ $ENABLE_PROMETHEUS == true ]]; then
PROMETHEUS_AGENT="-javaagent:jmx_prometheus_javaagent.jar=4318:/datahub/datahub-gms/scripts/prometheus-config.yaml "
fi
COMMON="
$WAIT_FOR_EBEAN \
$WAIT_FOR_CASSANDRA \
$WAIT_FOR_KAFKA \
$WAIT_FOR_NEO4J \
-timeout 240s \
java $JAVA_OPTS $JMX_OPTS \
$OTEL_AGENT \
$PROMETHEUS_AGENT \
-jar /jetty-runner.jar \
--jar jetty-util.jar \
--jar jetty-jmx.jar \
--config /datahub/datahub-gms/scripts/jetty.xml \
/datahub/datahub-gms/bin/war.war"
if [[ $SKIP_ELASTICSEARCH_CHECK != true ]]; then
exec dockerize \
-wait $ELASTICSEARCH_PROTOCOL://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT -wait-http-header "$ELASTICSEARCH_AUTH_HEADER" \
$COMMON
else
exec dockerize $COMMON
fi