generated from thedatasociety/binderhub-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
start.grafana
28 lines (20 loc) · 910 Bytes
/
start.grafana
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
#!/bin/bash
cd ${GRAFANA_HOME}
export PROXY_SUBURL=proxy/3000
export GF_SECURITY_ADMIN_PASSWORD=admin
if [ -z ${JUPYTERHUB_SERVICE_PREFIX+x} ]; then
echo "JUPYTERHUB_SERVICE_PREFIX is unset";
# Since I am not in a binderhub, is the JUPYTER_SERVER_URL set? If yes, I can launch grafana. Otherwise, do nothing
if [ -z ${JUPYTER_SERVER_URL+x} ]; then
echo "JUPYTER_SERVER_URL is unset. Nothing else to do";
else
echo "JUPYTER_SERVER_URL is set to '$JUPYTER_SERVER_URL'";
export GF_SERVER_ROOT_URL="${JUPYTER_SERVER_URL}${PROXY_SUBURL}"
nohup grafana-server &> ~/logs/grafana-$GRAFANA_VERSION.log &
fi
# Yes, I have the JUPYTERHUB_SERVICE_PREFIX
else
echo "JUPYTERHUB_SERVICE_PREFIX is set to '$JUPYTERHUB_SERVICE_PREFIX'";
export GF_SERVER_ROOT_URL="${JUPYTERHUB_SERVICE_PREFIX}${PROXY_SUBURL}"
nohup grafana-server &> ~/logs/grafana-$GRAFANA_VERSION.log &
fi