From 6d7a7c1b6e82c92e37eb0b23b892418b82af026f Mon Sep 17 00:00:00 2001 From: Tal Gitelman Date: Thu, 31 Aug 2017 15:51:10 +0300 Subject: Jetty default ssl certificate fix Recipes alignment for ssl.ini new keystore Change-Id: Ibe5a04712b5fb7c3c7e0adfa0bcb23d260b77479 Issue-ID:SDC-264 Signed-off-by: Tal Gitelman --- .../recipes/BE_10_import_Normatives.rb | 16 ++++++++++ .../recipes/BE_2_setup_configuration.rb | 15 ---------- .../recipes/BE_3_create_DMaaP_keys.rb | 34 ---------------------- .../sdc-catalog-be/recipes/BE_3_locate_keystore.rb | 16 ++++++++++ .../recipes/BE_4_create_DMaaP_keys.rb | 34 ++++++++++++++++++++++ .../sdc-catalog-be/recipes/BE_4_jetty_Modules.rb | 15 ---------- .../sdc-catalog-be/recipes/BE_5_jetty_Modules.rb | 22 ++++++++++++++ .../recipes/BE_5_setup_elasticsearch.rb | 15 ---------- .../recipes/BE_6_setup_elasticsearch.rb | 15 ++++++++++ .../recipes/BE_6_setup_portal_properties.rb | 17 ----------- .../sdc-catalog-be/recipes/BE_7_logback.rb | 7 ----- .../recipes/BE_7_setup_portal_properties.rb | 17 +++++++++++ .../sdc-catalog-be/recipes/BE_8_errors_config.rb | 14 --------- .../sdc-catalog-be/recipes/BE_8_logback.rb | 7 +++++ .../sdc-catalog-be/recipes/BE_9_errors_config.rb | 14 +++++++++ .../recipes/BE_9_import_Normatives.rb | 16 ---------- 16 files changed, 141 insertions(+), 133 deletions(-) create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_create_DMaaP_keys.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb create mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb delete mode 100644 sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_import_Normatives.rb (limited to 'sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes') diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb new file mode 100644 index 0000000000..6e9b24133d --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_import_Normatives.rb @@ -0,0 +1,16 @@ +cookbook_file "/tmp/normatives.tar.gz" do + source "normatives.tar.gz" +end + +working_directory = "/tmp" + +bash "import-normatives" do + cwd "#{working_directory}" + code <<-EOH + tar xvfz /tmp/normatives.tar.gz + cd scripts/import/tosca/ + /bin/chmod +x importNormativeAll.py + python importNormativeAll.py + EOH +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb index ac1614a253..067642fed9 100644 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb @@ -51,18 +51,3 @@ cookbook_file "ArtifactGenerator" do group "jetty" mode "0755" end - -directory "Jetty_etcdir_creation" do - path "/#{jetty_base}/etc" - owner 'jetty' - group 'jetty' - mode '0755' - action :create -end - -cookbook_file "/#{jetty_base}/etc/keystore" do - source "keystore" - owner "jetty" - group "jetty" - mode 0755 -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_create_DMaaP_keys.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_create_DMaaP_keys.rb deleted file mode 100644 index 583dfff7b2..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_create_DMaaP_keys.rb +++ /dev/null @@ -1,34 +0,0 @@ -http_request 'create-DMaaP-apiKeys' do - action :post - url 'http://23.253.97.75:3904/apiKeys/create' - message ({:some => 'data'}.to_json) - headers({ - 'Content-Type' => 'application/json' - }) -end - - -selfEnviroment = node.chef_environment - -ruby_block "create-DMaaP-apiKeys" do - block do - sleep(15) - #tricky way to load this Chef::Mixin::ShellOut utilities - Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) - curl_command = "https://es_admin:Aa123456@#{application_host}:9200/_cluster/health?pretty=true --insecure" - resp = Net::HTTP.get_response URI.parse(curl_command) - stat = JSON.parse(resp.read_body)['status'] - - case stat - when "green" - printf("\033[32m%s\n\033[0m", " ElasticSearch tests completed successfully.") - when "yellow" - printf("\033[33m%s\n\033[0m", " ElasticSearch tests completed successfully, with warnings") - when "red" - printf("\033[31m%s\n\033[0m", " ElasticSearch tests failed!!!") - end - end -end - -curl POST -d '{"email":"Grinberg.Moti","description":"New Api Key for ASDC OS"}' http://23.253.97.75:3904/apiKeys/create - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb new file mode 100644 index 0000000000..148eaaf4d3 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb @@ -0,0 +1,16 @@ +jetty_base="/var/lib/jetty" + +directory "Jetty_etcdir_creation" do + path "/#{jetty_base}/etc" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +cookbook_file "/#{jetty_base}/etc/keystore" do + source "keystore" + owner "jetty" + group "jetty" + mode 0755 +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb new file mode 100644 index 0000000000..583dfff7b2 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_create_DMaaP_keys.rb @@ -0,0 +1,34 @@ +http_request 'create-DMaaP-apiKeys' do + action :post + url 'http://23.253.97.75:3904/apiKeys/create' + message ({:some => 'data'}.to_json) + headers({ + 'Content-Type' => 'application/json' + }) +end + + +selfEnviroment = node.chef_environment + +ruby_block "create-DMaaP-apiKeys" do + block do + sleep(15) + #tricky way to load this Chef::Mixin::ShellOut utilities + Chef::Resource::RubyBlock.send(:include, Chef::Mixin::ShellOut) + curl_command = "https://es_admin:Aa123456@#{application_host}:9200/_cluster/health?pretty=true --insecure" + resp = Net::HTTP.get_response URI.parse(curl_command) + stat = JSON.parse(resp.read_body)['status'] + + case stat + when "green" + printf("\033[32m%s\n\033[0m", " ElasticSearch tests completed successfully.") + when "yellow" + printf("\033[33m%s\n\033[0m", " ElasticSearch tests completed successfully, with warnings") + when "red" + printf("\033[31m%s\n\033[0m", " ElasticSearch tests failed!!!") + end + end +end + +curl POST -d '{"email":"Grinberg.Moti","description":"New Api Key for ASDC OS"}' http://23.253.97.75:3904/apiKeys/create + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb deleted file mode 100644 index 3ec16e8924..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb +++ /dev/null @@ -1,15 +0,0 @@ -jetty_base="/var/lib/jetty" -jetty_home="/usr/local/jetty" - -###### create Jetty modules -bash "create-jetty-modules" do -cwd "#{jetty_base}" -code <<-EOH - cd "#{jetty_base}" - java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy - java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid -EOH -not_if "ls /#{jetty_base}/start.d/https.ini" -end - - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb new file mode 100644 index 0000000000..046e3c6919 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_jetty_Modules.rb @@ -0,0 +1,22 @@ +jetty_base="/var/lib/jetty" +jetty_home="/usr/local/jetty" + +###### create Jetty modules +bash "create-jetty-modules" do +cwd "#{jetty_base}" +code <<-EOH + cd "#{jetty_base}" + java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy + java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid +EOH +not_if "ls /#{jetty_base}/start.d/https.ini" +end + +template "ssl-ini" do + path "/#{jetty_base}/start.d/ssl.ini" + source "ssl-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :https_port => "#{node['BE'][:https_port]}" +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb deleted file mode 100644 index 39fc5af883..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb +++ /dev/null @@ -1,15 +0,0 @@ -clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment -node_name = node[:hostname] - -template "elasticsearch.yml-config" do - path "/var/lib/jetty/config/elasticsearch.yml" - source "BE-elasticsearch.yml.erb" - owner "jetty" - group "jetty" - mode "0755" - variables({ - :cluster_name => "#{clusterName}", - :es_host_ip => node['Nodes']['ES'] - }) -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb new file mode 100644 index 0000000000..39fc5af883 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_elasticsearch.rb @@ -0,0 +1,15 @@ +clusterName = node['elasticsearch'][:cluster_name]+node.chef_environment +node_name = node[:hostname] + +template "elasticsearch.yml-config" do + path "/var/lib/jetty/config/elasticsearch.yml" + source "BE-elasticsearch.yml.erb" + owner "jetty" + group "jetty" + mode "0755" + variables({ + :cluster_name => "#{clusterName}", + :es_host_ip => node['Nodes']['ES'] + }) +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb deleted file mode 100644 index 8c57de6caf..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb +++ /dev/null @@ -1,17 +0,0 @@ -template "template portal.properties" do - path "/var/lib/jetty/resources/portal.properties" - source "BE-portal.properties.erb" - owner "jetty" - group "jetty" - mode "0755" - variables ({ - :ecomp_rest_url => node['ECompP']['ecomp_rest_url'], - :ecomp_redirect_url => node['ECompP']['ecomp_redirect_url'], - :ueb_url_list => node['ECompP']['ueb_url_list'], - :inbox_name => node['ECompP']['inbox_name'], - :app_key => node['ECompP']['app_key'], - :app_secret => node['ECompP']['app_secret'], - :app_topic_name => node['ECompP']['app_topic_name'], - :decrypt_key => node['ECompP']['decryption_key'] - }) -end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb deleted file mode 100644 index 2dfc4f1089..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb +++ /dev/null @@ -1,7 +0,0 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do - source "logback.xml" - mode 0755 - owner "jetty" - group "jetty" -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb new file mode 100644 index 0000000000..8c57de6caf --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_setup_portal_properties.rb @@ -0,0 +1,17 @@ +template "template portal.properties" do + path "/var/lib/jetty/resources/portal.properties" + source "BE-portal.properties.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :ecomp_rest_url => node['ECompP']['ecomp_rest_url'], + :ecomp_redirect_url => node['ECompP']['ecomp_redirect_url'], + :ueb_url_list => node['ECompP']['ueb_url_list'], + :inbox_name => node['ECompP']['inbox_name'], + :app_key => node['ECompP']['app_key'], + :app_secret => node['ECompP']['app_secret'], + :app_topic_name => node['ECompP']['app_topic_name'], + :decrypt_key => node['ECompP']['decryption_key'] + }) +end diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb deleted file mode 100644 index 684d730709..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb +++ /dev/null @@ -1,14 +0,0 @@ -cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do - source "ecomp-error-configuration.yaml" - mode 0755 - owner "jetty" - group "jetty" -end - -cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do - source "error-configuration.yaml" - mode 0755 - owner "jetty" - group "jetty" -end - diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb new file mode 100644 index 0000000000..2dfc4f1089 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_logback.rb @@ -0,0 +1,7 @@ +cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do + source "logback.xml" + mode 0755 + owner "jetty" + group "jetty" +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb new file mode 100644 index 0000000000..684d730709 --- /dev/null +++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_errors_config.rb @@ -0,0 +1,14 @@ +cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do + source "ecomp-error-configuration.yaml" + mode 0755 + owner "jetty" + group "jetty" +end + +cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do + source "error-configuration.yaml" + mode 0755 + owner "jetty" + group "jetty" +end + diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_import_Normatives.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_import_Normatives.rb deleted file mode 100644 index 6e9b24133d..0000000000 --- a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_import_Normatives.rb +++ /dev/null @@ -1,16 +0,0 @@ -cookbook_file "/tmp/normatives.tar.gz" do - source "normatives.tar.gz" -end - -working_directory = "/tmp" - -bash "import-normatives" do - cwd "#{working_directory}" - code <<-EOH - tar xvfz /tmp/normatives.tar.gz - cd scripts/import/tosca/ - /bin/chmod +x importNormativeAll.py - python importNormativeAll.py - EOH -end - -- cgit 1.2.3-korg