diff --git a/salt/common/nginx/nginx.conf.so-master b/salt/common/nginx/nginx.conf.so-master index 2fe4e2ea9..bc8dbf39b 100644 --- a/salt/common/nginx/nginx.conf.so-master +++ b/salt/common/nginx/nginx.conf.so-master @@ -83,11 +83,11 @@ http { # Load configuration files for the default server block. #include /etc/nginx/default.d/*.conf; - location / { - try_files $uri $uri.html /index.html; - } + #location / { + # try_files $uri $uri.html /index.html; + # } - location /so-kibana { + location / { proxy_pass http://{{ masterip }}:5601/; proxy_read_timeout 90; proxy_connect_timeout 90; @@ -95,7 +95,6 @@ http { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy ""; - rewrite ^/so-kibana/(.*)$ /$1 break; } diff --git a/salt/elasticsearch/bin/crossthestreams.sh b/salt/elasticsearch/bin/crossthestreams.sh new file mode 100644 index 000000000..79fd78936 --- /dev/null +++ b/salt/elasticsearch/bin/crossthestreams.sh @@ -0,0 +1,27 @@ +{%- set ES = salt['pillar.get']('master:mainip', '') -%} +# Wait for ElasticSearch to come up, so that we can query for version infromation +echo -n "Waiting for ElasticSearch..." +COUNT=0 +ELASTICSEARCH_CONNECTED="no" +while [[ "$COUNT" -le 30 ]]; do + curl --output /dev/null --silent --head --fail http://{{ ES }}:9200 + if [ $? -eq 0 ]; then + ELASTICSEARCH_CONNECTED="yes" + echo "connected!" + break + else + ((COUNT+=1)) + sleep 1 + echo -n "." + fi +done +if [ "$ELASTICSEARCH_CONNECTED" == "no" ]; then + echo + echo -e "Connection attempt timed out. Unable to connect to ElasticSearch. \nPlease try: \n -checking log(s) in /var/log/elasticsearch/\n -running 'sudo docker ps' \n -running 'sudo so-elastic-restart'" + echo + + exit +fi + +# Add all the storage nodes to cross cluster searching. +curl -XPUT http://{{ ES }}:9200/_cluster/settings -H'Content-Type: application/json' -d '{"persistent": {"search": {"remote": {"{{ SN }}": {"skip_unavailable": "true", "seeds": ["{{ SNIP }}:9200"]}}}}}' diff --git a/salt/kibana/bin/keepkibanahappy.sh b/salt/kibana/bin/keepkibanahappy.sh new file mode 100644 index 000000000..28967ee24 --- /dev/null +++ b/salt/kibana/bin/keepkibanahappy.sh @@ -0,0 +1,53 @@ +{%- set ES = salt['pillar.get']('master:mainip', '') -%} +# Wait for ElasticSearch to come up, so that we can query for version infromation +echo -n "Waiting for ElasticSearch..." +COUNT=0 +ELASTICSEARCH_CONNECTED="no" +while [[ "$COUNT" -le 30 ]]; do + curl --output /dev/null --silent --head --fail http://{{ ES }}:9200 + if [ $? -eq 0 ]; then + ELASTICSEARCH_CONNECTED="yes" + echo "connected!" + break + else + ((COUNT+=1)) + sleep 1 + echo -n "." + fi +done +if [ "$ELASTICSEARCH_CONNECTED" == "no" ]; then + echo + echo -e "Connection attempt timed out. Unable to connect to ElasticSearch. \nPlease try: \n -checking log(s) in /var/log/elasticsearch/\n -running 'sudo docker ps' \n -running 'sudo so-elastic-restart'" + echo + + exit +fi + +# Make sure Kibana is running +MAX_WAIT=240 + +# Check to see if Kibana is available +wait_step=0 + until curl -s -XGET http://{{ ES }}:5601 > /dev/null ; do + wait_step=$(( ${wait_step} + 1 )) + echo "Waiting on Kibana...Attempt #$wait_step" + if [ ${wait_step} -gt ${MAX_WAIT} ]; then + echo "ERROR: Kibana not available for more than ${MAX_WAIT} seconds." + exit 5 + fi + sleep 1s; + done + + +# Apply Kibana template + echo + echo "Applying Kibana template..." + curl -s -XPUT http://{{ ES }}:9200/_template/kibana \ + -H 'Content-Type: application/json' \ + -d'{"index_patterns" : ".kibana", "settings": { "number_of_shards" : 1, "number_of_replicas" : 0 }, "mappings" : { "search": {"properties": {"hits": {"type": "integer"}, "version": {"type": "integer"}}}}}' + echo + + curl -s -XPUT "{{ ES }}:9200/.kibana/_settings" \ + -H 'Content-Type: application/json' \ + -d'{"index" : {"number_of_replicas" : 0}}' + echo diff --git a/salt/kibana/etc/kibana.yml b/salt/kibana/etc/kibana.yml index 66dc3f412..c29218784 100644 --- a/salt/kibana/etc/kibana.yml +++ b/salt/kibana/etc/kibana.yml @@ -1,9 +1,9 @@ --- # Default Kibana configuration from kibana-docker. - +{%- set ES = salt['pillar.get']('master:mainip', '') -%} server.name: kibana server.host: "0" -elasticsearch.url: http://172.17.0.9:9200 +elasticsearch.url: http://{{ ES }}:9200 #elasticsearch.username: elastic #elasticsearch.password: changeme #xpack.monitoring.ui.container.elasticsearch.enabled: true