Fully HTTPS support in the dcaedt-tools
Fully HTTPS support:
-Updated the onap/base_sdc-jetty docker image version
-Updated the chef script to properly used of the new docker image
-Updated jvm configuration to support call to
the SDC components using HTTPS.
-Added buildRestClient method to create the DcaeRestClient
supporting the SSL connection
-Checkstyle in the recipes adn tools.Main method
-Update the docker_run.sh:
- Change JAVA_OPTIONS
-Update docker_run script
-Add proper dependency in the pom (waiting for solving the SDC-2554 bug)
Issue-ID: SDC-2552
Signed-off-by: Krystian Kedron <k.kedron@partner.samsung.com>
Change-Id: Ie8dd1f54619f1101c13de13ae3cbb296bba57210
diff --git a/docker/docker_tools/Dockerfile b/docker/docker_tools/Dockerfile
index 4a36f7d..d80d62b 100644
--- a/docker/docker_tools/Dockerfile
+++ b/docker/docker_tools/Dockerfile
@@ -1,20 +1,17 @@
-FROM onap/base_sdc-jetty:1.2.0-SNAPSHOT-latest
+FROM onap/base_sdc-jetty:1.4.1
+
+COPY chef-solo /root/chef-solo/
+
+COPY chef-repo/cookbooks /root/chef-solo/cookbooks/
+
+ADD --chown=jetty:jetty target/dcaedt_tools-*.jar ${JETTY_BASE}/webapps/dcaedt_tools.jar
USER root
-RUN adduser -h /home/dcae -s /bin/sh -D dcae
+RUN apk add --no-cache python
-COPY target/dcaedt_tools-*.jar /var/opt/dcae-tools/app/dcaedt_tools.jar
+COPY startup.sh /root/
-COPY chef-solo /var/opt/dcae-tools/chef-solo/
+RUN chmod 770 /root/startup.sh
-COPY startup.sh /var/opt/dcae-tools
-
-RUN chmod 775 /var/opt/dcae-tools/startup.sh
-
-RUN chown -R dcae /var/opt/dcae-tools
-
-USER dcae
-
-ENTRYPOINT [ "/var/opt/dcae-tools/startup.sh" ]
-
+ENTRYPOINT [ "/root/startup.sh" ]
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/README.md
similarity index 100%
rename from docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/README.md
rename to docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/README.md
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb
similarity index 67%
rename from docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb
rename to docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb
index b774969..250947e 100644
--- a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/attributes/default.rb
+++ b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/attributes/default.rb
@@ -1,7 +1,4 @@
-default['WORKSPACE_DIR'] = "/var/opt/dcae-tools/app"
-
default['DCAE']['BE'][:http_port] = 8082
default['DCAE']['BE'][:https_port] = 8444
default['disableHttp'] = true
-
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/files/default/config.json
similarity index 100%
rename from docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/files/default/config.json
rename to docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/files/default/config.json
diff --git a/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks
new file mode 100755
index 0000000..077a7f3
--- /dev/null
+++ b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/files/default/org.onap.sdc.trust.jks
Binary files differ
diff --git a/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
new file mode 100644
index 0000000..a989201
--- /dev/null
+++ b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
@@ -0,0 +1,61 @@
+dcae_be_host = node['DCAE_BE_VIP']
+
+if node['disableHttp']
+ protocol = "https"
+ dcae_be_port = node['DCAE']['BE'][:https_port]
+else
+ protocol = "http"
+ dcae_be_port = node['DCAE']['BE'][:http_port]
+end
+
+printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], dcae_be_vip=[%s], dcae_be_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, dcae_be_host ,dcae_be_port )
+
+directory "Jetty_etc dir_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.trust.jks" do
+ source "org.onap.sdc.trust.jks"
+ owner "jetty"
+ group "jetty"
+ mode 0755
+end
+
+
+directory "#{ENV['JETTY_BASE']}/conf" do
+ mode '0755'
+ owner "jetty"
+ group "jetty"
+ recursive true
+ action :create
+end
+
+
+template "dcae-tools-config-yaml" do
+ sensitive true
+ path "/#{ENV['JETTY_BASE']}/conf/environment.json"
+ source "environment.json.erb"
+ mode "0755"
+ owner "jetty"
+ group "jetty"
+ variables({
+ :dcae_be_host => dcae_be_host,
+ :dcae_be_port => dcae_be_port,
+ :protocol => protocol
+ })
+end
+
+
+cookbook_file "/#{ENV['JETTY_BASE']}/conf/config.json" do
+ sensitive true
+ source "config.json"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ action :create
+end
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb b/docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb
similarity index 100%
rename from docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb
rename to docker/docker_tools/chef-repo/cookbooks/Deploy-DCAE/templates/default/environment.json.erb
diff --git a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.gitignore
deleted file mode 100644
index b31c0d3..0000000
--- a/docker/docker_tools/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_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/.kitchen.yml
deleted file mode 100644
index 37d2844..0000000
--- a/docker/docker_tools/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_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/metadata.rb
deleted file mode 100644
index 7935c22..0000000
--- a/docker/docker_tools/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_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb b/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
deleted file mode 100644
index 152def2..0000000
--- a/docker/docker_tools/chef-solo/cookbooks/Deploy-DCAE/recipes/dcae_tools_setup.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-workspace_dir = "#{node['WORKSPACE_DIR']}"
-
-dcae_be_host = node['DCAE_BE_VIP']
-
-if node['disableHttp']
- protocol = "https"
- dcae_be_port = node['DCAE']['BE'][:https_port]
-else
- protocol = "http"
- dcae_be_port = node['DCAE']['BE'][:http_port]
-end
-
-printf("DEBUG: [%s]:[%s] disableHttp=[%s], protocol=[%s], dcae_be_vip=[%s], dcae_be_port=[%s] !!! \n", cookbook_name, recipe_name, node['disableHttp'], protocol, dcae_be_host ,dcae_be_port )
-
-
-directory "#{workspace_dir}/conf" do
- mode '0755'
- owner "dcae"
- group "dcae"
- recursive true
- action :create
-end
-
-
-template "dcae-tools-config-yaml" do
- sensitive true
- path "/#{workspace_dir}/conf/environment.json"
- source "environment.json.erb"
- mode "0755"
- owner "dcae"
- group "dcae"
- variables ({
- :dcae_be_host => dcae_be_host,
- :dcae_be_port => dcae_be_port,
- :protocol => protocol
- })
-end
-
-
-cookbook_file "/#{workspace_dir}/conf/config.json" do
- sensitive true
- source "config.json"
- owner "dcae"
- group "dcae"
- mode "0755"
- action :create
-end
diff --git a/docker/docker_tools/startup.sh b/docker/docker_tools/startup.sh
index a158317..b9c3ea1 100644
--- a/docker/docker_tools/startup.sh
+++ b/docker/docker_tools/startup.sh
@@ -1,8 +1,13 @@
#!/bin/sh
-set -x
-# Run chef-solo for configuration
-cd /var/opt/dcae-tools/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 \
+ -Djetty.console-capture.dir=${JETTY_BASE}/logs \
+ -Djavax.net.ssl.trustStore=${JETTY_BASE}/etc/org.onap.sdc.trust.jks \
+ -Djavax.net.ssl.trustStorePassword=c+QY7@v1bQ!lo0c4ydi)))AV"
+
+cd /root/chef-solo
+chef-solo -c solo.rb -E ${ENVNAME}
status=$?
if [[ ${status} != 0 ]]; then
@@ -10,8 +15,7 @@
exit 1
fi
-# Execute DCAE tools
-cd /var/opt/dcae-tools/app
-java -jar dcaedt_tools.jar conf/environment.json conf/config.json
+cd ${JETTY_BASE}/webapps
+java ${JAVA_OPTIONS} -jar dcaedt_tools.jar ../conf/environment.json ../conf/config.json
exec "$@";
\ No newline at end of file