-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·37 lines (28 loc) · 945 Bytes
/
install.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
31
32
33
34
35
36
37
#!/bin/sh
apt-get update
if ! type "docker" > /dev/null; then
echo "Installing Docker"
apt-get -y install docker.io
apt-get -y install docker-ce
fi
ADDRESS=$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
docker swarm init --advertise-addr="$ADDRESS"
if ! type "git" > /dev/null; then
echo "Installing Git"
apt-get -y install git
fi
DIRECTORY="prometheus-grafana-alertmanager-example"
if [ -d "$DIRECTORY" ]; then
rm -rf "$DIRECTORY"
fi
echo "Cloning Project"
git clone https://github.com/PagerTree/prometheus-grafana-alertmanager-example.git
cd "$DIRECTORY"
echo "Making Utility scripts executable"
chmod +x ./util/*.sh
echo "Starting Application"
docker stack deploy -c docker-compose.yml prom
echo "Waiting 5 seconds for services to come up"
sleep 5
while docker service ls | grep "0/1"; do sleep 3; echo "Waiting..."; done;
echo "You can now access your Grafana dashboard at http://$ADDRESS:3000"