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) --- .../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 ++++---- 6 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/truststore (limited to 'catalog-be') 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 -- cgit 1.2.3-korg