summaryrefslogtreecommitdiffstats
path: root/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2020-05-14 16:09:22 +0100
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-05-24 10:11:25 +0000
commitfcbf6d2541c6d033e4979784ce2373f0c5db3932 (patch)
treeffbc0b8f7e4354cbe83b00ad6d1d5550116db053 /catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be
parentc8f88d9b496e8f10179bfc26a09a27386d156d47 (diff)
Support setting SDC-BE configuration at deployment time
Change-Id: Id1ebcb01d81b8e0cd681dcb304aa77bb3248d69c Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3076
Diffstat (limited to 'catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be')
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb43
-rw-r--r--catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_2_setup_configuration.rb110
2 files changed, 77 insertions, 76 deletions
diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb
index 1de29548f3..7ca3db813f 100644
--- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb
+++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_1_cleanup_jettydir.rb
@@ -1,24 +1,29 @@
-directory "BE_tempdir_creation" do
- path "#{ENV['JETTY_BASE']}/temp"
- owner 'jetty'
- group 'jetty'
- mode '0755'
- action :create
+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
-directory "BE_create_config_dir" do
- path "#{ENV['JETTY_BASE']}/config"
- owner 'jetty'
- group 'jetty'
- mode '0755'
- action :create
+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
-
-directory "BE_create_catalog-be" do
- path "#{ENV['JETTY_BASE']}/config/catalog-be"
- owner 'jetty'
- group 'jetty'
- mode '0755'
- action :create
+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/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 3ec26cf2dd..ab63712f97 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
@@ -1,75 +1,71 @@
# Set the cassandra replica number
-replication_factor=node['cassandra']['replication_factor']
+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
+ 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
+ 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
+ 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 "0755"
- 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']}"
- })
+ path "#{ENV['JETTY_BASE']}/config/catalog-be/janusgraph.properties"
+ source "BE-janusgraph.properties.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ 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 "0755"
- 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']
- })
+ path "#{ENV['JETTY_BASE']}/config/catalog-be/configuration.yaml"
+ source "BE-configuration.yaml.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ 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 "0755"
+ path "#{ENV['JETTY_BASE']}/config/catalog-be/distribution-engine-configuration.yaml"
+ source "BE-distribution-engine-configuration.yaml.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
end
-