From c175a0de2f05d37c1c774684318a525eb96bb59b Mon Sep 17 00:00:00 2001 From: Avi Ziv Date: Thu, 15 Mar 2018 13:21:44 +0200 Subject: Create on boarding docker Add BE and Cassandra init docker images Change-Id: Id9d767c73fc946819cec821b4634ce650cbb22fd Issue-ID: SDC-781 Signed-off-by: Michael Lando --- catalog-be/sdc-backend/Dockerfile | 4 ---- .../sdc-catalog-be/recipes/BE_2_setup_configuration.rb | 13 +++++++++++-- .../templates/default/BE-configuration.yaml.erb | 7 +++---- .../sdc-catalog-be/templates/default/ready-probe.sh.erb | 2 +- 4 files changed, 15 insertions(+), 11 deletions(-) (limited to 'catalog-be/sdc-backend') diff --git a/catalog-be/sdc-backend/Dockerfile b/catalog-be/sdc-backend/Dockerfile index 20a4624a49..ed54c8a443 100644 --- a/catalog-be/sdc-backend/Dockerfile +++ b/catalog-be/sdc-backend/Dockerfile @@ -4,12 +4,8 @@ COPY chef-solo /root/chef-solo/ COPY chef-repo/cookbooks/. /root/chef-solo/cookbooks/ -ADD onboarding-be-*.war ${JETTY_BASE}/webapps/ - ADD catalog-be-*.war ${JETTY_BASE}/webapps/ -ADD api-docs.war ${JETTY_BASE}/webapps/ - USER root RUN chown -R jetty:jetty ${JETTY_BASE}/webapps 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 c04b11b815..3bad06f6fb 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,4 +1,13 @@ -replication_factor=1 +# Set the cassandra replica number +cassandra_nodes = node['Nodes']['CS'] +if cassandra_nodes.length <=2 + replication_factor=1 +elsif cassandra_nodes.length >2 && cassandra_nodes.length <=4 + replication_factor=3 +else + replication_factor=4 +end + template "titan.properties" do path "#{ENV['JETTY_BASE']}/config/catalog-be/titan.properties" @@ -30,7 +39,7 @@ template "catalog-be-config" do :catalog_port => node['BE'][:http_port], :ssl_port => node['BE'][:https_port], :cassandra_ip => node['Nodes']['CS'], - :rep_factor => 1, + :rep_factor => replication_factor, :DC_NAME => node['cassandra'][:cluster_name]+node.chef_environment, :titan_Path => "/var/lib/jetty/config/catalog-be/", :socket_connect_timeout => node['cassandra']['socket_connect_timeout'], diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb index a35896afe6..a390a80441 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb @@ -553,14 +553,13 @@ heatEnvArtifactHeader: "" heatEnvArtifactFooter: "" onboarding: + host: <%= node['ONBOARDING_BE_VIP'] %> <% if node[:disableHttp] -%> protocol: https - host: <%= @catalog_ip %> - port: <%= node['BE'][:https_port] %> + port: <%= node['ONBOARDING_BE'][:https_port] %> <% else %> protocol: http - host: <%= @catalog_ip %> - port: <%= node['BE'][:http_port] %> + port: <%= node['ONBOARDING_BE'][:http_port] %> <% end -%> downloadCsarUri: "/onboarding-api/v1.0/vendor-software-products/packages" healthCheckUri: "/onboarding-api/v1.0/healthcheck" diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb index 84d1c6f08f..9da843152c 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb @@ -2,7 +2,7 @@ health_Check_http_code=$(curl --max-time 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:8080/sdc2/rest/healthCheck) if [[ "$health_Check_http_code" -eq 200 ]]; then - exit 200 + exit 0 else exit $health_Check_http_code fi -- cgit 1.2.3-korg