diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-09-17 15:07:23 +0200 |
---|---|---|
committer | Sébastien Determe <sebastien.determe@intl.att.com> | 2020-09-18 12:59:54 +0000 |
commit | 591810df468a8e2c59569e701f514bff61203940 (patch) | |
tree | 9cd9b03ef59319a229bc784d66c02538c3785ec2 /catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes | |
parent | 0e825177c8f6c5304d9b529cd9831f30d401efaa (diff) |
Introduce a new docker for be plugins
Introduce a new docker image containing the etsi plugin and potentially others + simplify the process to build backend image + cleaning of unused files
Issue-ID: SDC-3289
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I82c770b391d169bef3bcc5f5af66e2a24dffb1b4
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes')
10 files changed, 304 insertions, 0 deletions
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb new file mode 100644 index 0000000000..3a79cfc874 --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb @@ -0,0 +1,37 @@ +jetty_base = "#{ENV['JETTY_BASE']}" + + +directory "Jetty_etc_dir_creation" do + path "#{jetty_base}/etc" + owner 'jetty' + group 'jetty' + mode '0755' + action :create + not_if { ::File.directory?("#{jetty_base}/etc") } +end + + +cookbook_file "#{jetty_base}/etc/keyfile" do + source "keyfile" + owner "jetty" + group "jetty" + mode 0755 +end + + +cookbook_file "#{jetty_base}/etc/cadi_truststore.jks" do + source "cadi_truststore.jks" + owner "jetty" + group "jetty" + mode 0755 +end + + +template "#{jetty_base}/etc/cadi.properties" do + path "#{jetty_base}/etc/cadi.properties" + source "cadi.properties.erb" + owner "jetty" + group "jetty" + mode "0755" +end + diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb new file mode 100644 index 0000000000..7ca3db813f --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb @@ -0,0 +1,29 @@ +unless Dir.exist? "#{ENV['JETTY_BASE']}/temp" + directory "BE_tempdir_creation" do + path "#{ENV['JETTY_BASE']}/temp" + owner 'jetty' + group 'jetty' + mode '0755' + action :create + end +end + +unless Dir.exist? "#{ENV['JETTY_BASE']}/config" + directory "BE_create_config_dir" do + path "#{ENV['JETTY_BASE']}/config" + owner 'jetty' + group 'jetty' + mode '0755' + action :create + end +end + +unless Dir.exist? "#{ENV['JETTY_BASE']}/config/catalog-be" + directory "BE_create_catalog-be" do + path "#{ENV['JETTY_BASE']}/config/catalog-be" + owner 'jetty' + group 'jetty' + mode '0755' + action :create + end +end diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb new file mode 100644 index 0000000000..2e66e2da98 --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb @@ -0,0 +1,73 @@ +# Set the cassandra replica number +replication_factor = node['cassandra']['replication_factor'] + +if node['Pair_EnvName'] == "" + janusgraph_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s + conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s +else + janusgraph_dcname_with_rep = node['cassandra']['datacenter_name'] + "," + replication_factor.to_s + "," + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "," + replication_factor.to_s + conf_dcname_with_rep = node['cassandra']['datacenter_name'] + "','" + replication_factor.to_s + "','" + node['cassandra']['cluster_name'] + node['Pair_EnvName'] + "','" + replication_factor.to_s +end + +#Set random ID for DMaap configuration +if node['DMAAP']['random_id'].nil? + node.default['DMAAP']['random_id'] = Time.now.getutc.to_i +end + +template "janusgraph.properties" do + path "#{ENV['JETTY_BASE']}/config/catalog-be/janusgraph.properties" + source "BE-janusgraph.properties.erb" + owner "jetty" + group "jetty" + mode "0644" + action :create_if_missing + variables({ + :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/, ''), + :cassandra_cql_port => node['cassandra'][:cassandra_port], + :cassandra_pwd => node['cassandra'][:cassandra_password], + :cassandra_usr => node['cassandra'][:cassandra_user], + :rep_factor => replication_factor, + :DC_NAME => node['cassandra']['datacenter_name'], + :DC_NAME_WITH_REP => janusgraph_dcname_with_rep, + :janus_connection_timeout => node['cassandra']['janusgraph_connection_timeout'], + :cassandra_truststore_password => node['cassandra'][:truststore_password], + :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}" + }) +end + +template "catalog-be-config" do + path "#{ENV['JETTY_BASE']}/config/catalog-be/configuration.yaml" + source "BE-configuration.yaml.erb" + owner "jetty" + group "jetty" + mode "0644" + action :create_if_missing + variables({ + :catalog_ip => node['Nodes']['BE'], + :catalog_port => node['BE'][:http_port], + :ssl_port => node['BE'][:https_port], + :cassandra_ip => node['Nodes']['CS'].join(",").gsub(/[|]/, ''), + :cassandra_port => node['cassandra']['cassandra_port'], + :rep_factor => replication_factor, + :DC_NAME => node['cassandra']['datacenter_name'], + :REP_STRING => conf_dcname_with_rep, + :janusgraph_Path => "/var/lib/jetty/config/catalog-be/", + :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], + :socket_read_timeout => node['cassandra']['socket_read_timeout'], + :cassandra_pwd => node['cassandra'][:cassandra_password], + :cassandra_usr => node['cassandra'][:cassandra_user], + :cassandra_truststore_password => node['cassandra'][:truststore_password], + :cassandra_ssl_enabled => "#{ENV['cassandra_ssl_enabled']}", + :dcae_be_vip => node['DCAE_BE_VIP'], + :dmaap_active => node['DMAAP']['active'] + }) +end + +template "distribution-engine-configuration" do + path "#{ENV['JETTY_BASE']}/config/catalog-be/distribution-engine-configuration.yaml" + source "BE-distribution-engine-configuration.yaml.erb" + owner "jetty" + group "jetty" + mode "0644" + action :create_if_missing +end diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb new file mode 100644 index 0000000000..cb2ffc7154 --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_3_locate_keystore.rb @@ -0,0 +1,23 @@ + +directory "Jetty_etcdir_creation" do + path "#{ENV['JETTY_BASE']}/etc" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + +cookbook_file "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.p12" do + source "org.onap.sdc.p12" + owner "jetty" + group "jetty" + mode 0755 +end + +cookbook_file "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.trust.jks" do + source "org.onap.sdc.trust.jks" + owner "jetty" + group "jetty" + mode 0755 +end + diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb new file mode 100644 index 0000000000..34934a44af --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_4_jetty_Modules.rb @@ -0,0 +1,55 @@ +#Set the http module option +if node['disableHttp'] + http_option = "#--module=http" +else + http_option = "--module=http" +end + + +bash "create-jetty-modules" do +cwd "#{ENV['JETTY_BASE']}" +code <<-EOH + cd "#{ENV['JETTY_BASE']}" + java -jar "#{ENV['JETTY_HOME']}"/start.jar --add-to-start=deploy + java -jar "#{ENV['JETTY_HOME']}"/start.jar --create-startd --add-to-start=http,https,console-capture,setuid +EOH +end + + +template "http-ini" do + path "#{ENV['JETTY_BASE']}/start.d/http.ini" + source "http-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :http_option => http_option , + :http_port => "#{node['BE'][:http_port]}" + }) + +end + + +template "https-ini" do + path "#{ENV['JETTY_BASE']}/start.d/https.ini" + source "https-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables :https_port => "#{node['BE'][:https_port]}" +end + + +template "ssl-ini" do + path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" + source "ssl-ini.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :https_port => "#{node['BE'][:https_port]}" , + :jetty_keystore_pwd => "#{node['jetty'][:keystore_pwd]}" , + :jetty_keymanager_pwd => "#{node['jetty'][:keymanager_pwd]}" , + :jetty_truststore_pwd => "#{node['jetty'][:truststore_pwd]}" + }) +end diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb new file mode 100644 index 0000000000..7a2f24e57a --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_5_setup_elasticsearch.rb @@ -0,0 +1,21 @@ +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" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :cluster_name => "#{clusterName}", + :es_host_ip => "#{elasticsearch_list}" + }) +end diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb new file mode 100644 index 0000000000..4f9993848a --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_6_setup_portal_and_key_properties.rb @@ -0,0 +1,25 @@ +template "template portal.properties" do + path "#{ENV['JETTY_BASE']}/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'], + :ecomp_portal_user => node['ECompP']['portal_user'], + :ecomp_portal_pass => node['ECompP']['portal_pass'], + :portal_app_name => node['ECompP']['portal_app_name'], + }) +end + +template "template key.properties" do + path "#{ENV['JETTY_BASE']}/resources/key.properties" + source "BE-key.properties.erb" + owner "jetty" + group "jetty" + mode "0755" + variables ({ + :cipher_key => node['ECompP']['cipher_key'] + }) +end
\ No newline at end of file diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb new file mode 100644 index 0000000000..7d95d7448e --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_7_logback.rb @@ -0,0 +1,8 @@ +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/logback.xml" do + source "logback.xml" + mode 0644 + owner "jetty" + group "jetty" + action :create_if_missing +end + diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb new file mode 100644 index 0000000000..b100356d98 --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_8_errors_config.rb @@ -0,0 +1,16 @@ +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/ecomp-error-configuration.yaml" do + source "ecomp-error-configuration.yaml" + mode 0644 + owner "jetty" + group "jetty" + action :create_if_missing +end + +cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/error-configuration.yaml" do + source "error-configuration.yaml" + mode 0644 + owner "jetty" + group "jetty" + action :create_if_missing +end + diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb new file mode 100644 index 0000000000..81e1a855f4 --- /dev/null +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb @@ -0,0 +1,17 @@ +if node[:disableHttp] + protocol = "https" + port = "#{node['BE'][:https_port]}" +else + protocol = "http" + port = "#{node['BE'][:http_port]}" +end + +template "/var/lib/jetty/ready-probe.sh" do + source "ready-probe.sh.erb" + sensitive true + mode 0755 + variables({ + :protocol => protocol, + :port => port + }) +end |