blob: 57949785cc8ac67818de6e45e3d4c3294d4fd4fb [file] [log] [blame]
Simon Pasquierd3a0b912017-05-02 15:32:20 +02001#!/bin/bash -x
2exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1
3
Simon Pasquiere76e2622017-05-15 15:04:47 +02004CWD="$(dirname "$(readlink -f "$0")")"
5
6# Import common functions
7COMMONS="$CWD"/common_functions.sh
8if [ ! -f "$COMMONS" ]; then
9 echo "File $COMMONS does not exist"
10 exit 1
11fi
12. "$COMMONS"
13
Simon Pasquierd3a0b912017-05-02 15:32:20 +020014# Configure Telegraf
15salt -C 'I@telegraf:agent' state.sls telegraf
16
17# Configure Elasticsearch/Kibana services
18salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
19salt -C 'I@kibana:server' state.sls kibana.server -b 1
20salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.service
Simon Pasquier7a207ef2017-05-11 12:01:24 +020021salt -C 'I@elasticsearch:client' --async service.restart salt-minion
Simon Pasquierd3a0b912017-05-02 15:32:20 +020022sleep 10
23salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
24salt -C 'I@kibana:client' state.sls kibana.client
25
26# Collect grains needed to configure the services
27salt -C 'I@salt:minion' state.sls salt.minion.grains
28salt -C 'I@salt:minion' saltutil.refresh_modules
29salt -C 'I@salt:minion' mine.update
30sleep 5
31
32# Configure the services running in Docker Swarm
Bartosz Kupidura15ad9582017-05-22 11:40:36 +020033salt -C 'I@docker:swarm' state.sls prometheus.server,prometheus.alertmanager -b 1
Bartosz Kupidurab53993a2017-06-06 14:56:59 +020034for img in pushgateway alertmanager prometheus telegraf; do
Simon Pasquierd3a0b912017-05-02 15:32:20 +020035 salt -C 'I@docker:swarm' dockerng.pull "docker-sandbox.sandbox.mirantis.net/bkupidura/$img"
Bartosz Kupidurab53993a2017-06-06 14:56:59 +020036 salt -C 'I@docker:swarm' dockerng.tag "docker-sandbox.sandbox.mirantis.net/bkupidura/$img:latest" "mirantis/$img:latest"
Simon Pasquierd3a0b912017-05-02 15:32:20 +020037done
38salt -C 'I@docker:swarm:role:master' state.sls docker
39salt -C 'I@docker:swarm' dockerng.ps
Simon Pasquierf8532062017-05-04 11:58:41 +020040
41# Configure Grafana dashboards and datasources
Simon Pasquiere76e2622017-05-15 15:04:47 +020042stacklight_vip=$(get_param_value stacklight_monitor_address)
43wait_for_http_service "http://${stacklight_vip}:15013/"
Simon Pasquierf8532062017-05-04 11:58:41 +020044salt -C 'I@grafana:client' state.sls grafana.client