blob: 8ce538a1ed93119c3224a3621e8e41e3d6c05580 [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 Pasquierf2b5a3b2017-06-06 17:32:21 +020014INFLUXDB_SERVICE=$(salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true)
15
Simon Pasquierd3a0b912017-05-02 15:32:20 +020016# Configure Telegraf
Simon Pasquier4a802be2017-06-29 12:54:50 +020017salt -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
18
19# Configure log_collector
20salt -C 'I@heka:log_collector' state.sls heka.log_collector
Simon Pasquierd3a0b912017-05-02 15:32:20 +020021
22# Configure Elasticsearch/Kibana services
23salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
24salt -C 'I@kibana:server' state.sls kibana.server -b 1
Simon Pasquierd3a0b912017-05-02 15:32:20 +020025salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
26salt -C 'I@kibana:client' state.sls kibana.client
27
Simon Pasquierf2b5a3b2017-06-06 17:32:21 +020028if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
29 salt -C 'I@influxdb:server' state.sls influxdb
30fi
31
Simon Pasquierd3a0b912017-05-02 15:32:20 +020032# Collect grains needed to configure the services
33salt -C 'I@salt:minion' state.sls salt.minion.grains
34salt -C 'I@salt:minion' saltutil.refresh_modules
35salt -C 'I@salt:minion' mine.update
36sleep 5
37
Simon Pasquier4a802be2017-06-29 12:54:50 +020038# Generate the configuration for services running in Docker Swarm
39salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
40
41# Kick off the services in Docker Swarm
Simon Pasquierd3a0b912017-05-02 15:32:20 +020042salt -C 'I@docker:swarm:role:master' state.sls docker
43salt -C 'I@docker:swarm' dockerng.ps
Simon Pasquierf8532062017-05-04 11:58:41 +020044
Simon Pasquier4a802be2017-06-29 12:54:50 +020045# Configure the Grafana dashboards and datasources
Simon Pasquiere76e2622017-05-15 15:04:47 +020046stacklight_vip=$(get_param_value stacklight_monitor_address)
47wait_for_http_service "http://${stacklight_vip}:15013/"
Simon Pasquierf8532062017-05-04 11:58:41 +020048salt -C 'I@grafana:client' state.sls grafana.client