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