From c033cdce906efc3b6ccd1d2f45544af47e328ed4 Mon Sep 17 00:00:00 2001 From: "Areli, Fuss (af732p)" Date: Tue, 24 Apr 2018 13:59:00 +0300 Subject: Add cluster resiliance support Add configuration support for CS/ES cluster and add truststore default files to support ssl connection Change-Id: Icc2831704e8a3c55ce9b380a39001891ce8d41ab Issue-ID: SDC-1254 Signed-off-by: Areli, Fuss (af732p) --- .../cassandra-actions/recipes/01-createCsUser.rb | 2 +- .../cassandra-actions/recipes/02-createDoxKeyspace.rb | 2 +- .../cassandra-actions/recipes/03-schemaCreation.rb | 4 ++-- .../cookbooks/sdc-catalog-be/files/default/truststore | Bin 0 -> 4255 bytes .../sdc-catalog-be/recipes/BE_2_setup_configuration.rb | 12 ++++++------ .../sdc-catalog-be/recipes/BE_3_locate_keystore.rb | 8 ++++++++ .../sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb | 10 +++++++++- .../templates/default/BE-elasticsearch.yml.erb | 2 +- .../templates/default/BE-titan.properties.erb | 8 ++++---- .../cookbooks/sdc-catalog-fe/files/default/truststore | Bin 0 -> 4255 bytes .../sdc-catalog-fe/recipes/FE_6_locate_keystore.rb | 7 +++++++ .../sdc-onboard-backend/files/default/truststore | Bin 0 -> 4255 bytes .../sdc-onboard-backend/recipes/ON_2_locate_keystore.rb | 8 ++++++++ .../recipes/ON_5_setup_configuration.rb | 2 +- openecomp-be/dist/sdc-onboard-backend-docker/pom.xml | 2 +- sdc-os-chef/environments/Template.json | 10 +++++++--- sdc-os-chef/scripts/k8s/kubernetes_run.sh | 8 ++++---- .../recipes/ES_1_setup_elasticsearch.rb | 10 +++++++++- .../templates/default/ES-elasticsearch.yml.erb | 4 ++-- .../recipes/ES_1_create_audit_template.rb | 11 +++++++---- .../recipes/ES_2_create_resources_template.rb | 7 +++++-- .../recipes/ES_3_create_monitoring_template.rb | 7 +++++-- .../ES_4_create_kibana_dashboard_virtualization.rb | 9 ++++++--- .../recipes/sanityApiTests_2_setup_configuration.rb | 4 ++-- .../recipes/sanityUiTests_2_setup_configuration.rb | 4 ++-- 25 files changed, 98 insertions(+), 43 deletions(-) create mode 100644 catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/truststore create mode 100644 catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/truststore create mode 100644 openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/files/default/truststore diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb index 2eb6d58cc3..d14e9a2232 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb @@ -3,7 +3,7 @@ template "/tmp/create_cassandra_user.sh" do sensitive true mode 0755 variables({ - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].first, :cassandra_pwd => ENV['CS_PASSWORD'], :sdc_usr => ENV['SDC_USER'], :sdc_pwd => ENV['SDC_PASSWORD'] diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb index 87edf8c358..c9b369320c 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb @@ -3,7 +3,7 @@ template "/tmp/create_dox_keyspace.sh" do sensitive true mode 0755 variables({ - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].first, :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user] diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb index ea8daf02ec..faa04e57b6 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb @@ -19,7 +19,7 @@ template "titan.properties" do mode "0755" variables({ :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].first, :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user], :titan_connection_timeout => node['cassandra']['titan_connection_timeout'] @@ -35,7 +35,7 @@ template "/tmp/sdctool/config/configuration.yaml" do :host_ip => node['Nodes']['BE'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port], - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].first, :rep_factor => 1, :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :titan_Path => "/tmp/sdctool/config/", diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/truststore b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/truststore new file mode 100644 index 0000000000..c4083931dc Binary files /dev/null and b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/truststore differ diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb index 3bad06f6fb..2ba89801c4 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb @@ -16,13 +16,13 @@ template "titan.properties" do group "jetty" mode "0755" variables({ - :CASSANDRA_IP => node['Nodes']['CS'], - :CASSANDRA_PWD => node['cassandra'][:cassandra_password], - :CASSANDRA_USR => node['cassandra'][:cassandra_user], + :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/,''), + :cassandra_pwd => node['cassandra'][:cassandra_password], + :cassandra_usr => node['cassandra'][:cassandra_user], :rep_factor => replication_factor, :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :titan_connection_timeout => node['cassandra']['titan_connection_timeout'], - :cassandra_traststore_password => node['cassandra'][:truststore_password], + :cassandra_truststore_password => node['cassandra'][:truststore_password], :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}" }) end @@ -38,7 +38,7 @@ template "catalog-be-config" do :catalog_ip => node['Nodes']['BE'], :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port], - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :rep_factor => replication_factor, :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :titan_Path => "/var/lib/jetty/config/catalog-be/", @@ -46,7 +46,7 @@ template "catalog-be-config" do :socket_read_timeout => node['cassandra']['socket_read_timeout'], :cassandra_pwd => node['cassandra'][:cassandra_password], :cassandra_usr => node['cassandra'][:cassandra_user], - :cassandra_traststore_password => node['cassandra'][:truststore_password], + :cassandra_truststore_password => node['cassandra'][:truststore_password], :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}" }) end diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb index b09ec2610f..e540b34d26 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb @@ -13,3 +13,11 @@ cookbook_file "#{ENV['JETTY_BASE']}/etc/keystore" do group "jetty" mode 0755 end + +cookbook_file "#{ENV['JETTY_BASE']}/etc/truststore" do + source "truststore" + owner "jetty" + group "jetty" + mode 0755 +end + diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb index 28f611267c..7a2f24e57a 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb @@ -1,5 +1,13 @@ clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment +elasticsearch_list = '' + +node['Nodes']['ES'].each do |item| + elasticsearch_list += "- " + item + ":9300\n" +end + + + template "elasticsearch.yml-config" do path "#{ENV['JETTY_BASE']}/config/elasticsearch.yml" source "BE-elasticsearch.yml.erb" @@ -8,6 +16,6 @@ template "elasticsearch.yml-config" do mode "0755" variables ({ :cluster_name => "#{clusterName}", - :es_host_ip => node['Nodes']['ES'] + :es_host_ip => "#{elasticsearch_list}" }) end diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb index 611285ea3f..8d488504b3 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-elasticsearch.yml.erb @@ -8,4 +8,4 @@ http.cors.enabled: true path.home: "/var/lib/jetty/config" elasticSearch.transportclient: true transport.client.initial_nodes: - - <%= @es_host_ip %>:9300 +<%= @es_host_ip %> diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb index cc518ad1b2..8667cbf612 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-titan.properties.erb @@ -1,14 +1,14 @@ storage.backend=cassandra -storage.hostname=<%= @CASSANDRA_IP %> +storage.hostname=<%= @cassandra_ip %> storage.port=9160 -storage.username=<%= @CASSANDRA_USR %> -storage.password=<%= @CASSANDRA_PWD %> +storage.username=<%= @cassandra_usr %> +storage.password=<%= @cassandra_pwd %> storage.connection-timeout=<%= @titan_connection_timeout %> storage.cassandra.keyspace=sdctitan storage.cassandra.ssl.enabled=<%= @cassandra_ssl_enabled %> storage.cassandra.ssl.truststore.location=/var/lib/jetty/config/truststore -storage.cassandra.ssl.truststore.password=<%= @cassandra_traststore_password %> +storage.cassandra.ssl.truststore.password=<%= @cassandra_truststore_password %> storage.cassandra.read-consistency-level=LOCAL_QUORUM storage.cassandra.write-consistency-level=LOCAL_QUORUM diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/truststore b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/truststore new file mode 100644 index 0000000000..c4083931dc Binary files /dev/null and b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/files/default/truststore differ diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb index 12af1fff21..b2a7edef0b 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb @@ -12,3 +12,10 @@ cookbook_file "#{ENV['JETTY_BASE']}/etc/keystore" do group "jetty" mode 0755 end + +cookbook_file "#{ENV['JETTY_BASE']}/etc/truststore" do + source "truststore" + owner "jetty" + group "jetty" + mode 0755 +end diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/files/default/truststore b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/files/default/truststore new file mode 100644 index 0000000000..c4083931dc Binary files /dev/null and b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/files/default/truststore differ diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb index e838543e7d..25f5d4ff65 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb @@ -12,3 +12,11 @@ cookbook_file "#{ENV['JETTY_BASE']}/etc/keystore" do group "jetty" mode 0755 end + +cookbook_file "#{ENV['JETTY_BASE']}/etc/truststore" do + source "truststore" + owner "jetty" + group "jetty" + mode 0755 +end + diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb index 90e0802a94..62fe1265b7 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb @@ -8,7 +8,7 @@ template "onboard-be-config" do :onboard_ip => node['ONBOARDING_BE_VIP'], :onboard_port => node['ONBOARDING_BE'][:http_port], :ssl_port => node['ONBOARDING_BE'][:https_port], - :cassandra_ip => node['Nodes']['CS'], + :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], :socket_read_timeout => node['cassandra']['socket_read_timeout'], diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml index 027ea019eb..5de979f96e 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml +++ b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml @@ -37,7 +37,7 @@ - ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/api-docs + ${project.parent.basedir}/../../openecomp-be/tools/swagger-ui/target/api-docs api-docs.war diff --git a/sdc-os-chef/environments/Template.json b/sdc-os-chef/environments/Template.json index 9073f2c562..dae0860861 100644 --- a/sdc-os-chef/environments/Template.json +++ b/sdc-os-chef/environments/Template.json @@ -35,12 +35,16 @@ "fqdn": ["10.0.11.1", "10.0.11.1"] }, "Nodes": { - "CS": "yyy", + "CS": [ + "yyy" + ], "BE": "yyy", "ONBOARDING_BE": "yyy", "FE": "yyy", - "ES": "yyy", - "KB": "yyy" + "ES": [ + "yyy" + ], + "KB": "yyy" }, "Plugins": { "DCAE": { diff --git a/sdc-os-chef/scripts/k8s/kubernetes_run.sh b/sdc-os-chef/scripts/k8s/kubernetes_run.sh index 7a73c2af3b..41797fcdca 100644 --- a/sdc-os-chef/scripts/k8s/kubernetes_run.sh +++ b/sdc-os-chef/scripts/k8s/kubernetes_run.sh @@ -90,7 +90,7 @@ status $? # SDC LOGS Tree # #################### print_header "SDC - Deploy Pods ..." -mkdir -p /dockerdata-nfs/onap/sdc/logs//BE/SDC/SDC-BE -mkdir -p /dockerdata-nfs/onap/sdc/logs/FE/SDC/SDC-FE -mkdir -p /dockerdata-nfs/onap/sdc/logs/ONBOARD/SDC/ONBOARD-BE -chmod -R 777 /dockerdata-nfs/onap/sdc/logs/* +sudo mkdir -p /dockerdata-nfs/onap/sdc/logs//BE/SDC/SDC-BE +sudo mkdir -p /dockerdata-nfs/onap/sdc/logs/FE/SDC/SDC-FE +sudo mkdir -p /dockerdata-nfs/onap/sdc/logs/ONBOARD/SDC/ONBOARD-BE +sudo chmod -R 777 /dockerdata-nfs/onap/sdc/logs/* diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb index 68c1154ec6..f32e736f53 100644 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb +++ b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/recipes/ES_1_setup_elasticsearch.rb @@ -1,3 +1,10 @@ +elasticsearch_list = '' + +node['Nodes']['ES'].each do |item| + elasticsearch_list += "- " + item + ":9300\n" +end + + template "/usr/share/elasticsearch/config/elasticsearch.yml" do source "ES-elasticsearch.yml.erb" owner "elasticsearch" @@ -6,7 +13,8 @@ template "/usr/share/elasticsearch/config/elasticsearch.yml" do variables({ :cluster_name => node['elasticsearch'][:cluster_name]+node.chef_environment, :node_name => node[:hostname], - :ES_IP => node['Nodes']['ES'], + :es_ip_list => "#{elasticsearch_list}", + :es_ip_list_XXX => node['Nodes']['ES'], :num_of_shards => node['elasticsearch'][:num_of_shards], :num_of_replicas => node['elasticsearch'][:num_of_replicas] }) diff --git a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb index 613e6b046b..0a2057dca6 100644 --- a/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb +++ b/sdc-os-chef/sdc-elasticsearch/chef-repo/cookbooks/sdc-elasticsearch/templates/default/ES-elasticsearch.yml.erb @@ -1,14 +1,14 @@ network.host: 0.0.0.0 discovery.zen.ping.multicast.enabled: false discovery.zen.ping.unicast.enabled: true -#discovery.zen.ping.unicast.hosts: <%= @ES_IP %> +#discovery.zen.ping.unicast.hosts: <%= @es_ip_list_XXXXX %> cluster.name: <%= @cluster_name %> node.name: <%= @node_name %> elasticSearch.transportclient: true transport.client.initial_nodes: - - <%= @ES_IP %>:9300 +<%= @es_ip_list %> index.number_of_shards: <%= @num_of_shards %> index.number_of_replicas: <%= @num_of_replicas %> diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb index 35bf49fb6d..8ee4087325 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb +++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_1_create_audit_template.rb @@ -1,8 +1,11 @@ +# Get the first es node in the list +es_node = node['Nodes']['ES'].first + ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true" + curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true" resp = Net::HTTP.get_response URI.parse(curl_command) stat = JSON.parse(resp.read_body)['status'] @@ -233,13 +236,13 @@ bash "create audit mapping" do }, "_all": { "enabled": true } } }, - "aliases": { "last_3_months": {}}}' http://#{node['Nodes']['ES']}:9200/_template/audit_template + "aliases": { "last_3_months": {}}}' http://#{es_node}:9200/_template/audit_template EOH end bash "set default index for Kibana" do code <<-EOH - curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}' - curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}' + curl -XPUT http://#{es_node}:9200/.kibana/index-pattern/auditingevents-* -d '{"title" : "events-*", "timeFieldName": "TIMESTAMP"}' + curl -XPUT http://#{es_node}:9200/.kibana/config/4.3.3 -d '{"defaultIndex" : "auditingevents-*"}' EOH end diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb index d35b81293e..11b8c9d060 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb +++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_2_create_resources_template.rb @@ -1,8 +1,11 @@ +# Get the first es node in the list +es_node = node['Nodes']['ES'].first + ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true" + curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true" resp = Net::HTTP.get_response URI.parse(curl_command) stat = JSON.parse(resp.read_body)['status'] @@ -32,6 +35,6 @@ bash "create resources mapping" do "_all": { "enabled": true } } } - }' http://#{node['Nodes']['ES']}:9200/_template/resources_template + }' http://#{es_node}:9200/_template/resources_template EOH end \ No newline at end of file diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb index 02b20f8cce..685b468e7a 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb +++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_3_create_monitoring_template.rb @@ -1,8 +1,11 @@ +# Get the first es node in the list +es_node = node['Nodes']['ES'].first + ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true" + curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true" resp = Net::HTTP.get_response URI.parse(curl_command) stat = JSON.parse(resp.read_body)['status'] @@ -48,6 +51,6 @@ bash "create monitoring mapping" do } }, "aliases": { "last_3_months": {} } - }' http://#{node['Nodes']['ES']}:9200/_template/monitoring_template + }' http://#{es_node}:9200/_template/monitoring_template EOH end diff --git a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb index 08c3fac613..53497133f5 100644 --- a/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb +++ b/sdc-os-chef/sdc-init-elasticsearch/chef-repo/cookbooks/init-sdc-elasticsearch/recipes/ES_4_create_kibana_dashboard_virtualization.rb @@ -1,8 +1,11 @@ +# Get the first es node in the list +es_node = node['Nodes']['ES'].first + ruby_block "check_ElasticSearch_Cluster_Health" do block do #tricky way to load this Chef::Mixin::ShellOut utilities Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "http://#{node['Nodes']['ES']}:9200/_cluster/health?pretty=true" + curl_command = "http://#{es_node}:9200/_cluster/health?pretty=true" resp = Net::HTTP.get_response URI.parse(curl_command) stat = JSON.parse(resp.read_body)['status'] @@ -25,7 +28,7 @@ bash "create Kibana dashboard" do for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/dashboard_*.json; do name=`basename $file .json | awk -F"_" '{print $2}'` echo "Loading dashboard $name:" - curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/dashboard/$name -d @$file || exit 1 + curl -XPUT http://#{es_node}:9200/.kibana/dashboard/$name -d @$file || exit 1 echo done EOH @@ -36,7 +39,7 @@ bash "create Kibana visualization" do for file in /root/chef-solo/cookbooks/sdc-init-elasticsearch/files/default/visualization_*.json; do name=`basename $file .json | awk -F"_" '{print $2}'` echo "Loading visualization $name:" - curl -XPUT http://#{node['Nodes']['ES']}:9200/.kibana/visualization/$name -d @$file || exit 1 + curl -XPUT http://#{es_node}:9200/.kibana/visualization/$name -d @$file || exit 1 echo done EOH diff --git a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb index cf6875746e..337ce9a0af 100644 --- a/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb +++ b/test-apis-ci/sdc-api-tests/chef-repo/cookbooks/sdc-api-tests/recipes/sanityApiTests_2_setup_configuration.rb @@ -20,7 +20,7 @@ template "sdc-yaml-config" do :importResourceTestsConfigDir => "#{tests_base}/CI/importResourceTests", :ConfigurationFile => "#{tests_base}/conf/configuration.yaml", :errorConfigurationFile => "#{tests_base}/conf/error-configuration.yaml", - :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_IP => node['Nodes']['CS'][0], :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user] }) @@ -34,7 +34,7 @@ template "titan.properties" do group "root" mode "0755" variables({ - :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_IP => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user], :rep_factor => replication_factor, diff --git a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb index 083c6609d5..ca66b8c46a 100644 --- a/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb +++ b/ui-ci/sdc-ui-tests/chef-repo/cookbooks/sdc-ui-tests/recipes/sanityUiTests_2_setup_configuration.rb @@ -19,7 +19,7 @@ template "sdc-yaml-config" do :importResourceTestsConfigDir => "#{tests_base}/CI/importResourceTests", :ConfigurationFile => "#{tests_base}/conf/configuration.yaml", :errorConfigurationFile => "#{tests_base}/conf/error-configuration.yaml", - :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_IP => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user], :ES_IP => node['Nodes']['ES'] @@ -34,7 +34,7 @@ template "titan.properties" do group "root" mode "0755" variables({ - :CASSANDRA_IP => node['Nodes']['CS'], + :CASSANDRA_IP => node['Nodes']['CS'].join(",").gsub(/[|]/,''), :CASSANDRA_PWD => node['cassandra'][:cassandra_password], :CASSANDRA_USR => node['cassandra'][:cassandra_user], :rep_factor => replication_factor, -- cgit 1.2.3-korg