Blame root/usr/bin/run-grafana

eb27f08
#!/bin/bash -eu
d2799a1
d2799a1
. /etc/sysconfig/grafana-server
d2799a1
eb27f08
# setup permissions at the first start of the container with a volume mount
eb27f08
if [ ! -f "${DATA_DIR}/grafana.db" ]; then
eb27f08
  touch "${DATA_DIR}/grafana.db"
eb27f08
  chmod 640 "${DATA_DIR}/grafana.db"
eb27f08
fi
eb27f08
0f4ecff
if [ ! -d "${PLUGINS_DIR}" ]; then
0f4ecff
  mkdir "${PLUGINS_DIR}"
0f4ecff
fi
0f4ecff
0f4ecff
# only for upgrades: delete the old plugin directory inside the volume
0f4ecff
if [ -d "${PLUGINS_DIR}/grafana-pcp" ]; then
0f4ecff
  rm -rf "${PLUGINS_DIR}/grafana-pcp"
0f4ecff
fi
0f4ecff
if [ -d "${PLUGINS_DIR}/performancecopilot-pcp-app" ] && [ ! -L "${PLUGINS_DIR}/performancecopilot-pcp-app" ]; then
0f4ecff
  rm -rf "${PLUGINS_DIR}/performancecopilot-pcp-app"
0f4ecff
fi
0f4ecff
0f4ecff
# /var/lib/grafana is mounted as a volume to persist the grafana.db database and any additional installed plugins
0f4ecff
# let's place a symlink (in the volume) to the actual location of the grafana-pcp plugin (not in the volume)
0f4ecff
ln -sf /usr/share/performancecopilot-pcp-app "${PLUGINS_DIR}"
0f4ecff
d2799a1
exec /usr/sbin/grafana-server \
d2799a1
    --homepath="${GRAFANA_HOME}" \
d2799a1
    --config="${CONF_FILE}" \
d2799a1
    --packaging="docker" \
d2799a1
    cfg:default.log.mode="console" \
d2799a1
    cfg:default.paths.logs="${LOG_DIR}" \
d2799a1
    cfg:default.paths.data="${DATA_DIR}" \
d2799a1
    cfg:default.paths.plugins="${PLUGINS_DIR}" \
d2799a1
    cfg:default.paths.provisioning="${PROVISIONING_CFG_DIR}" \
d2799a1
    "$@"