monitoring-grafana-influxdb.../deploy_all.sh

48 lines
1.6 KiB
Bash
Raw Normal View History

2018-06-10 14:05:43 +00:00
## INSTALL docker-ce
read -r -p "Do you want to install docker? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $(whoami)
else
echo -e "'no' chosen for docker installation - docker assummed to be already installed"
fi
## INSTALL docker-compose
2018-06-10 14:05:43 +00:00
read -r -p "Do you want to install docker-compose? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
sudo curl -L https://github.com/docker/compose/releases/download/1.21.2/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
else
echo -e "'no' chosen for docker-compose installation - docker-compose assummed to be already installed"
fi
# START docker-compose
2018-06-17 11:05:55 +00:00
docker-compose up -d --remove-orphans
# ADD DATASOURCES AND DASHBOARDS
2018-06-17 11:05:55 +00:00
echo "adding datasources..."
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_datasources.sh
echo "adding dashboards..."
docker exec -it -u 0 grafana /var/lib/grafana/ds/add_dashboards.sh
2018-06-17 11:05:55 +00:00
## NOW LET'S SECURE GRAFANA
# CHECKING OUT ORIGINAL FILE
#echo -e "checking out original docker-compose.yml"
#git checkout docker-compose.yml
## STOPPING and REMOVING GRAFANA CONTAINER
echo -e "stopping & removing grafana container"
container_id=$(docker container ls | grep grafana| awk '{print $1}')
docker stop $container_id
docker rm $container_id
# REPLACING HTTP with HTTPS
echo -e "changing http to https"
sed -i 's/GF_SERVER_PROTOCOL: "http"/GF_SERVER_PROTOCOL: "https"/g' docker-compose.yml
docker-compose up -d grafana