
This image is moving to quay.io now that the grafana service is running on top of Ubuntu Noble and podman. Fetch it from the new location once the image location moves via the depends-on. Depends-On: https://review.opendev.org/c/opendev/grafyaml/+/956839 Change-Id: I5336666bf15a098414d4e6089a5f7cd6fb476324
50 lines
1.5 KiB
Bash
Executable File
50 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
DOCKER=docker
|
|
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}
|
|
echo "password" > ${SECRETS_DIR}/admin_password
|
|
echo "admin" > ${SECRETS_DIR}/admin_user
|
|
echo "key" > ${SECRETS_DIR}/secret_key
|
|
|
|
fi
|
|
|
|
if [[ $(${DOCKER} ps -f "name=grafana-opendev_test" --format '{{.Names}}') \
|
|
!= 'grafana-opendev_test' ]]; then
|
|
|
|
echo "Running Grafana"
|
|
|
|
${DOCKER} run -d --rm \
|
|
--name grafana-opendev_test \
|
|
-p 3000:3000 \
|
|
-v ${SECRETS_DIR}:/etc/grafana/secrets \
|
|
-e GF_AUTH_ANONYMOUS_ENABLED=true \
|
|
-e GF_USER_ALLOW_SIGN_UP=false \
|
|
-e GF_SECURITY_ADMIN_PASSWORD__FILE=/etc/grafana/secrets/admin_password \
|
|
-e GF_SECURITY_ADMIN_USER__FILE=/etc/grafana/secrets/admin_user \
|
|
-e GF_SECURITY_SECRET_KEY__FILE=/etc/grafana/secrets/secret_key \
|
|
docker.io/grafana/grafana-oss
|
|
|
|
echo "Grafana listening on :3000"
|
|
echo -n "Waiting for startup ."
|
|
until $(curl --output /dev/null --silent --head --fail http://localhost:3000); do
|
|
echo -n '.'
|
|
sleep 2
|
|
done
|
|
echo ". done"
|
|
fi
|
|
|
|
echo "Pulling grafyaml"
|
|
${DOCKER} pull quay.io/opendevorg/grafyaml
|
|
|
|
echo "Reloading dashboards"
|
|
|
|
${DOCKER} run --rm --network=host \
|
|
-e 'GRAFANA_URL=http://admin:password@localhost:3000' \
|
|
-v ${GRAFYAML_DIR}:/grafana:ro \
|
|
quay.io/opendevorg/grafyaml
|