From 3dbb32adb3cd497367de171a053020971f0e8788 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 3 Aug 2022 16:27:01 +1000 Subject: [PATCH] grafana: helper script updates Responding to comments from Ibbc2b116d0c496655a7ce6bb6971e8270ac32647 Make the script run in the grafana .yaml directory so you don't have working-directory issues. Put the secrets in this directory and add them to .gitignore No need for a tty on the loading call Additionally make it executable, and have a short pause to let the container start. Change-Id: Icf0a2cfb1a0f5599704d6c8c9e85345d61884cd5 --- .gitignore | 1 + grafana/run-grafana.sh | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 grafana/run-grafana.sh diff --git a/.gitignore b/.gitignore index 62edf4ed81..638d0d3b8d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ *.egg specs/html docs-site/html +grafana/grafana-secrets diff --git a/grafana/run-grafana.sh b/grafana/run-grafana.sh old mode 100644 new mode 100755 index 29a3b8cf29..ba83d336ff --- a/grafana/run-grafana.sh +++ b/grafana/run-grafana.sh @@ -1,8 +1,9 @@ #!/bin/bash DOCKER=docker -GRAFYAML_DIR=$(pwd) -SECRETS_DIR=$(pwd)/grafana-secrets +SCRIPT_PATH=$(readlink -f $0) +GRAFYAML_DIR=$(dirname $SCRIPT_PATH) +SECRETS_DIR=${GRAFYAML_DIR}/grafana-secrets if [ ! -d ${SECRETS_DIR} ]; then mkdir -p ${SECRETS_DIR} @@ -29,11 +30,14 @@ if [[ $(${DOCKER} ps -f "name=grafana-opendev_test" --format '{{.Names}}') \ docker.io/grafana/grafana-oss echo "Grafana listening on :3000" + echo "Waiting for startup ..." + sleep 5 + echo " ... done" fi echo "Reloading dashboards" -${DOCKER} run --rm -t --network=host \ +${DOCKER} run --rm --network=host \ -e 'GRAFANA_URL=http://admin:password@localhost:3000' \ -v ${GRAFYAML_DIR}:/grafana:ro \ opendevorg/grafyaml