diff options
Diffstat (limited to 'docker')
-rw-r--r-- | docker/docker_be/Dockerfile | 24 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/README.md (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/README.md) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb) | 3 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12 (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12) | bin | 4051 -> 4051 bytes | |||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks) | bin | 1413 -> 1413 bytes | |||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb) | 48 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb) | 38 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb | 97 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb (renamed from docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb) | 0 | ||||
-rw-r--r-- | docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.gitignore | 20 | ||||
-rw-r--r-- | docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml | 16 | ||||
-rw-r--r-- | docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/metadata.rb | 7 | ||||
-rw-r--r-- | docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb | 90 | ||||
-rwxr-xr-x | docker/docker_be/set_user.sh | 20 | ||||
-rw-r--r-- | docker/docker_be/startup.sh | 16 | ||||
-rw-r--r-- | docker/docker_tools/startup.sh | 2 | ||||
-rwxr-xr-x | docker/scripts/docker_run.sh | 30 |
26 files changed, 177 insertions, 234 deletions
diff --git a/docker/docker_be/Dockerfile b/docker/docker_be/Dockerfile index ae6826c..c9eccf6 100644 --- a/docker/docker_be/Dockerfile +++ b/docker/docker_be/Dockerfile @@ -1,25 +1,17 @@ -FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest +FROM onap/base_sdc-jetty:1.4.1 -COPY chef-solo /var/opt/dcae-be/chef-solo/ +COPY chef-solo /root/chef-solo/ -COPY startup.sh /var/opt/dcae-be/ +COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ -ADD target/dcae.war ${JETTY_BASE}/webapps/ +ADD --chown=jetty:jetty target/dcae.war ${JETTY_BASE}/webapps/ USER root -COPY set_user.sh /tmp/set_user.sh +RUN apk add --no-cache python -RUN sh -x /tmp/set_user.sh && rm -f /tmp/set_user.sh +COPY startup.sh /root/ -RUN mkdir -p /opt/logs/be +RUN chmod 770 /root/startup.sh -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/opt/dcae-be /opt/logs /var/lib/jetty - -RUN chmod 770 /var/opt/dcae-be/startup.sh - -EXPOSE 8082 8444 - -USER jetty - -ENTRYPOINT [ "/var/opt/dcae-be/startup.sh" ] +ENTRYPOINT [ "/root/startup.sh" ] diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/README.md b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/README.md index 5d1fd04..5d1fd04 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/README.md +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/README.md diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb index 921fde1..af6ad1e 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb @@ -12,7 +12,8 @@ default['DCAE']['TOSCA_LAB']['http_port'] = 8085 default['SDC']['BE']['http_port'] = 8080 default['SDC']['BE']['https_port'] = 8443 default['DCAE']['TOSCA_LAB']['https_port'] = 8085 - +# TO CHANGE THE TRUSTSTORE CERT THE JVM CONFIGURATION +# MUST BE ALSO CHANGE IN THE startup.sh FILE default['jetty']['keystore_pwd'] = "rTIS;B4kM]2GHcNK2c3B4&Ng" default['jetty']['keymanager_pwd'] = "rTIS;B4kM]2GHcNK2c3B4&Ng" default['jetty']['truststore_pwd'] = "Y,f975ZNJfVZhV*{+Y[}pA?0" diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json index 9c3ad36..9c3ad36 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v4.1.json diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json index 3fd8138..3fd8138 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/CommonEventFormat_v5.3.json diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml index 7c0bfb6..7c0bfb6 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/logback-spring.xml diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12 b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12 Binary files differindex ee000dc..ee000dc 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12 +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.p12 diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks Binary files differindex 342c4f2..342c4f2 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb index b6edb82..b6edb82 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/consumer_creation.rb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb index dc9dfda..94ce0df 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_setup.rb @@ -1,6 +1,3 @@ -jetty_base = "#{node['JETTY_BASE']}" -dcae_logs = "#{node['APP_LOG_DIR']}" - sdc_be_vip = node['BE_VIP'] dcae_tosca_lab_vip = node['DCAE_TOSCA_LAB_VIP'] @@ -17,11 +14,21 @@ else dcae_tosca_lab_port = node['DCAE']['TOSCA_LAB']['http_port'] end -printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], sdc_be_vip=[%s], sdc_be_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, sdc_be_vip ,sdc_be_port ) +printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], sdc_be_vip=[%s], sdc_be_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, sdc_be_vip ,sdc_be_port ) raise "[ERROR] 'SDC_BE_FQDN' is not defined" if sdc_be_vip.nil? || sdc_be_vip == "" -directory "#{jetty_base}/config" do + +directory "DCAE BE_tempdir_creation" do + path "#{ENV['JETTY_BASE']}/temp" + owner 'jetty' + group 'jetty' + mode '0755' + action :create +end + + +directory "#{ENV['JETTY_BASE']}/config" do owner "jetty" group "jetty" mode '0755' @@ -29,7 +36,8 @@ directory "#{jetty_base}/config" do action :create end -directory "#{jetty_base}/config/dcae-be" do + +directory "#{ENV['JETTY_BASE']}/config/dcae-be" do owner "jetty" group "jetty" mode '0755' @@ -37,7 +45,8 @@ directory "#{jetty_base}/config/dcae-be" do action :create end -directory "#{jetty_base}/config/dcae-be/ves-schema" do + +directory "#{ENV['JETTY_BASE']}/config/dcae-be/ves-schema" do owner "jetty" group "jetty" mode '0755' @@ -45,14 +54,15 @@ directory "#{jetty_base}/config/dcae-be/ves-schema" do action :create end + template "dcae-be-config" do sensitive true - path "#{jetty_base}/config/dcae-be/application.properties" + path "#{ENV['JETTY_BASE']}/config/dcae-be/application.properties" source "dcae-application.properties.erb" owner "jetty" group "jetty" mode "0755" - variables ({ + variables({ :consumerAuth => node['DCAE']['consumerName'] + ":" + node['DCAE']['consumerPass'] , :dcae_be_port => dcae_be_port, :sdc_be_vip => sdc_be_vip, @@ -63,42 +73,38 @@ template "dcae-be-config" do }) end -cookbook_file "#{jetty_base}/config/dcae-be/ves-schema/CommonEventFormat_v4.1.json" do + +cookbook_file "#{ENV['JETTY_BASE']}/config/dcae-be/ves-schema/CommonEventFormat_v4.1.json" do source "CommonEventFormat_v4.1.json" owner "jetty" group "jetty" mode 0755 end -cookbook_file "#{jetty_base}/config/dcae-be/ves-schema/CommonEventFormat_v5.3.json" do + +cookbook_file "#{ENV['JETTY_BASE']}/config/dcae-be/ves-schema/CommonEventFormat_v5.3.json" do source "CommonEventFormat_v5.3.json" owner "jetty" group "jetty" mode 0755 end + template "dcae-error-configuration" do sensitive true - path "#{jetty_base}/config/dcae-be/error-configuration.yaml" + path "#{ENV['JETTY_BASE']}/config/dcae-be/error-configuration.yaml" source "dcae-error-configuration.erb" owner "jetty" group "jetty" mode "0755" end + template "dcae-logback-spring-config" do sensitive true - path "#{jetty_base}/config/dcae-be/logback-spring.xml" + path "#{ENV['JETTY_BASE']}/config/dcae-be/logback-spring.xml" source "dcae-logback-spring.erb" owner "jetty" group "jetty" mode "0755" end - -directory "#{dcae_logs}" do - owner "jetty" - group "jetty" - mode '0755' - recursive true - action :create -end
\ No newline at end of file diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb index 43919ed..36f6853 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/recipes/jetty_setup.rb @@ -1,6 +1,3 @@ -jetty_base = "#{node['JETTY_BASE']}" -jetty_home = "#{node['JETTY_HOME']}" - #Set the http module option if node['disableHttp'] http_option = "#--module=http" @@ -13,7 +10,7 @@ printf("DEBUG: [%s]:[%s] disableHttp=[%s], http_option=[%s] !!! \n", cookbook_na directory "Jetty_etcdir_creation" do - path "/#{jetty_base}/etc" + path "#{ENV['JETTY_BASE']}/etc" owner 'jetty' group 'jetty' mode '0755' @@ -21,66 +18,67 @@ directory "Jetty_etcdir_creation" do end -# Create Keystore -cookbook_file "/#{jetty_base}/etc/org.onap.sdc.p12" do +cookbook_file "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.p12" do source "org.onap.sdc.p12" owner "jetty" group "jetty" mode 0755 end -# Create Truststore -cookbook_file "/#{jetty_base}/etc/org.onap.sdc.trust.jks" do + +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 + bash "create-jetty-modules" do - cwd "#{jetty_base}" + cwd "#{ENV['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 + cd "#{ENV['JETTY_BASE']}" + java -jar "/#{ENV['JETTY_HOME']}"/start.jar --add-to-start=deploy + java -jar "/#{ENV['JETTY_HOME']}"/start.jar --add-to-startd=http,https,console-capture,setuid EOH end -# configure Jetty modules + template "http-ini" do - path "/#{jetty_base}/start.d/http.ini" + path "#{ENV['JETTY_BASE']}/start.d/http.ini" source "http-ini.erb" owner "jetty" group "jetty" mode "0755" - variables ({ + variables({ :http_option => http_option , :http_port => "#{node['DCAE']['BE'][:http_port]}" }) end + template "https-ini" do - path "/#{jetty_base}/start.d/https.ini" + path "#{ENV['JETTY_BASE']}/start.d/https.ini" source "https-ini.erb" owner "jetty" group "jetty" mode "0755" - variables ({ + variables({ :https_port => "#{node['DCAE']['BE'][:https_port]}" }) end + template "ssl-ini" do - path "/#{jetty_base}/start.d/ssl.ini" + path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" source "ssl-ini.erb" owner "jetty" group "jetty" mode "0755" - variables ({ + variables({ :https_port => "#{node['DCAE']['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/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb new file mode 100644 index 0000000..c6b412c --- /dev/null +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb @@ -0,0 +1,97 @@ +#!/usr/bin/python +import sys +import subprocess +#from time import sleep +import time +from datetime import datetime + + +class BColors: + HEADER = '\033[95m' + OKBLUE = '\033[94m' + OKGREEN = '\033[92m' + WARNING = '\033[93m' + FAIL = '\033[91m' + ENDC = '\033[0m' + BOLD = '\033[1m' + UNDERLINE = '\033[4m' + + +############################## +# Functions +############################## +def check_backend(): + command="curl -s -k --cacert org.onap.sdc.key -o /dev/null -I -w \"%{http_code}\" " \ + "-i <%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/user/jh0003" + + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + (out, err) = proc.communicate() + result = out.strip() + return result + + +def check_consumer(consumer_name): + command="curl -s -k --cacert org.onap.sdc.key -o /dev/null -I -w \"%{http_code}\" -i -H " \ + "\"Accept: application/json; charset=UTF-8\" " \ + "-H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" " \ + "\"<%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/consumers/" + consumer_name + + proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE) + (out, err) = proc.communicate() + result = out.strip() + return result + + +def create_consumer(consumerName, consumerSalt, consumerPass): + print '[INFO] ' + consumerName + command="curl -s -k --cacert org.onap.sdc.key -o /dev/null -w \"%{http_code}\" -X POST -i -H " \ + "\"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" " \ + "<%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/consumers/ " \ + "-d '{\"consumerName\": '" + consumerName + "', \"consumerSalt\": '" \ + + consumerSalt + "',\"consumerPassword\": '" + consumerPass + "'}'" + + proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE) + (out, err) = proc.communicate() + result = out.strip() + return result + + +############################## +# Definitions +############################## +consumers_list = ["<%= @consumerName %>"] +salt = "67fbde1c142bb25c7d6086252d6ab08d" +password = "d6e61a6859456cf4ded84f641ae59301ebf19d56cd5fc8a8f15b7cc54d3b6429" +beStat=0 + + +############################## +# Main +############################## + +for i in range(1,10): + my_result = check_backend() + if my_result == '200': + print '[INFO]: SDC Backend is up and running' + beStat=1 + break + else: + currentTime = datetime.now() + print '[ERROR]: ' + currentTime.strftime('%Y/%m/%d %H:%M:%S') + BColors.FAIL + \ + ' SDC Backend not responding, try #' + str(i) + BColors.ENDC + time.sleep(10) + +if beStat == 0: + print '[ERROR]: ' + time.strftime('%Y/%m/%d %H:%M:%S') + BColors.FAIL + 'SDC Backend is DOWN :-(' + BColors.ENDC + sys.exit(0) + +for consumer in consumers_list: + my_result = check_consumer(consumer) + if my_result == '200': + print '[INFO]: ' + consumer + ' already exists' + else: + my_result = create_consumer(consumer, salt, password) + if my_result == '201': + print '[INFO]: ' + consumer + ' created, result: [' + my_result + ']' + else: + print '[ERROR]: ' + BColors.FAIL + consumer + BColors.ENDC + ' error creating , result: [' + my_result + ']' diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb index ecfa0bc..ecfa0bc 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-application.properties.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb index d1fab01..d1fab01 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-error-configuration.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb index 7c0bfb6..7c0bfb6 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/dcae-logback-spring.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb index 8f26690..8f26690 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/http-ini.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb index 9999a41..9999a41 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/https-ini.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb index 278fdea..278fdea 100644 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb +++ b/docker/docker_be/chef-repo/cookbooks/Deploy-DCAE/templates/default/ssl-ini.erb diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.gitignore b/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.gitignore deleted file mode 100644 index b31c0d3..0000000 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -.vagrant -Berksfile.lock -*~ -*# -.#* -\#*# -.*.sw[a-z] -*.un~ - -# Bundler -Gemfile.lock -bin/* -.bundle/* - -.kitchen/ -.kitchen.local.yml - -######### Private -run.me -DCAE-CI01.json diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml b/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml deleted file mode 100644 index 37d2844..0000000 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml +++ /dev/null @@ -1,16 +0,0 @@ ---- -driver: - name: vagrant - -provisioner: - name: chef_zero - -platforms: - - name: ubuntu-16.04 - - name: centos-7.1 - -suites: - - name: default - run_list: - - recipe[Deploy-DCAE::default] - attributes: diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/metadata.rb b/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/metadata.rb deleted file mode 100644 index 7935c22..0000000 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/metadata.rb +++ /dev/null @@ -1,7 +0,0 @@ -name 'Deploy-DCAE' -maintainer 'The Authors' -maintainer_email 'you@example.com' -license 'all_rights' -description 'Installs/Configures Deploy-DCAE' -long_description 'Installs/Configures Deploy-DCAE' -version '1.0.0' diff --git a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb b/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb deleted file mode 100644 index ca58bc6..0000000 --- a/docker/docker_be/chef-solo/cookbooks/Deploy-DCAE/templates/default/consumers.py.erb +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/python -import sys -import subprocess -#from time import sleep -import time -from datetime import datetime - -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - BOLD = '\033[1m' - UNDERLINE = '\033[4m' - - -############################## -# Functions -############################## -def checkBackend(): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i <%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/user/jh0003" - - proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) - (out, err) = proc.communicate() - result = out.strip() - return result - - -def checkConsumer(consumerName): - command="curl -s -o /dev/null -I -w \"%{http_code}\" -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" <%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/consumers/" + consumerName - - proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE ) - (out, err) = proc.communicate() - result = out.strip() - return result - - -def createConsumer( consumerName, consumerSalt, consumerPass ): - print '[INFO] ' + consumerName - command="curl -s -o /dev/null -w \"%{http_code}\" -X POST -i -H \"Accept: application/json; charset=UTF-8\" -H \"Content-Type: application/json\" -H \"USER_ID: jh0003\" <%= @protocol %>://<%= @catalog_ip %>:<%= @catalog_port %>/sdc2/rest/v1/consumers/ -d '{\"consumerName\": '" + consumerName + "', \"consumerSalt\": '" + consumerSalt + "',\"consumerPassword\": '" + consumerPass + "'}'" - - proc = subprocess.Popen( command , shell=True , stdout=subprocess.PIPE) - - (out, err) = proc.communicate() - result = out.strip() - return result - - - - -############################## -# Definitions -############################## -consumersList = [ "<%= @consumerName %>" ] -salt = "67fbde1c142bb25c7d6086252d6ab08d" -password = "d6e61a6859456cf4ded84f641ae59301ebf19d56cd5fc8a8f15b7cc54d3b6429" -beStat=0 - - -############################## -# Main -############################## - -for i in range(1,10): - myResult = checkBackend() - if myResult == '200': - print '[INFO]: SDC Backend is up and running' - beStat=1 - break - else: - currentTime = datetime.now() - print '[ERROR]: ' + currentTime.strftime('%Y/%m/%d %H:%M:%S') + bcolors.FAIL + ' SDC Backend not responding, try #' + str(i) + bcolors.ENDC - time.sleep(10) - -if beStat == 0: - print '[ERROR]: ' + time.strftime('%Y/%m/%d %H:%M:%S') + bcolors.FAIL + 'SDC Backend is DOWN :-(' + bcolors.ENDC - sys.exit(0) - -for consumer in consumersList: - myResult = checkConsumer(consumer) - if myResult == '200': - print '[INFO]: ' + consumer + ' already exists' - else: - myResult = createConsumer( consumer, salt, password ) - if myResult == '201': - print '[INFO]: ' + consumer + ' created, result: [' + myResult + ']' - else: - print '[ERROR]: ' + bcolors.FAIL + consumer + bcolors.ENDC + ' error creating , result: [' + myResult + ']' diff --git a/docker/docker_be/set_user.sh b/docker/docker_be/set_user.sh deleted file mode 100755 index 6233c07..0000000 --- a/docker/docker_be/set_user.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# Create user - -USER="jetty" -GROUP="jetty" -UID="352070" -GID="35953" - -# Remove user: -deluser ${USER} - -delgroup ${GROUP} - -echo "${USER}:x:${UID}:${GID}::/home/${USER}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd - -echo "${GROUP}:x:${GID}:${USER}" >> /etc/group - -echo "${USER}:!:17501:0:99999:7:::" >> /etc/shadow - -mkdir /home/${USER} && chown ${USER}:${GROUP} /home/${USER}
\ No newline at end of file diff --git a/docker/docker_be/startup.sh b/docker/docker_be/startup.sh index e1c9eb9..60ba309 100644 --- a/docker/docker_be/startup.sh +++ b/docker/docker_be/startup.sh @@ -1,17 +1,21 @@ #!/bin/sh -set -x -# Run chef-solo for configuration -cd /var/opt/dcae-be/chef-solo -chef-solo -c solo.rb -E ${ENVNAME} --log_level "debug" --logfile "/tmp/Chef-Solo.log" +JAVA_OPTIONS=" ${JAVA_OPTIONS} -Dconfig.home=${JETTY_BASE}/config \ + -Dlog.home=${JETTY_BASE}/logs \ + -Dlogback.configurationFile=${JETTY_BASE}/dcae-be/logback-spring.xml + -Djavax.net.ssl.trustStore=${JETTY_BASE}/etc/org.onap.sdc.trust.jks \ + -Djavax.net.ssl.trustStorePassword=Y,f975ZNJfVZhV*{+Y[}pA?0 \ + -Djetty.console-capture.dir=${JETTY_BASE}/logs" + +cd /root/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} status=$? -if [ $status != 0 ]; then +if [[ ${status} != 0 ]]; then echo "[ERROR] Problem detected while running chef. Aborting !" exit 1 fi -# Execute Jetty cd /var/lib/jetty /docker-entrypoint.sh & diff --git a/docker/docker_tools/startup.sh b/docker/docker_tools/startup.sh index c8f5132..a158317 100644 --- a/docker/docker_tools/startup.sh +++ b/docker/docker_tools/startup.sh @@ -5,7 +5,7 @@ cd /var/opt/dcae-tools/chef-solo chef-solo -c solo.rb -E ${ENVNAME} --log_level "debug" --logfile "/tmp/Chef-Solo.log" status=$? -if [ $status != 0 ]; then +if [[ ${status} != 0 ]]; then echo "[ERROR] Problem detected while running chef. Aborting !" exit 1 fi diff --git a/docker/scripts/docker_run.sh b/docker/scripts/docker_run.sh index bb67234..af322bd 100755 --- a/docker/scripts/docker_run.sh +++ b/docker/scripts/docker_run.sh @@ -15,10 +15,7 @@ DEP_ENV="AUTO" # Java Options: -DCAE_BE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-be/logback-spring.xml" -DCAE_FE_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-fe/logback-spring.xml" -DCAE_DT_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m -Dconfig.home=config -Dlog.home=/var/lib/jetty/logs/ -Dlogging.config=config/dcae-dt/logback-spring.xml" -DCAE_TOSCA_JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m" +JAVA_OPTIONS="-XX:MaxPermSize=256m -Xmx1024m" #Define this as variable, so it can be excluded in run commands on Docker for OSX, as /etc/localtime cant be mounted there. @@ -111,7 +108,7 @@ function probe_docker { # function probe_dcae_tosca { - health_check_http_code=$(curl --noproxy "*" -i -o /dev/null -w '%{http_code}' "http://${IP}:8085/healthcheck") + health_check_http_code=$(curl --noproxy "*" -k -i -o /dev/null -w '%{http_code}' "http://${IP}:8085/healthcheck") if [[ "${health_check_http_code}" -eq 200 ]] ; then echo "DOCKER start finished in $1 seconds" return ${SUCCESS} @@ -120,8 +117,9 @@ function probe_dcae_tosca { } # +# probe script used the secure connection to do health check (https is always turn on) function probe_dcae_be { - health_check_http_code=$(curl --noproxy "*" -i -o /dev/null -w '%{http_code}' "http://${IP}:8082/dcae/conf/composition") + health_check_http_code=$(curl --noproxy "*" -k -i -o /dev/null -w '%{http_code}' "https://${IP}:8444/dcae/conf/composition") if [[ "${health_check_http_code}" -eq 200 ]] ; then echo "DOCKER start finished in $1 seconds" return ${SUCCESS} @@ -131,7 +129,7 @@ function probe_dcae_be { # function probe_dcae_fe { - health_check_http_code=$(curl --noproxy "*" -i -o /dev/null -w '%{http_code}' "http://${IP}:8183/dcaed/healthCheck") + health_check_http_code=$(curl --noproxy "*" -k -i -o /dev/null -w '%{http_code}' "https://${IP}:9444/dcaed/healthCheck") if [[ "${health_check_http_code}" -eq 200 ]] ; then echo "DOCKER start finished in $1 seconds" return ${SUCCESS} @@ -141,7 +139,7 @@ function probe_dcae_fe { # function probe_dcae_dt { - health_check_http_code=$(curl --noproxy "*" -i -o /dev/null -w '%{http_code}' "http://${IP}:8186/dcae/healthCheckOld") + health_check_http_code=$(curl --noproxy "*" -k -i -o /dev/null -w '%{http_code}' "https://${IP}:9446/dcae/healthCheckOld") if [[ "${health_check_http_code}" -eq 200 ]] ; then echo "DOCKER start finished in $1 seconds" return ${SUCCESS} @@ -152,7 +150,7 @@ function probe_dcae_dt { # Not applicable for current release. Return Success in any case function probe_dcae_tools { - health_check_http_code=$(curl --noproxy "*" -i -o /dev/null -w '%{http_code}' "http://${IP}:8082/dcae/getResourcesByMonitoringTemplateCategory") + health_check_http_code=$(curl --noproxy "*" -k -i -o /dev/null -w '%{http_code}' "https://${IP}:8444/dcae/getResourcesByMonitoringTemplateCategory") if [[ "${health_check_http_code}" -eq 200 ]] ; then echo "DOCKER start finished in $1 seconds" return ${SUCCESS} @@ -218,16 +216,16 @@ function monitor_docker { } # - +# healthCheck script used the secure connection to send request (https is always turn on) function healthCheck { echo "BE health-Check:" - curl --noproxy "*" "http://${IP}:8080/sdc2/rest/healthCheck" + curl -k --noproxy "*" "https://${IP}:8443/sdc2/rest/healthCheck" echo "" echo "" echo "FE health-Check:" - curl --noproxy "*" "http://${IP}:8181/sdc1/rest/healthCheck" + curl -k --noproxy "*" "https://${IP}:9443/sdc1/rest/healthCheck" } # @@ -254,7 +252,7 @@ function dcae-tosca { if [ ${LOCAL} == false ]; then docker pull "${PREFIX}/${DOCKER_NAME}:${RELEASE}" fi - docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_TOSCA_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-TOSCA/:/var/logs/dcae" --publish 8085:8085 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" + docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-TOSCA/:/var/logs/dcae" --publish 8085:8085 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" command_exit_status $? ${DOCKER_NAME} echo "please wait while ${DOCKER_NAME^^} is starting....." monitor_docker ${DOCKER_NAME} @@ -269,7 +267,7 @@ function dcae-be { if [ ${LOCAL} == false ]; then docker pull "${PREFIX}/${DOCKER_NAME}:${RELEASE}" fi - docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-BE/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/var/opt/dcae-be/chef-solo/environments" --publish 8444:8444 --publish 8082:8082 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh + docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-BE/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/root/chef-solo/environments" --publish 8444:8444 --publish 8082:8082 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh command_exit_status $? ${DOCKER_NAME} echo "please wait while ${DOCKER_NAME^^} is starting....." monitor_docker ${DOCKER_NAME} @@ -299,7 +297,7 @@ function dcae-fe { if [ ${LOCAL} == false ]; then docker pull "${PREFIX}/${DOCKER_NAME}:${RELEASE}" fi - docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_FE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-FE/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/var/opt/dcae-fe/chef-solo/environments/" --publish 9444:9444 --publish 8183:8183 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh + docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-FE/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/root/chef-solo/environments" --publish 9444:9444 --publish 8183:8183 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh command_exit_status $? ${DOCKER_NAME} echo "please wait while ${DOCKER_NAME^^} is starting....." monitor_docker ${DOCKER_NAME} @@ -313,7 +311,7 @@ function dcae-dt { if [ ${LOCAL} == false ]; then docker pull "${PREFIX}/${DOCKER_NAME}:${RELEASE}" fi - docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${DCAE_DT_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-DT/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/var/opt/dcae-dt/chef-solo/environments/" --publish 9446:9446 --publish 8186:8186 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh + docker run ${DOCKER_RUN_MODE_FG} --name ${DOCKER_NAME} --env HOST_IP="${IP}" --env ENVNAME="${DEP_ENV}" --env JAVA_OPTIONS="${JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume "${WORKSPACE}/data/logs/DCAE-DT/:/var/lib/jetty/logs" --volume "${WORKSPACE}/data/environments:/root/chef-solo/environments/" --publish 9446:9446 --publish 8186:8186 "${PREFIX}/${DOCKER_NAME}:${RELEASE}" /bin/sh command_exit_status $? ${DOCKER_NAME} echo "please wait while ${DOCKER_NAME^^} is starting....." monitor_docker ${DOCKER_NAME} |