forked from johnnyw-aws/aws-iot-twinmaker-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_local_grafana_docker.sh
executable file
·30 lines (23 loc) · 1.14 KB
/
setup_local_grafana_docker.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
#!/bin/bash
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
SCRIPT_DIR=${HOME}
CONTAINER_NAME=cookiefactory-grafana
# Make a directory to persist the data from our local running instance of grafana.
# Mapping this directory into the grafana container allows your work in the grafana
# container to be saved between run. Most notibly will be a grafana.db file which will
# contain your configured dashboards. This directory will be ignored by git becuase of
# the .gitignore file we have placed in parent directory.
mkdir -p ${SCRIPT_DIR}/local_grafana_data/plugins
# Overwrite the grafana plugin with the latest code
rm -rf ${SCRIPT_DIR}/local_grafana_data/plugins/grafana-iot-twinmaker-app
# Remove a container if it exists. Using a volume to persist data so the new container
# will have the same configuration.
docker rm --force ${CONTAINER_NAME} &> /dev/null
docker run -d \
-p 3000:3000 \
--name=${CONTAINER_NAME} \
-v ~/.aws:/usr/share/grafana/.aws \
-v ${SCRIPT_DIR}/local_grafana_data:/var/lib/grafana \
-e "GF_INSTALL_PLUGINS=grafana-iot-twinmaker-app" \
grafana/grafana:8.2.5