summaryrefslogtreecommitdiffstats
path: root/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 10:28:42 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 10:51:01 +0200
commit451a3400b76511393c62a444f588a4ed15f4a549 (patch)
treee4f5873a863d1d3e55618eab48b83262f874719d /sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes
parent5abfe4e1fb5fae4bbd5fbc340519f52075aff3ff (diff)
Initial OpenECOMP SDC commit
Change-Id: I0924d5a6ae9cdc161ae17c68d3689a30d10f407b Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes')
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb49
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_locate_wars.rb26
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_create_DMaaP_keys.rb34
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb43
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb15
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_properties.rb17
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb7
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb14
-rw-r--r--sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_import_Normatives.rb16
9 files changed, 221 insertions, 0 deletions
diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb
new file mode 100644
index 0000000000..35147a30fb
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb
@@ -0,0 +1,49 @@
+#directory "BE_tempdir_cleanup" do
+# path "/var/lib/jetty/tempdir"
+# recursive true
+# action :delete
+#end
+
+
+directory "BE_tempdir_creation" do
+ path "/var/lib/jetty/temp"
+ owner 'jetty'
+ group 'jetty'
+ mode '0755'
+ action :create
+end
+
+
+#directory "BE_webapps_cleanup" do
+# path "/var/lib/jetty/webapps"
+# recursive true
+# action :delete
+#end
+
+
+#directory "BE_webapps_creation" do
+# path "/var/lib/jetty/webapps"
+# owner 'jetty'
+# group 'jetty'
+# mode '0755'
+# action :create
+#end
+
+
+directory "BE_create_config_dir" do
+ path "/var/lib/jetty/config"
+ owner 'jetty'
+ group 'jetty'
+ mode '0755'
+ action :create
+end
+
+
+directory "BE_create_catalog-be" do
+ path "/var/lib/jetty/config/catalog-be"
+ owner 'jetty'
+ group 'jetty'
+ mode '0755'
+ action :create
+end
+
diff --git a/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_locate_wars.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_locate_wars.rb
new file mode 100644
index 0000000000..af3dea15ef
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_locate_wars.rb
@@ -0,0 +1,26 @@
+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
+
+###### copy catalog-be.war
+
+
+
+###### copy onboarding-be.war& api-docs.war
+#bash "copy-onboarding-be" do
+# code <<-EOH
+# /bin/tar -xvf /var/tmp/onboarding-be.tar -C /var/tmp/
+# mv /var/tmp/onboarding-be*.war /var/tmp//api-docs*.war #{jetty_base}/webapps
+# EOH
+#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
new file mode 100644
index 0000000000..583dfff7b2
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_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_setup_configuration.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb
new file mode 100644
index 0000000000..4facd4247c
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_setup_configuration.rb
@@ -0,0 +1,43 @@
+replication_factor=1
+
+template "titan.properties" do
+ path "/var/lib/jetty/config/catalog-be/titan.properties"
+ source "BE-titan.properties.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ variables({
+ :CASSANDRA_IP => node['Nodes']['CS'],
+ :CASSANDRA_PWD => node['cassandra'][:cassandra_password],
+ :CASSANDRA_USR => node['cassandra'][:cassandra_user],
+ :DC_NAME => "DC-"+node.chef_environment,
+ :rep_factor => replication_factor
+ })
+end
+
+
+template "catalog-be-config" do
+ path "/var/lib/jetty/config/catalog-be/configuration.yaml"
+ source "BE-configuration.yaml.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ variables({
+ :host_ip => node['HOST_IP'],
+ :catalog_port => node['BE'][:http_port],
+ :ssl_port => node['BE'][:https_port],
+ :cassandra_ip => node['Nodes']['CS'],
+ :rep_factor => 1,
+ :DC_NAME => "DC-"+node.chef_environment
+ })
+end
+
+
+template "distribution-engine-configuration" do
+ path "/var/lib/jetty/config/catalog-be/distribution-engine-configuration.yaml"
+ source "BE-distribution-engine-configuration.yaml.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+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
new file mode 100644
index 0000000000..39fc5af883
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_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
new file mode 100644
index 0000000000..8c57de6caf
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_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_7_logback.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb
new file mode 100644
index 0000000000..18ee216d5c
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb
@@ -0,0 +1,7 @@
+cookbook_file "/var/lib/jetty/config/catalog-be/logback.xml" do
+ source "BE-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_8_errors_config.rb b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb
new file mode 100644
index 0000000000..c23112c5b5
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb
@@ -0,0 +1,14 @@
+cookbook_file "/var/lib/jetty/config/catalog-be/ecomp-error-configuration.yaml" do
+ source "BE-ecomp-error-configuration.yaml"
+ mode 0755
+ owner "jetty"
+ group "jetty"
+end
+
+cookbook_file "/var/lib/jetty/config/catalog-be/error-configuration.yaml" do
+ source "BE-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
new file mode 100644
index 0000000000..6e9b24133d
--- /dev/null
+++ b/sdc-os-chef/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_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
+