diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-09-21 22:13:05 +0200 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-05-12 10:27:10 +0000 |
commit | df353be353e1ec25ac2a0e64a9eb617dcbc87703 (patch) | |
tree | e79c636bc4f67bdd8392b24c85f2f6cb26e3c67a | |
parent | 936781153118364e60662529dbd7217416a26148 (diff) |
Use integration-java11 Dockerfile
Use onap/integration-java11:7.1.0 as a source for the images requiring JDK 11 in SDC
Issue-ID: SDC-3298
Change-Id: Ifee3d2942dcb9c078f2ebb686bdabc0ecca857b3
Signed-off-by: xuegao <xue.gao@intl.att.com>
103 files changed, 556 insertions, 650 deletions
diff --git a/asdctool/pom.xml b/asdctool/pom.xml index 623d4e6ea8..7161f89ca0 100644 --- a/asdctool/pom.xml +++ b/asdctool/pom.xml @@ -726,6 +726,7 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> diff --git a/asdctool/sdc-cassandra-init/Dockerfile b/asdctool/sdc-cassandra-init/Dockerfile index e35f841984..e5321004b7 100644 --- a/asdctool/sdc-cassandra-init/Dockerfile +++ b/asdctool/sdc-cassandra-init/Dockerfile @@ -16,7 +16,6 @@ RUN apt-get update && apt-get install -y python-pip && \ echo '[cql]' > ~/.cassandra/cqlshrc && \ echo 'version=3.4.4' >> ~/.cassandra/cqlshrc && \ set -ex && \ - pip install cqlsh && \ apt-get install -y \ make \ gcc \ @@ -25,14 +24,12 @@ RUN apt-get update && apt-get install -y python-pip && \ libffi-dev \ libxml2-dev && \ gem install chef:13.8.5 berkshelf:6.3.1 io-console:0.4.6 etc webrick --no-document && \ - apt-get update -y && \ + apt-get update -y && apt-get remove bash -y --allow-remove-essential && \ apt-get install -y binutils && apt-get clean && gem cleanup -USER sdc +USER sdc COPY --chown=sdc:sdc chef-solo /home/sdc/chef-solo/ - COPY --chown=sdc:sdc chef-repo/cookbooks /home/sdc/chef-solo/cookbooks/ - COPY --chown=sdc:sdc startup.sh /home/sdc/ RUN chmod 770 /home/sdc/startup.sh diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb index 84b0cb2b40..3c67715922 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/01-createCsUser.rb @@ -11,9 +11,8 @@ template "/tmp/create_cassandra_user.sh" do }) end - -bash "create-sdc-user" do - code <<-EOH - cd /tmp ; /tmp/create_cassandra_user.sh - EOH -end +execute "create-sdc-user" do + command "/tmp/create_cassandra_user.sh" + cwd "/tmp/" + action :run +end
\ No newline at end of file diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb index 38de1e8844..5f740a8909 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/02-createDoxKeyspace.rb @@ -19,21 +19,16 @@ remote_directory '/tmp/tools' do action :create end - -bash "onboard-db-schema-creation" do +execute "onboard-db-schema-creation" do ignore_failure true - code <<-EOH - cd /tmp/tools/build/scripts - chmod +x onboard-db-schema-creation.sh - bash /tmp/tools/build/scripts/onboard-db-schema-creation.sh - EOH + command "chmod +x onboard-db-schema-creation.sh && sh -x /tmp/tools/build/scripts/onboard-db-schema-creation.sh" + cwd "/tmp/tools/build/scripts" + action :run end - -bash "create-DOX-schema" do + +execute "create-DOX-schema" do ignore_failure true - code <<-EOH - cd /tmp - chmod +x /tmp/create_dox_keyspace.sh - /tmp/create_dox_keyspace.sh - EOH -end + command "chmod +x /tmp/create_dox_keyspace.sh && /tmp/create_dox_keyspace.sh" + cwd "/tmp" + action :run +end
\ No newline at end of file diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb index a62550eeae..e60740fb3d 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/03-schemaCreation.rb @@ -3,15 +3,12 @@ cookbook_file "/tmp/sdctool.tar" do mode 0755 end -## extract sdctool.tar -bash "install tar" do +execute "install tar" do + command "/bin/tar xf /tmp/sdctool.tar -C /tmp" cwd "/tmp" - code <<-EOH - /bin/tar xf /tmp/sdctool.tar -C /tmp - EOH + action :run end - template "janusgraph.properties" do sensitive true path "/tmp/sdctool/config/janusgraph.properties" @@ -49,19 +46,13 @@ template "/tmp/sdctool/config/configuration.yaml" do }) end - - -bash "executing-schema-creation" do - code <<-EOH - cd /tmp - chmod +x /tmp/sdctool/scripts/schemaCreation.sh - /tmp/sdctool/scripts/schemaCreation.sh /tmp/sdctool/config - EOH +execute "executing-schema-creation" do + command "chmod +x /tmp/sdctool/scripts/schemaCreation.sh && /tmp/sdctool/scripts/schemaCreation.sh /tmp/sdctool/config" + cwd "/tmp" + action :run end -bash "executing-janusGraphSchemaCreation.sh" do - code <<-EOH - chmod +x /tmp/sdctool/scripts/janusGraphSchemaCreation.sh - /tmp/sdctool/scripts/janusGraphSchemaCreation.sh /tmp/sdctool/config - EOH -end +execute "executing-janusGraphSchemaCreation.sh" do + command "chmod +x /tmp/sdctool/scripts/janusGraphSchemaCreation.sh && /tmp/sdctool/scripts/janusGraphSchemaCreation.sh /tmp/sdctool/config" + action :run +end
\ No newline at end of file diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importConformance.rb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importConformance.rb index 0490c89668..8c2ee505be 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importConformance.rb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/recipes/04-importConformance.rb @@ -2,19 +2,8 @@ working_directory = "/tmp" cl_release=node['version'].split('.')[0..2].join('.').split('-')[0] printf("\033[33mcl_release=[%s]\n\033[0m", cl_release) - - -bash "import-Conformance" do +execute "import-Conformance" do + command "conf_dir=/tmp/sdctool/config && tosca_dir=/tmp/sdctool/tosca && cl_version=`grep 'toscaConformanceLevel:' $conf_dir/configuration.yaml |awk '{print $2}'` && cd /tmp/sdctool/scripts && /bin/chmod +x sdcSchemaFileImport.sh && echo \"execute /tmp/sdctool/scripts/sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir} onap\" && ./sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir} onap" cwd "#{working_directory}" - code <<-EOH - conf_dir=/tmp/sdctool/config - tosca_dir=/tmp/sdctool/tosca - - cl_version=`grep 'toscaConformanceLevel:' $conf_dir/configuration.yaml |awk '{print $2}'` - - cd /tmp/sdctool/scripts - /bin/chmod +x sdcSchemaFileImport.sh - echo "execute /tmp/sdctool/scripts/sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir} onap" - ./sdcSchemaFileImport.sh ${tosca_dir} #{cl_release} ${cl_version} ${conf_dir} onap - EOH + action :run end
\ No newline at end of file diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb index 426eed83df..9fa3130542 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_cassandra_user.sh.erb @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh CASSANDRA_IP=<%= @cassandra_ip %> CASSANDRA_PORT=<%= @cassandra_port %> @@ -12,17 +12,17 @@ retry_num=1 is_up=0 while [ $is_up -eq 0 -a $retry_num -le 100 ]; do - echo "exit" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT res1=$? if [ $res1 -eq 0 ]; then - echo "`date` --- cqlsh is enabled to connect." + echo "`date` --- cqlsh is able to connect." is_up=1 else - echo "`date` --- cqlsh is NOT enabled to connect yet. sleep 5" + echo "`date` --- cqlsh is NOT able to connect yet. sleep 5" sleep 5 fi - let "retry_num++" + retry_num=$((retry_num+1)) done cassandra_user_exist=`echo "list users;" | cqlsh -u cassandra -p $CS_PASSWORD $CASSANDRA_IP $CASSANDRA_PORT | grep -c $SDC_USER` diff --git a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb index e9d10af10e..9b20c6f15c 100644 --- a/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb +++ b/asdctool/sdc-cassandra-init/chef-repo/cookbooks/cassandra-actions/templates/default/create_dox_keyspace.sh.erb @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh CASSANDRA_USER='<%= @cassandra_usr %>' CASSANDRA_PASS='<%= @cassandra_pwd %>' diff --git a/asdctool/src/main/resources/scripts/UUIDFix1707.sh b/asdctool/src/main/resources/scripts/UUIDFix1707.sh index 0ceb0a0346..71cda4bccc 100644 --- a/asdctool/src/main/resources/scripts/UUIDFix1707.sh +++ b/asdctool/src/main/resources/scripts/UUIDFix1707.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Distribution Status Update 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ArtifactUUIDFixMenu" diff --git a/asdctool/src/main/resources/scripts/artifactsIdValidation.sh b/asdctool/src/main/resources/scripts/artifactsIdValidation.sh index 9064a64c6d..9c60aa76cf 100644 --- a/asdctool/src/main/resources/scripts/artifactsIdValidation.sh +++ b/asdctool/src/main/resources/scripts/artifactsIdValidation.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Artifact Validator Tool # @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ArtifactValidatorTool" diff --git a/asdctool/src/main/resources/scripts/baseOperation.sh b/asdctool/src/main/resources/scripts/baseOperation.sh index b27b734276..ffa101e26d 100644 --- a/asdctool/src/main/resources/scripts/baseOperation.sh +++ b/asdctool/src/main/resources/scripts/baseOperation.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/bin/sh CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else diff --git a/asdctool/src/main/resources/scripts/cleanCsar.sh b/asdctool/src/main/resources/scripts/cleanCsar.sh index c11cdef8f8..a5fba0a927 100644 --- a/asdctool/src/main/resources/scripts/cleanCsar.sh +++ b/asdctool/src/main/resources/scripts/cleanCsar.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/deleteAllProducts.sh b/asdctool/src/main/resources/scripts/deleteAllProducts.sh index 474b6c8980..07dbae122b 100644 --- a/asdctool/src/main/resources/scripts/deleteAllProducts.sh +++ b/asdctool/src/main/resources/scripts/deleteAllProducts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ##################################### # delete all products from JanusGraph @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.RemoveUtils" diff --git a/asdctool/src/main/resources/scripts/deleteComponentTool.sh b/asdctool/src/main/resources/scripts/deleteComponentTool.sh index afdf8166f5..0c65d54386 100644 --- a/asdctool/src/main/resources/scripts/deleteComponentTool.sh +++ b/asdctool/src/main/resources/scripts/deleteComponentTool.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Distribution Status Update 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.DeleteComponentTool" diff --git a/asdctool/src/main/resources/scripts/derivedFromAlignment.sh b/asdctool/src/main/resources/scripts/derivedFromAlignment.sh index 05025a01c0..c9ee64b6b4 100644 --- a/asdctool/src/main/resources/scripts/derivedFromAlignment.sh +++ b/asdctool/src/main/resources/scripts/derivedFromAlignment.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/distributionStatusUpdate1707.sh b/asdctool/src/main/resources/scripts/distributionStatusUpdate1707.sh index a9d308f933..3be4a498aa 100644 --- a/asdctool/src/main/resources/scripts/distributionStatusUpdate1707.sh +++ b/asdctool/src/main/resources/scripts/distributionStatusUpdate1707.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Distribution Status Update 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/exportGraph.sh b/asdctool/src/main/resources/scripts/exportGraph.sh index 648cb50669..41874d5bdc 100644 --- a/asdctool/src/main/resources/scripts/exportGraph.sh +++ b/asdctool/src/main/resources/scripts/exportGraph.sh @@ -1,16 +1,16 @@ -#!/bin/bash +#!/bin/sh CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ExportImportMenu" diff --git a/asdctool/src/main/resources/scripts/exportGraphAsGraphMl.sh b/asdctool/src/main/resources/scripts/exportGraphAsGraphMl.sh index 17d660ce4e..bd8f51a40b 100644 --- a/asdctool/src/main/resources/scripts/exportGraphAsGraphMl.sh +++ b/asdctool/src/main/resources/scripts/exportGraphAsGraphMl.sh @@ -1,16 +1,16 @@ -#!/bin/bash +#!/bin/sh CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ExportImportMenu" diff --git a/asdctool/src/main/resources/scripts/exportUsers.sh b/asdctool/src/main/resources/scripts/exportUsers.sh index fec7d5abe4..4a6d0fe8da 100644 --- a/asdctool/src/main/resources/scripts/exportUsers.sh +++ b/asdctool/src/main/resources/scripts/exportUsers.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ################################## # export all users from JanusGraph @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ExportImportMenu" diff --git a/asdctool/src/main/resources/scripts/fix_icons.sh b/asdctool/src/main/resources/scripts/fix_icons.sh index 230dea7218..dfa50aa9ec 100644 --- a/asdctool/src/main/resources/scripts/fix_icons.sh +++ b/asdctool/src/main/resources/scripts/fix_icons.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/fix_issue.sh b/asdctool/src/main/resources/scripts/fix_issue.sh index af63ec525d..7c4d426136 100644 --- a/asdctool/src/main/resources/scripts/fix_issue.sh +++ b/asdctool/src/main/resources/scripts/fix_issue.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/generateCsar.sh b/asdctool/src/main/resources/scripts/generateCsar.sh index c74168823c..fb01c2fb9b 100644 --- a/asdctool/src/main/resources/scripts/generateCsar.sh +++ b/asdctool/src/main/resources/scripts/generateCsar.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Distribution Status Update 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.CsarGeneratorTool" diff --git a/asdctool/src/main/resources/scripts/groupsAlignment.sh b/asdctool/src/main/resources/scripts/groupsAlignment.sh index 742b246a48..7ce927aa07 100644 --- a/asdctool/src/main/resources/scripts/groupsAlignment.sh +++ b/asdctool/src/main/resources/scripts/groupsAlignment.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Groups Alignment @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/importGraph.sh b/asdctool/src/main/resources/scripts/importGraph.sh index ffdd2fddb0..4d4dd69ef0 100644 --- a/asdctool/src/main/resources/scripts/importGraph.sh +++ b/asdctool/src/main/resources/scripts/importGraph.sh @@ -1,16 +1,16 @@ -#!/bin/bash +#!/bin/sh CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ExportImportMenu" diff --git a/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh b/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh index d4b7871f30..d964c997b2 100644 --- a/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh +++ b/asdctool/src/main/resources/scripts/janusGraphSchemaCreation.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # JanusGraph Schema Creation @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.DataSchemaMenu" diff --git a/asdctool/src/main/resources/scripts/migration1707RelationsFix.sh b/asdctool/src/main/resources/scripts/migration1707RelationsFix.sh index c930243750..0e7ce424c6 100644 --- a/asdctool/src/main/resources/scripts/migration1707RelationsFix.sh +++ b/asdctool/src/main/resources/scripts/migration1707RelationsFix.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration: fix relations after migration 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/postMigration1707Fix.sh b/asdctool/src/main/resources/scripts/postMigration1707Fix.sh index 56a16db70a..0d25d7c476 100644 --- a/asdctool/src/main/resources/scripts/postMigration1707Fix.sh +++ b/asdctool/src/main/resources/scripts/postMigration1707Fix.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/schemaCreation.sh b/asdctool/src/main/resources/scripts/schemaCreation.sh index 657db5e6f1..fbc2251ff7 100644 --- a/asdctool/src/main/resources/scripts/schemaCreation.sh +++ b/asdctool/src/main/resources/scripts/schemaCreation.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.DataSchemaMenu" diff --git a/asdctool/src/main/resources/scripts/sdc-migration.sh b/asdctool/src/main/resources/scripts/sdc-migration.sh index 15e6d6b6e1..c369800e29 100644 --- a/asdctool/src/main/resources/scripts/sdc-migration.sh +++ b/asdctool/src/main/resources/scripts/sdc-migration.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -10,14 +10,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.migration.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/sdcSchemaFileImport.sh b/asdctool/src/main/resources/scripts/sdcSchemaFileImport.sh index 4002e388da..afe6b65793 100644 --- a/asdctool/src/main/resources/scripts/sdcSchemaFileImport.sh +++ b/asdctool/src/main/resources/scripts/sdcSchemaFileImport.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Sdc Schema File Import # @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.SdcSchemaFileImport" diff --git a/asdctool/src/main/resources/scripts/updateIsVnf.sh b/asdctool/src/main/resources/scripts/updateIsVnf.sh index bf45fa88b5..4d15b042bb 100644 --- a/asdctool/src/main/resources/scripts/updateIsVnf.sh +++ b/asdctool/src/main/resources/scripts/updateIsVnf.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ######################################################################## # @@ -10,14 +10,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.UpdateIsVnfMenu" diff --git a/asdctool/src/main/resources/scripts/upgradePostMigration1710.sh b/asdctool/src/main/resources/scripts/upgradePostMigration1710.sh index 927d148d88..3b58fdc248 100644 --- a/asdctool/src/main/resources/scripts/upgradePostMigration1710.sh +++ b/asdctool/src/main/resources/scripts/upgradePostMigration1710.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration: Upgrade Post Migration 1710 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.migration.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/validationTool.sh b/asdctool/src/main/resources/scripts/validationTool.sh index 58cd7f3f6a..6ac0541d39 100644 --- a/asdctool/src/main/resources/scripts/validationTool.sh +++ b/asdctool/src/main/resources/scripts/validationTool.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Validation Tool # @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.ValidationTool" diff --git a/asdctool/src/main/resources/scripts/vfModulePropertiesAdding.sh b/asdctool/src/main/resources/scripts/vfModulePropertiesAdding.sh index 1ead2484db..7fd40967ba 100644 --- a/asdctool/src/main/resources/scripts/vfModulePropertiesAdding.sh +++ b/asdctool/src/main/resources/scripts/vfModulePropertiesAdding.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration: Adding new properties to vfModules @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/vfcNameAlignment.sh b/asdctool/src/main/resources/scripts/vfcNameAlignment.sh index 10fbb257ef..a7578ec6db 100644 --- a/asdctool/src/main/resources/scripts/vfcNameAlignment.sh +++ b/asdctool/src/main/resources/scripts/vfcNameAlignment.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/vfmoduleFix1707.sh b/asdctool/src/main/resources/scripts/vfmoduleFix1707.sh index 48579242bf..6f08fa2175 100644 --- a/asdctool/src/main/resources/scripts/vfmoduleFix1707.sh +++ b/asdctool/src/main/resources/scripts/vfmoduleFix1707.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Distribution Status Update 1707 @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.MigrationMenu" diff --git a/asdctool/src/main/resources/scripts/vrfObjectFix.sh b/asdctool/src/main/resources/scripts/vrfObjectFix.sh index 3f875fa136..a3eb067612 100644 --- a/asdctool/src/main/resources/scripts/vrfObjectFix.sh +++ b/asdctool/src/main/resources/scripts/vrfObjectFix.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh ############################## # Data Migration @@ -7,14 +7,14 @@ CURRENT_DIR=`pwd` BASEDIR=$(dirname $0) -if [ ${BASEDIR:0:1} = "/" ] +if [ `echo ${BASEDIR} | cut -c1-1` = "/" ] then FULL_PATH=$BASEDIR else FULL_PATH=$CURRENT_DIR/$BASEDIR fi -source ${FULL_PATH}/baseOperation.sh +. ${FULL_PATH}/baseOperation.sh mainClass="org.openecomp.sdc.asdctool.main.VrfObjectFixMenu" diff --git a/catalog-be-plugins/backend-all-plugins/pom.xml b/catalog-be-plugins/backend-all-plugins/pom.xml index 4cd48797e8..a261c1e92f 100644 --- a/catalog-be-plugins/backend-all-plugins/pom.xml +++ b/catalog-be-plugins/backend-all-plugins/pom.xml @@ -58,9 +58,10 @@ limitations under the License. <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> - <verbose>true</verbose> + <verbose>${verbose}</verbose> <authConfig> <pull> <username>docker</username> diff --git a/catalog-be-plugins/backend-all-plugins/src/main/docker/backend-all-plugins/Dockerfile b/catalog-be-plugins/backend-all-plugins/src/main/docker/backend-all-plugins/Dockerfile index ab42a10418..24e914637e 100644 --- a/catalog-be-plugins/backend-all-plugins/src/main/docker/backend-all-plugins/Dockerfile +++ b/catalog-be-plugins/backend-all-plugins/src/main/docker/backend-all-plugins/Dockerfile @@ -1,4 +1,3 @@ FROM onap/sdc-backend:latest -COPY --chown=jetty:jetty onap-sdc-backend-all-plugins/etsi-nfv-nsd-csar-plugin.jar ${JETTY_BASE}/plugins/ -RUN ls -latr ${JETTY_BASE}/plugins/
\ No newline at end of file +COPY --chown=onap:onap onap-sdc-backend-all-plugins/etsi-nfv-nsd-csar-plugin.jar ${JETTY_BASE}/plugins/
\ No newline at end of file diff --git a/catalog-be/pom.xml b/catalog-be/pom.xml index 00cbc8b51f..002e3fc3b1 100644 --- a/catalog-be/pom.xml +++ b/catalog-be/pom.xml @@ -1216,6 +1216,7 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile index 3ffcbe691a..35e485b197 100644 --- a/catalog-be/sdc-backend-init/Dockerfile +++ b/catalog-be/sdc-backend-init/Dockerfile @@ -1,22 +1,59 @@ -FROM onap/base_sdc-python:1.7.0 +FROM onap/integration-python:8.0.0 + +USER root + +# Needed for pycurl +ENV PYCURL_SSL_LIBRARY=openssl + +# Install packages only needed for building +RUN apk update && \ + apk add binutils jq libpng && \ + apk add --no-cache \ + libcurl \ + ruby && \ + apk add --no-cache --virtual .build-dependencies \ + libressl-dev \ + ruby-dev \ + libffi-dev \ + libxml2-dev \ + build-base \ + curl-dev && \ + # needed libcurl to install correctly + pip install 'pycurl==7.43.0.1' && \ + set -ex && \ + gem install \ + chef:13.8.5 \ + berkshelf:6.3.1 \ + io-console:0.4.6 \ + etc webrick \ + --no-document && \ + apk del .build-dependencies + +ENV ONAP_LOG=/home/onap/logs +RUN mkdir $ONAP_LOG && chown onap:onap $ONAP_LOG + +# user/group are the same as in integration/docker/onap-python base image +ENV user=onap group=onap + +USER onap # user/group args are inherited from base_sdc-python base image -COPY --chown=$user:$group scripts /home/$user/scripts +COPY --chown=onap:onap scripts /home/onap/scripts -RUN chmod 770 -R /home/$user/scripts && \ - cd /home/$user/scripts && \ +RUN chmod 770 -R /home/onap/scripts && \ + cd /home/onap/scripts && \ python setup.py install --user -ENV PATH=$PATH:/home/$user/.local/bin +ENV PATH=$PATH:/home/onap/.local/bin -COPY --chown=$user:$group chef-solo /home/$user/chef-solo/ +COPY --chown=onap:onap chef-solo /home/onap/chef-solo/ -COPY --chown=$user:$group chef-repo/cookbooks /home/$user/chef-solo/cookbooks/ +COPY --chown=onap:onap chef-repo/cookbooks /home/onap/chef-solo/cookbooks/ -COPY --chown=$user:$group startup.sh /home/$user/ +COPY --chown=onap:onap startup.sh /home/onap/ -RUN chmod 770 /home/$user/startup.sh +RUN chmod 770 /home/onap/startup.sh -WORKDIR /home/$user/ +WORKDIR /home/onap/ ENTRYPOINT /home/${user}/startup.sh diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb index dcf963fc29..3aabb0a10e 100644 --- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/1_create_consumer_and_user.rb @@ -28,20 +28,11 @@ if node['basic_auth'] end end -bash "executing-create_users" do - code <<-EOH - sdcuserinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{user_conf_dir} #{https_flag} - rc=$? - if [[ $rc != 0 ]]; then exit $rc; fi - EOH - returns [0] +execute "executing-create_users" do + command "sdcuserinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{user_conf_dir} #{https_flag}" + action :run end - -bash "executing-create_consumers" do - code <<-EOH - sdcconsumerinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag} - rc=$? - if [[ $rc != 0 ]]; then exit $rc; fi - EOH - returns [0] +execute "executing-create_consumers" do + command "sdcconsumerinit -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}" + action :run end diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb index 27b1a7d5b9..2e479e0848 100644 --- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/2_check_Backend.rb @@ -21,11 +21,7 @@ if node['basic_auth'] end end -bash "executing-check_backend_health" do - code <<-EOH - sdccheckbackend -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag} - rc=$? - if [[ $rc != 0 ]]; then exit $rc; fi - EOH - returns [0] +execute "executing-check_backend_health" do + command "sdccheckbackend -i #{node['Nodes']['BE']} -p #{be_port} #{basic_auth_config} #{https_flag}" + action :run end
\ No newline at end of file diff --git a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb index 0abda0d07a..be32e98f2b 100644 --- a/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb +++ b/catalog-be/sdc-backend-init/chef-repo/cookbooks/sdc-catalog-be-setup/recipes/3_import_Normatives.rb @@ -26,21 +26,8 @@ cookbook_file "/var/tmp/normatives.tar.gz" do source "normatives.tar.gz" end -bash "executing-import_Normatives" do - code <<-EOH - set -ex - - cd /var/tmp/ - tar -xvf normatives.tar.gz - - # executing the normatives - # add --debug to the sdcinit command to enable debug - - cd /var/tmp/normatives/import/tosca - sdcinit #{param} #{basic_auth_config} > /var/lib/jetty/logs/init.log - rc=$? - if [[ $rc != 0 ]]; then exit $rc; fi - - EOH - returns [0] +execute "create-jetty-modules" do + command "set -ex && tar -xvf normatives.tar.gz && cd /var/tmp/normatives/import/tosca && sdcinit #{param} #{basic_auth_config} > #{ENV['ONAP_LOG']}/init.log" + cwd "/var/tmp/" + action :run end diff --git a/catalog-be/sdc-backend-init/startup.sh b/catalog-be/sdc-backend-init/startup.sh index 83bfbf23de..e216341882 100644 --- a/catalog-be/sdc-backend-init/startup.sh +++ b/catalog-be/sdc-backend-init/startup.sh @@ -1,6 +1,4 @@ #!/bin/sh cd /home/"${user}"/chef-solo || exit $? -chef-solo -c solo.rb -E "${ENVNAME}" -rc=$? -if [ $rc != 0 ]; then exit $rc; fi +chef-solo -c solo.rb -E "${ENVNAME}"
\ No newline at end of file diff --git a/catalog-be/src/main/docker/backend/Dockerfile b/catalog-be/src/main/docker/backend/Dockerfile index 2772e62f99..30daaf46dd 100644 --- a/catalog-be/src/main/docker/backend/Dockerfile +++ b/catalog-be/src/main/docker/backend/Dockerfile @@ -1,17 +1,13 @@ -FROM jetty:9.4.31-jre11-slim +FROM onap/integration-java11:8.0.0 USER root +ARG JETTY_FOLDER=/app/jetty # Install Chef RUN set -ex && \ - apt-get update -y && \ - apt-get install -y \ - jq \ - curl \ - curl \ - vim \ - make \ - gcc \ + apk update && \ + apk add --no-cache \ + build-base \ ruby \ ruby-dev \ libffi-dev \ @@ -23,33 +19,30 @@ RUN set -ex && \ etc webrick \ --no-document && \ gem cleanup && \ - apt-get update -y && \ - apt-get install -y binutils jq && \ - apt-get clean - -# Replace Jetty user ID -ENV USER_JETTY="jetty" -ENV GROUP_JETTY="jetty" -ENV UID_JETTY="352070" -ENV GID_JETTY="35953" - -# Remove user: -RUN deluser ${USER_JETTY} -#RUN delgroup ${GROUP_JETTY} -RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd -RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group -RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow -RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty - -USER jetty - -COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ -COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ -COPY --chown=jetty:jetty onap-sdc-backend/catalog-be.war ${JETTY_BASE}/webappwar/ -COPY --chown=jetty:jetty context.xml ${JETTY_BASE}/webapps/ -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ - -RUN chmod 770 ${JETTY_BASE}/startup.sh - -ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"]
\ No newline at end of file + apk update + +ENV JETTY_HOME=$JETTY_FOLDER +ENV JETTY_BASE=$JETTY_FOLDER +ENV JETTY_USER=onap +ENV JETTY_GROUP=onap + +RUN mkdir $JETTY_FOLDER && chown onap:onap $JETTY_FOLDER + +USER onap + +#Download jetty +RUN wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.31.v20200723/jetty-distribution-9.4.31.v20200723.tar.gz -O $JETTY_FOLDER/jetty.tar.gz && \ + tar xvz -C $JETTY_FOLDER -f $JETTY_FOLDER/jetty.tar.gz --strip 1 && \ + rm -rf $JETTY_FOLDER/jetty.tar.gz + +RUN sed -i 's/"jetty"/"onap"/g' $JETTY_FOLDER/etc/jetty-setuid.xml + +COPY --chown=onap:onap chef-solo $JETTY_FOLDER/chef-solo/ +COPY --chown=onap:onap chef-repo/cookbooks $JETTY_FOLDER/chef-solo/cookbooks/ +COPY --chown=onap:onap onap-sdc-backend/catalog-be.war $JETTY_FOLDER/webappwar/ +COPY --chown=onap:onap context.xml $JETTY_FOLDER/webapps/ +COPY --chown=onap:onap startup.sh $JETTY_FOLDER/ + +RUN chmod 770 $JETTY_FOLDER/startup.sh + +ENTRYPOINT [ "sh", "-c", "${JETTY_HOME}/startup.sh"]
\ No newline at end of file diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb index 528ddae9ad..dc7d77b0ab 100644 --- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/attributes/default.rb @@ -13,8 +13,9 @@ default['disableHttp'] = true #+----------------------------------+ default['jetty']['dmaap_truststore_pwd'] = "dmaap_truststore_pwd" -default['jetty'][:keystore_pwd] = "?(kP!Yur![*!Y5!E^f(ZKc31" -default['jetty'][:keymanager_pwd] = "?(kP!Yur![*!Y5!E^f(ZKc31" +default['jetty']['keystore_pwd'] = "?(kP!Yur![*!Y5!E^f(ZKc31" +default['jetty']['keymanager_pwd'] = "?(kP!Yur![*!Y5!E^f(ZKc31" +default['jetty']['truststore_path'] = "#{ENV['JETTY_BASE']}/etc/truststore" # TO CHANGE THE TRUSTSTORE CERT THE JVM CONFIGURATION # MUST BE ALSO CHANGE IN THE startup.sh FILE default['jetty'][:truststore_pwd] = "z+KEj;t+,KN^iimSiS89e#p0" @@ -33,6 +34,7 @@ default['cassandra']['socket_read_timeout'] = 20000 default['cassandra']['socket_connect_timeout'] = 20000 default['cassandra']['janusgraph_connection_timeout'] = 10000 default['cassandra'][:truststore_password] = "Aa123456" +default['cassandra']['janusgraph_config_file'] = "#{ENV['JETTY_BASE']}/config/catalog-be/janusgraph.properties" #Onboard @@ -86,10 +88,10 @@ default['DMAAP']['replicationcount'] = "3" #+----------------------------------+ # Cadi -default['access_restriction']['cadi_root_dir'] = "/var/lib/jetty/etc" -default['access_restriction']['cadi_keyfile'] = "/var/lib/jetty/etc/org.onap.sdc.p12" +default['access_restriction']['cadi_root_dir'] = "#{ENV['JETTY_BASE']}/etc" +default['access_restriction']['cadi_keyfile'] = "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.p12" default['access_restriction']['cadi_loglevel'] = "DEBUG" -default['access_restriction']['cadi_truststore'] = "/var/lib/jetty/etc/org.onap.sdc.trust.jks" +default['access_restriction']['cadi_truststore'] = "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.trust.jks" default['access_restriction']['cadi_truststore_password'] = "changeit" default['access_restriction']['cadiX509Issuers'] = "CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US" default['access_restriction']['encrypted_password'] = "enc:AccessRestrictionEncryptedPassword" 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 index 3a79cfc874..e7d11c9f2d 100644 --- 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 @@ -3,8 +3,8 @@ jetty_base = "#{ENV['JETTY_BASE']}" directory "Jetty_etc_dir_creation" do path "#{jetty_base}/etc" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode '0755' action :create not_if { ::File.directory?("#{jetty_base}/etc") } @@ -13,16 +13,16 @@ end cookbook_file "#{jetty_base}/etc/keyfile" do source "keyfile" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode 0755 end cookbook_file "#{jetty_base}/etc/cadi_truststore.jks" do source "cadi_truststore.jks" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode 0755 end @@ -30,8 +30,8 @@ end template "#{jetty_base}/etc/cadi.properties" do path "#{jetty_base}/etc/cadi.properties" source "cadi.properties.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" 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 index 7ca3db813f..620fa2ec4d 100644 --- 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 @@ -1,8 +1,8 @@ unless Dir.exist? "#{ENV['JETTY_BASE']}/temp" directory "BE_tempdir_creation" do path "#{ENV['JETTY_BASE']}/temp" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -11,8 +11,8 @@ end unless Dir.exist? "#{ENV['JETTY_BASE']}/config" directory "BE_create_config_dir" do path "#{ENV['JETTY_BASE']}/config" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -21,8 +21,8 @@ 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' + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" mode '0755' action :create 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 index 51a943fa68..6522577881 100644 --- 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 @@ -17,8 +17,8 @@ end template "janusgraph.properties" do path "#{ENV['JETTY_BASE']}/config/catalog-be/janusgraph.properties" source "BE-janusgraph.properties.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0644" action :create_if_missing variables({ @@ -38,8 +38,8 @@ end template "catalog-be-config" do path "#{ENV['JETTY_BASE']}/config/catalog-be/configuration.yaml" source "BE-configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0644" action :create_if_missing variables({ @@ -54,7 +54,7 @@ template "catalog-be-config" do :rep_factor => replication_factor, :DC_NAME => node['cassandra']['datacenter_name'], :REP_STRING => conf_dcname_with_rep, - :janusgraph_Path => "/var/lib/jetty/config/catalog-be/", + :janusgraph_Path => "#{ENV['JETTY_BASE']}/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], @@ -68,8 +68,8 @@ 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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 index cb2ffc7154..176edcf71c 100644 --- 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 @@ -1,23 +1,23 @@ directory "Jetty_etcdir_creation" do path "#{ENV['JETTY_BASE']}/etc" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + owner "#{ENV['JETTY_GROUP']}" 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 index 34934a44af..772e0d40c0 100644 --- 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 @@ -5,22 +5,17 @@ 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 +execute "create-jetty-modules" do + command "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" + cwd "#{ENV['JETTY_BASE']}" + action :run end - template "http-ini" do path "#{ENV['JETTY_BASE']}/start.d/http.ini" source "http-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :http_option => http_option , @@ -33,8 +28,8 @@ end template "https-ini" do path "#{ENV['JETTY_BASE']}/start.d/https.ini" source "https-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables :https_port => "#{node['BE'][:https_port]}" end @@ -43,8 +38,8 @@ end template "ssl-ini" do path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" source "ssl-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :https_port => "#{node['BE'][:https_port]}" , 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 index 7a2f24e57a..44e96f3477 100644 --- 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 @@ -11,8 +11,8 @@ end template "elasticsearch.yml-config" do path "#{ENV['JETTY_BASE']}/config/elasticsearch.yml" source "BE-elasticsearch.yml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :cluster_name => "#{clusterName}", 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 index 4f9993848a..5e37c29bf8 100644 --- 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 @@ -1,8 +1,8 @@ template "template portal.properties" do path "#{ENV['JETTY_BASE']}/resources/portal.properties" source "BE-portal.properties.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :ecomp_rest_url => node['ECompP']['ecomp_rest_url'], @@ -16,8 +16,8 @@ end template "template key.properties" do path "#{ENV['JETTY_BASE']}/resources/key.properties" source "BE-key.properties.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :cipher_key => node['ECompP']['cipher_key'] 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 index 7d95d7448e..8dbebbb633 100644 --- 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 @@ -1,8 +1,8 @@ cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-be/logback.xml" do source "logback.xml" mode 0644 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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 index b100356d98..cc059b4e06 100644 --- 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 @@ -1,16 +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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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 index 81e1a855f4..51e69ae7a9 100644 --- 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 @@ -6,7 +6,7 @@ else port = "#{node['BE'][:http_port]}" end -template "/var/lib/jetty/ready-probe.sh" do +template "#{ENV['JETTY_BASE']}/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb index 5a059aae7d..9f49bc52e1 100644 --- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb @@ -28,7 +28,7 @@ released: 2012-11-30 toscaConformanceLevel: 11.0 minToscaConformanceLevel: 3.0 -janusGraphCfgFile: /var/lib/jetty/config/catalog-be/janusgraph.properties +janusGraphCfgFile: <%= node['cassandra']['janusgraph_config_file'] %> janusGraphInMemoryGraph: false janusGraphLockTimeout: 1800 # The interval to try and reconnect to JanusGraph DB when it is down during ASDC startup: @@ -112,7 +112,7 @@ cassandraConfig: username: <%= @cassandra_usr %> password: <%= @cassandra_pwd %> ssl: <%= @cassandra_ssl_enabled %> - truststorePath : /var/lib/jetty/etc/truststore + truststorePath : <%= node['jetty']['truststore_path'] %> truststorePassword : <%= @cassandra_truststore_password %> keySpaces: - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['<%= @REP_STRING %>']} @@ -1120,7 +1120,7 @@ dmaapConsumerConfiguration: username: user password: aftDme2SslEnable: true - aftDme2ClientKeystore: /var/lib/jetty/etc/truststore + aftDme2ClientKeystore: <%= node['jetty']['truststore_path'] %> aftDme2ClientKeystorePassword: "" aftDme2ClientSslCertAlias: certman @@ -1153,7 +1153,7 @@ dmaapProducerConfiguration: username: <%= node['DMAAP']['producer']['username'] %> password: <%= node['DMAAP']['producer']['password'] %> aftDme2SslEnable: true - aftDme2ClientKeystore: /var/lib/jetty/etc/truststore + aftDme2ClientKeystore: <%= node['jetty']['truststore_path'] %> aftDme2ClientKeystorePassword: <%= node['jetty']['dmaap_truststore_pwd'] %> aftDme2ClientSslCertAlias: certman diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb index 0fa6936f74..7eeb7a8ff8 100644 --- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb @@ -58,7 +58,7 @@ aaiConfig: readTimeoutMs: 5000 connectTimeoutMs: 1000 clientCertificate: - keyStore: /var/lib/jetty/base/be/etc/non-prod.jks + keyStore: /app/jetty/base/be/etc/non-prod.jks keyStorePassword: hmXYcznAljMSisdy8zgcag== headers: X-FromAppId: asdc diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb index 9f6646d63d..6592943b8f 100644 --- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb +++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/ready-probe.sh.erb @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc2/rest/healthCheck) -if [[ "$health_check_http_code" -eq 200 ]]; then +if [ "$health_check_http_code" -eq 200 ]; then exit 0 else echo "Health check http status: $health_check_http_code" diff --git a/catalog-be/src/main/docker/backend/startup.sh b/catalog-be/src/main/docker/backend/startup.sh index 0dc54a8849..50f2e3d370 100644 --- a/catalog-be/src/main/docker/backend/startup.sh +++ b/catalog-be/src/main/docker/backend/startup.sh @@ -1,27 +1,21 @@ #!/bin/sh -export JAVA_OPTIONS=" -Dconfig.home=${JETTY_BASE}/config \ - -Dlog.home=${JETTY_BASE}/logs \ - -Dlogback.configurationFile=${JETTY_BASE}/config/catalog-be/logback.xml \ - -Dconfiguration.yaml=${JETTY_BASE}/config/catalog-be/configuration.yaml \ - -Dartifactgenerator.config=${JETTY_BASE}/config/catalog-be/Artifact-Generator.properties \ - -Donboarding_configuration.yaml=${JETTY_BASE}/config/onboarding-be/onboarding_configuration.yaml \ - -Djavax.net.ssl.trustStore=${JETTY_BASE}/etc/org.onap.sdc.trust.jks \ +export JAVA_OPTIONS="$JAVA_OPTIONS -Dconfig.home=$JETTY_BASE/config \ + -Dcom.datastax.driver.USE_NATIVE_CLOCK=false \ + -Dlog.home=$JETTY_BASE/logs \ + -Dlogback.configurationFile=$JETTY_BASE/config/catalog-be/logback.xml \ + -Dconfiguration.yaml=$JETTY_BASE/config/catalog-be/configuration.yaml \ + -Dartifactgenerator.config=$JETTY_BASE/config/catalog-be/Artifact-Generator.properties \ + -Donboarding_configuration.yaml=$JETTY_BASE/config/onboarding-be/onboarding_configuration.yaml \ + -Djavax.net.ssl.trustStore=$JETTY_BASE/etc/org.onap.sdc.trust.jks \ -Djavax.net.ssl.trustStorePassword=z+KEj;t+,KN^iimSiS89e#p0 \ - -Djetty.console-capture.dir=${JETTY_BASE}/logs \ - ${JAVA_OPTIONS} " + -Djetty.console-capture.dir=$JETTY_BASE/logs" -cd /var/lib/jetty/chef-solo +cd $JETTY_BASE/chef-solo chef-solo -c solo.rb -E ${ENVNAME} -status=$? -if [ $status -ne 0 ]; then - echo "[ERROR] Problem detected while running chef. Aborting !" - exit 1 -fi - # Execute Jetty -cd /var/lib/jetty +cd $JETTY_HOME java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" diff --git a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml index 65a41e448e..1f8d59bfcb 100644 --- a/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml +++ b/catalog-be/src/main/resources/config/distribution-engine-configuration.yaml @@ -61,7 +61,7 @@ aaiConfig: readTimeoutMs: 5000 connectTimeoutMs: 1000 clientCertificate: - keyStore: /var/lib/jetty/opt/base/be/etc/non-prod.jks + keyStore: /app/jetty/opt/base/be/etc/non-prod.jks keyStorePassword: hmXYcznAljMSisdy8zgcag== headers: X-FromAppId: asdc diff --git a/catalog-fe/pom.xml b/catalog-fe/pom.xml index 3591a51bc2..a4be186b45 100644 --- a/catalog-fe/pom.xml +++ b/catalog-fe/pom.xml @@ -580,6 +580,7 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> diff --git a/catalog-fe/sdc-frontend/Dockerfile b/catalog-fe/sdc-frontend/Dockerfile index 3a2359c4ab..65950cb0e1 100644 --- a/catalog-fe/sdc-frontend/Dockerfile +++ b/catalog-fe/sdc-frontend/Dockerfile @@ -1,17 +1,13 @@ -FROM jetty:9.4.31-jre11-slim +FROM onap/integration-java11:8.0.0 USER root +ARG JETTY_FOLDER=/app/jetty # Install Chef RUN set -ex && \ - apt-get update -y && \ - apt-get install -y \ - jq \ - curl \ - curl \ - vim \ - make \ - gcc \ + apk update && \ + apk add --no-cache \ + build-base \ ruby \ ruby-dev \ libffi-dev \ @@ -23,39 +19,30 @@ RUN set -ex && \ etc webrick \ --no-document && \ gem cleanup && \ - apt-get update -y && \ - apt-get install -y binutils jq && \ - apt-get clean + apk update -# Replace Jetty user ID -ENV USER_JETTY="jetty" -ENV GROUP_JETTY="jetty" -ENV UID_JETTY="352070" -ENV GID_JETTY="35953" +ENV JETTY_HOME=$JETTY_FOLDER +ENV JETTY_BASE=$JETTY_FOLDER +ENV JETTY_USER=onap +ENV JETTY_GROUP=onap -# Remove user: -RUN deluser ${USER_JETTY} -#RUN delgroup ${GROUP_JETTY} -RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd -RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group -RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow -RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty +RUN mkdir $JETTY_FOLDER && chown onap:onap $JETTY_FOLDER -USER jetty +USER onap -RUN mkdir -p ${JETTY_BASE}/config/catalog-fe +#Download jetty +RUN wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.31.v20200723/jetty-distribution-9.4.31.v20200723.tar.gz -O $JETTY_FOLDER/jetty.tar.gz && \ + tar xvz -C $JETTY_FOLDER -f $JETTY_FOLDER/jetty.tar.gz --strip 1 && \ + rm -rf $JETTY_FOLDER/jetty.tar.gz +RUN sed -i 's/"jetty"/"onap"/g' $JETTY_FOLDER/etc/jetty-setuid.xml -COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ +RUN mkdir -p $JETTY_FOLDER/config/catalog-fe +COPY --chown=onap:onap chef-solo $JETTY_FOLDER/chef-solo/ +COPY --chown=onap:onap chef-repo/cookbooks $JETTY_FOLDER/chef-solo/cookbooks/ +ADD --chown=onap:onap onboarding*.war $JETTY_FOLDER/webapps/ +ADD --chown=onap:onap catalog-fe-*.war $JETTY_FOLDER/webapps/ +COPY --chown=onap:onap startup.sh $JETTY_FOLDER -COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ +RUN chmod 770 $JETTY_FOLDER/startup.sh -ADD --chown=jetty:jetty onboarding*.war ${JETTY_BASE}/webapps/ - -ADD --chown=jetty:jetty catalog-fe-*.war ${JETTY_BASE}/webapps/ - -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE} - -RUN chmod 770 ${JETTY_BASE}/startup.sh - -ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"]
\ No newline at end of file +ENTRYPOINT [ "sh", "-c", "${JETTY_HOME}/startup.sh"]
\ No newline at end of file diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb index 0dd305ac42..cdd6b19b24 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_1_cleanup_jettydir.rb @@ -1,15 +1,15 @@ directory "FE_tempdir_creation" do path "#{ENV['JETTY_BASE']}/temp" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end directory "FE_create_config_dir" do path "#{ENV['JETTY_BASE']}/config" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -17,8 +17,8 @@ end directory "FE_create_catalog-fe" do path "#{ENV['JETTY_BASE']}/config/catalog-fe" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -26,8 +26,8 @@ end directory "FE_create_catalog-fe" do path "#{ENV['JETTY_BASE']}/config/onboarding-fe" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb index 640b5b8d77..819638ac08 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_2_setup_configuration.rb @@ -1,8 +1,8 @@ template "catalog-fe-config" do path "#{ENV['JETTY_BASE']}/config/catalog-fe/configuration.yaml" source "FE-configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :fe_host_ip => node['FE_VIP'], @@ -20,8 +20,8 @@ end cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/workspace-configuration.yaml" do source "FE-workspace-configuration.yaml" mode 0755 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end @@ -29,7 +29,7 @@ end template "onboarding-fe-config" do path "#{ENV['JETTY_BASE']}/config/onboarding-fe/onboarding_configuration.yaml" source "FE-onboarding-configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb index 54dee2ef26..aa8087960b 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_3_errors_config.rb @@ -1,7 +1,7 @@ cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/ecomp-error-configuration.yaml" do source "FE-ecomp-error-configuration.yaml" mode 0755 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb index f26418372b..34c084e38d 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_4_logback.rb @@ -1,6 +1,6 @@ cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/logback.xml" do source "FE-logback.xml" mode 0755 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb index cf7575c546..388974e111 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_5_rest_configuration.rb @@ -1,7 +1,7 @@ cookbook_file "#{ENV['JETTY_BASE']}/config/catalog-fe/rest-configuration-info.yaml" do source "FE-rest-configuration.yaml" mode 0755 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb index 527713c768..50cb2639e8 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_6_locate_keystore.rb @@ -1,21 +1,21 @@ directory "Jetty_etcdir_creation" do path "#{ENV['JETTY_BASE']}/etc" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode 0755 end diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb index bf756fb1c6..0a1527f05e 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_7_create_jetty_modules.rb @@ -6,22 +6,17 @@ 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 +execute "create-jetty-modules" do + command "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" + cwd "#{ENV['JETTY_BASE']}" + action :run end - template "http-ini" do path "#{ENV['JETTY_BASE']}/start.d/http.ini" source "http-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :http_option => http_option , @@ -33,8 +28,8 @@ end template "https-ini" do path "#{ENV['JETTY_BASE']}/start.d/https.ini" source "https-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables :https_port => "#{node['FE'][:https_port]}" end @@ -43,8 +38,8 @@ end template "ssl-ini" do path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" source "ssl-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :https_port => "#{node['FE'][:https_port]}" , diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb index 2ce61b9c09..46bc80a021 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/recipes/FE_8_prepareProbeFile.rb @@ -6,7 +6,7 @@ else port = "#{node['FE'][:http_port]}" end -template "/var/lib/jetty/ready-probe.sh" do +template "#{ENV['JETTY_BASE']}/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 diff --git a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb index 5b772ecb15..eb69f2e8c0 100644 --- a/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb +++ b/catalog-fe/sdc-frontend/chef-repo/cookbooks/sdc-catalog-fe/templates/default/ready-probe.sh.erb @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/sh health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' <%= @protocol %>://127.0.0.1:<%= @port %>/sdc1/rest/healthCheck) -if [[ "$health_check_http_code" -eq 200 ]]; then +if [ "$health_check_http_code" -eq 200 ]; then exit 0 else echo "Health check http status: $health_check_http_code" diff --git a/catalog-fe/sdc-frontend/startup.sh b/catalog-fe/sdc-frontend/startup.sh index b2443f1aee..5a1dd27fb5 100644 --- a/catalog-fe/sdc-frontend/startup.sh +++ b/catalog-fe/sdc-frontend/startup.sh @@ -1,18 +1,18 @@ #!/bin/sh -JAVA_OPTIONS=" ${JAVA_OPTIONS} \ - -Dconfig.home=${JETTY_BASE}/config \ - -Dlog.home=${JETTY_BASE}/logs \ - -Dlogback.configurationFile=${JETTY_BASE}/config/catalog-fe/logback.xml \ - -Dconfiguration.yaml=${JETTY_BASE}/config/catalog-fe/configuration.yaml \ - -Donboarding_configuration.yaml=${JETTY_BASE}/config/onboarding-fe/onboarding_configuration.yaml \ - -Djavax.net.ssl.trustStore=${JETTY_BASE}/etc/org.onap.sdc.trust.jks \ +JAVA_OPTIONS="$JAVA_OPTIONS \ + -Dconfig.home=$JETTY_BASE/config \ + -Dlog.home=$JETTY_BASE/logs \ + -Dlogback.configurationFile=$JETTY_BASE/config/catalog-fe/logback.xml \ + -Dconfiguration.yaml=$JETTY_BASE/config/catalog-fe/configuration.yaml \ + -Donboarding_configuration.yaml=$JETTY_BASE/config/onboarding-fe/onboarding_configuration.yaml \ + -Djavax.net.ssl.trustStore=$JETTY_BASE/etc/org.onap.sdc.trust.jks \ -Djavax.net.ssl.trustStorePassword=z+KEj;t+,KN^iimSiS89e#p0 \ - -Djetty.console-capture.dir=${JETTY_BASE}/logs " + -Djetty.console-capture.dir=$JETTY_BASE/logs" -cd /var/lib/jetty/chef-solo +cd $JETTY_BASE/chef-solo chef-solo -c solo.rb -E ${ENVNAME} -cd /var/lib/jetty +cd $JETTY_HOME -java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" +java $JAVA_OPTIONS -jar "${JETTY_HOME}/start.jar" diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 866e2ee80a..87761e6f0c 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -406,7 +406,7 @@ limitations under the License. </dependency> </dependencies> <configuration> - <verbose>true</verbose> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <autoCreateCustomNetworks>true</autoCreateCustomNetworks> <images> @@ -479,6 +479,7 @@ limitations under the License. <bind> <volume>${it.chef.config}:/home/sdc/chef-solo/environments </volume> + </bind> </volumes> <wait> @@ -549,13 +550,10 @@ limitations under the License. <hostname>sdc-onboard-BE</hostname> <volumes> <bind> - <volume> - ${it.chef.config}:/var/lib/jetty/chef-solo/environments - </volume> - <volume> - ${project.basedir}/src/test/resources/cert/onboarding-be:/var/lib/jetty/onap/cert + <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume> + <volume>${project.basedir}/src/test/resources/cert/onboarding-be:/app/jetty/onap/cert </volume> - <volume>${it.shared.volume}:/var/lib/jetty/logs</volume> + <volume>${it.shared.volume}:/app/jetty/logs</volume> </bind> </volumes> <wait> @@ -603,12 +601,10 @@ limitations under the License. <hostname>sdc-BE</hostname> <volumes> <bind> + <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume> + <volume>${it.shared.volume}:/app/jetty/logs</volume> <volume> - ${it.chef.config}:/var/lib/jetty/chef-solo/environments - </volume> - <volume>${it.shared.volume}:/var/lib/jetty/logs</volume> - <volume> - ${project.basedir}/src/test/resources/cert/catalog-be:/var/lib/jetty/onap/cert + ${project.basedir}/src/test/resources/cert/catalog-be:/app/jetty/onap/cert </volume> </bind> </volumes> @@ -652,7 +648,7 @@ limitations under the License. <volume> ${it.chef.config}:/home/onap/chef-solo/environments </volume> - <volume>${it.shared.volume}:/var/lib/jetty/logs</volume> + <volume>${it.shared.volume}:/home/onap/logs</volume> </bind> </volumes> <wait> @@ -680,13 +676,12 @@ limitations under the License. <hostname>sdc-FE</hostname> <volumes> <bind> + <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume> + <volume>${it.shared.volume}:/app/jetty/logs</volume> <volume> - ${it.chef.config}:/var/lib/jetty/chef-solo/environments - </volume> - <volume>${it.shared.volume}:/var/lib/jetty/logs</volume> - <volume> - ${it.chef.config}/plugins-configuration.yaml:/var/lib/jetty/config/catalog-fe/plugins-configuration.yaml + ${it.chef.config}/plugins-configuration.yaml:/app/jetty/config/catalog-fe/plugins-configuration.yaml </volume> + </bind> </volumes> <wait> @@ -728,8 +723,8 @@ limitations under the License. <hostname>sdc-sim</hostname> <volumes> <bind> - <volume>${it.chef.config}:/root/chef-solo/environments - </volume> + <volume>${it.chef.config}:/app/jetty/chef-solo/environments</volume> + <volume>${it.shared.volume}:/app/jetty/logs</volume> </bind> </volumes> <wait> diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile index 9c6275d87a..c3f3a757ac 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile @@ -1,20 +1,18 @@ -FROM jetty:9.4.31-jre11-slim +FROM onap/integration-java11:8.0.0 USER root +ARG JETTY_FOLDER=/app/jetty # Install Chef RUN set -ex && \ - apt-get update -y && \ - apt-get install -y \ - jq \ - curl \ - vim \ - make \ - gcc \ + apk update && \ + apk add --no-cache \ + build-base \ ruby \ ruby-dev \ libffi-dev \ - libxml2-dev && \ + libxml2-dev \ + libressl-dev && \ gem install \ chef:13.8.5 \ berkshelf:6.3.1 \ @@ -22,33 +20,30 @@ RUN set -ex && \ etc webrick \ --no-document && \ gem cleanup && \ - apt-get update -y && \ - apt-get install -y binutils jq && \ - apt-get clean - -# Replace Jetty user ID -ENV USER_JETTY="jetty" -ENV GROUP_JETTY="jetty" -ENV UID_JETTY="352070" -ENV GID_JETTY="35953" - -# Remove user: -RUN deluser ${USER_JETTY} -#RUN delgroup ${GROUP_JETTY} -RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd -RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group -RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow -RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty - -USER jetty - -COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ -COPY --chown=jetty:jetty chef-repo/cookbooks ${JETTY_BASE}/chef-solo/cookbooks/ -ADD --chown=jetty:jetty onboarding-be-*.war ${JETTY_BASE}/webapps/ -ADD --chown=jetty:jetty api-docs.war ${JETTY_BASE}/webapps/ -COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ - -RUN chmod 770 ${JETTY_BASE}/startup.sh - -ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] + apk update + +ENV JETTY_HOME=$JETTY_FOLDER +ENV JETTY_BASE=$JETTY_FOLDER +ENV JETTY_USER=onap +ENV JETTY_GROUP=onap + +RUN mkdir $JETTY_FOLDER && chown onap:onap $JETTY_FOLDER + +USER onap + +#Download jetty +RUN wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.31.v20200723/jetty-distribution-9.4.31.v20200723.tar.gz -O $JETTY_FOLDER/jetty.tar.gz && \ + tar xvz -C $JETTY_FOLDER -f $JETTY_FOLDER/jetty.tar.gz --strip 1 && \ + rm -rf $JETTY_FOLDER/jetty.tar.gz +RUN sed -i 's/"jetty"/"onap"/g' $JETTY_FOLDER/etc/jetty-setuid.xml + + +COPY --chown=onap:onap chef-solo $JETTY_FOLDER/chef-solo/ +COPY --chown=onap:onap chef-repo/cookbooks $JETTY_FOLDER/chef-solo/cookbooks/ +ADD --chown=onap:onap onboarding-be-*.war $JETTY_FOLDER/webapps/ +ADD --chown=onap:onap api-docs.war $JETTY_FOLDER/webapps/ +COPY --chown=onap:onap startup.sh $JETTY_FOLDER/ + +RUN chmod 770 $JETTY_FOLDER/startup.sh + +ENTRYPOINT [ "sh", "-c", "${JETTY_HOME}/startup.sh"] diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb index 761edc9e5b..074584a6e8 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/attributes/default.rb @@ -8,6 +8,7 @@ default['cassandra'][:truststore_password] = "Aa123456" default['jetty'][:keystore_pwd] = "?(kP!Yur![*!Y5!E^f(ZKc31" default['jetty'][:keymanager_pwd] = "?(kP!Yur![*!Y5!E^f(ZKc31" default['jetty'][:truststore_pwd] = "z+KEj;t+,KN^iimSiS89e#p0" +default['jetty']['truststore_path'] = "#{ENV['JETTY_BASE']}/etc/truststore" default['VnfRepo']['vnfRepoPort'] = 8702 default['VnfRepo']['vnfRepoHost'] = "refrepo" diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_1_cleanup_jettydir.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_1_cleanup_jettydir.rb index 2c703f2039..305ff2384b 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_1_cleanup_jettydir.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_1_cleanup_jettydir.rb @@ -1,23 +1,23 @@ directory "tempdir_creation" do path "#{ENV['JETTY_BASE']}/temp" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end directory "create_config_dir" do path "#{ENV['JETTY_BASE']}/config" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end directory "onboarding-be" do path "#{ENV['JETTY_BASE']}/config/onboarding-be" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb index e482b693e7..1a678397d8 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_2_locate_keystore.rb @@ -1,22 +1,22 @@ directory "Jetty_etcdir_creation" do path "#{ENV['JETTY_BASE']}/etc" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode 0755 end diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_3_logback.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_3_logback.rb index 823c3cd44e..0d97645420 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_3_logback.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_3_logback.rb @@ -1,7 +1,7 @@ cookbook_file "#{ENV['JETTY_BASE']}/config/onboarding-be/logback.xml" do source "logback.xml" mode 0755 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_4_setup_jetty_modules.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_4_setup_jetty_modules.rb index 64a02e9559..9fe747851e 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_4_setup_jetty_modules.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_4_setup_jetty_modules.rb @@ -5,22 +5,17 @@ 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 +execute "create-jetty-modules" do + command "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" + cwd "#{ENV['JETTY_BASE']}" + action :run end - template "http-ini" do path "#{ENV['JETTY_BASE']}/start.d/http.ini" source "http-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :http_option => http_option , @@ -33,8 +28,8 @@ end template "https-ini" do path "#{ENV['JETTY_BASE']}/start.d/https.ini" source "https-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables :https_port => "#{node['ONBOARDING_BE'][:https_port]}" end @@ -43,8 +38,8 @@ end template "ssl-ini" do path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" source "ssl-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables ({ :https_port => "#{node['ONBOARDING_BE'][:https_port]}" , diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb index d767ddd1c8..e7048427c7 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_5_setup_configuration.rb @@ -1,8 +1,8 @@ template "onboard-be-config" do path "#{ENV['JETTY_BASE']}/config/onboarding-be/onboarding_configuration.yaml" source "configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :onboard_ip => node['ONBOARDING_BE_VIP'], @@ -32,8 +32,8 @@ end template "VnfrepoConfiguration" do path "#{ENV['JETTY_BASE']}/config/onboarding-be/config-vnfrepo.yaml" source "vnfrepo-configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :VNFREPO_IP => node['VnfRepo']['vnfRepoHost'], @@ -46,8 +46,8 @@ end template "ExternalTestingConfiguration" do path "#{ENV['JETTY_BASE']}/config/onboarding-be/externaltesting-configuration.yaml" source "externaltesting-configuration.yaml.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :EP1_CONFIG => node['EXTTEST']['ep1_config'], diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_6_prepareProbeFile.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_6_prepareProbeFile.rb index 8d77d61481..6351be35b2 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_6_prepareProbeFile.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_6_prepareProbeFile.rb @@ -6,7 +6,7 @@ else port = "#{node['ONBOARDING_BE'][:http_port]}" end -template "/var/lib/jetty/ready-probe.sh" do +template "#{ENV['JETTY_BASE']}/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_7_setup_base_template.rb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_7_setup_base_template.rb index c84e660534..2660eb0e6d 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_7_setup_base_template.rb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/recipes/ON_7_setup_base_template.rb @@ -1,14 +1,13 @@ cookbook_file "#{ENV['JETTY_BASE']}/resources/base_template.yaml" do source "base_template.yaml" mode 0644 - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" end - + cookbook_file "#{ENV['JETTY_BASE']}/resources/base_template.env" do source "base_template.env" mode 0644 - owner "jetty" - group "jetty" -end - + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" +end
\ No newline at end of file diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb index a7b0411e9e..853fcf7ab6 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/configuration.yaml.erb @@ -28,7 +28,7 @@ cassandraConfig: username: <%= @cassandra_usr %> password: <%= @cassandra_pwd %> ssl: <%= @cassandra_ssl_enabled %> - truststorePath: /var/lib/jetty/etc/truststore + truststorePath: <%= node['jetty']['truststore_path'] %> truststorePassword: <%= @cassandra_truststore_password %> # access restriction diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb index bea3c34488..4ca281cee3 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/chef-repo/cookbooks/sdc-onboard-backend/templates/default/ready-probe.sh.erb @@ -1,6 +1,6 @@ -#!/bin/bash +#!/bin/sh health_check_http_code=$(curl -k --max-time 5 -o /dev/null -w '%{http_code}' -X GET --header "Accept: application/json" "<%= @protocol %>://127.0.0.1:<%= @port %>/onboarding-api/v1.0/healthcheck") -if [[ "$health_check_http_code" -eq 200 ]]; then +if [ "$health_check_http_code" -eq 200 ]; then exit 0 else echo "Health check http status: $health_check_http_code" diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh index cf1b6227ad..7381d50dfe 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh @@ -1,21 +1,18 @@ #!/bin/sh -cd /var/lib/jetty/chef-solo -chef-solo -c solo.rb -E ${ENVNAME} -rc=$? -if [ $rc -ne 0 ]; then - echo "Chef exaction failed." - exit $rc; -fi +JAVA_OPTIONS="$JAVA_OPTIONS \ + -Dcom.datastax.driver.USE_NATIVE_CLOCK=false \ + -Dconfig.home=$JETTY_BASE/config \ + -Dlog.home=$JETTY_BASE/logs \ + -Dlogback.configurationFile=$JETTY_BASE/config/onboarding-be/logback.xml \ + -Dconfiguration.yaml=$JETTY_BASE/config/onboarding-be/onboarding_configuration.yaml \ + -Dconfig.location=$JETTY_BASE/config/onboarding-be/." +cd $JETTY_BASE -JAVA_OPTIONS=" ${JAVA_OPTIONS} \ - -Dconfig.home=${JETTY_BASE}/config \ - -Dlog.home=${JETTY_BASE}/logs \ - -Dlogback.configurationFile=${JETTY_BASE}/config/onboarding-be/logback.xml \ - -Dconfiguration.yaml=${JETTY_BASE}/config/onboarding-be/onboarding_configuration.yaml \ - -Dconfig.location=${JETTY_BASE}/config/onboarding-be/." +cd $JETTY_BASE/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} -cd /var/lib/jetty +cd $JETTY_HOME -java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" +java $JAVA_OPTIONS -jar "${JETTY_HOME}/start.jar" diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml index 3002ff529d..ce0de87c4a 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml +++ b/openecomp-be/dist/sdc-onboard-backend-docker/pom.xml @@ -108,7 +108,8 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> - <apiVersion>1.23</apiVersion> + <verbose>${verbose}</verbose> + <apiVersion>${docker.api.version}</apiVersion> <registry>${docker.registry}</registry> <authConfig> <pull> diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile index 226654ddc3..8408d2f51c 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile @@ -25,17 +25,14 @@ RUN apt-get update && apt-get install -y python-pip && \ libffi-dev \ libxml2-dev && \ gem install chef:13.8.5 berkshelf:6.3.1 io-console:0.4.6 etc webrick --no-document && \ - apt-get update -y && \ + apt-get update -y && apt-get remove bash -y --allow-remove-essential && \ apt-get install -y binutils && apt-get clean && gem cleanup USER sdc COPY --chown=sdc:sdc init_keyspaces.cql /home/sdc/ - COPY --chown=sdc:sdc init_schemas.cql /home/sdc/ - -COPY --chown=sdc:sdc alter_tables.cql /home/sdc/ - +COPY --chown=sdc:sdc alter_tables.cql /home/sdc/ COPY --chown=sdc:sdc startup.sh /home/sdc/ RUN chmod 770 /home/sdc/startup.sh diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/startup.sh b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/startup.sh index 2f398b2f91..92bf869ccc 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/startup.sh +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/startup.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh cd /home/sdc @@ -21,7 +21,7 @@ cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_keyspaces.cql $CS_HOST $CS_PORT rc=$? date; -if [[ $rc != 0 ]]; then +if [ $rc != 0 ]; then echo "[Error] Failed to initialize onboard keyspaces"; exit $rc; fi @@ -32,7 +32,7 @@ cqlsh -u $SDC_USER -p $SDC_PASSWORD -f init_schemas.cql $CS_HOST $CS_PORT rc=$? date; -if [[ $rc != 0 ]]; then +if [ $rc != 0 ]; then echo "[Error] Failed to initialize onboard schemas"; exit $rc; fi diff --git a/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml b/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml index 9ce1125474..e4ea7a7859 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/pom.xml @@ -59,6 +59,7 @@ <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> @@ -176,6 +176,8 @@ Modifications copyright (c) 2018-2019 Nokia <docker.api.version>1.35</docker.api.version> <bouncycastle.version>1.68</bouncycastle.version> + + <verbose>false</verbose> </properties> <dependencyManagement> diff --git a/sdc-os-chef/pom.xml b/sdc-os-chef/pom.xml index c5d82ceb88..01cc295023 100644 --- a/sdc-os-chef/pom.xml +++ b/sdc-os-chef/pom.xml @@ -59,6 +59,7 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> diff --git a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb index a9d71808b8..d3f5da6b12 100644 --- a/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb +++ b/sdc-os-chef/sdc-cassandra/chef-repo/cookbooks/cassandra-actions/templates/default/change_cassandra_pass.sh.erb @@ -8,16 +8,16 @@ pass_changed=99 retry_num=1 is_up=0 while [ $is_up -eq 0 -a $retry_num -le 100 ]; do - echo "exit" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p cassandra $CASSANDRA_IP $CASSANDRA_PORT res1=$? - echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP $CASSANDRA_PORT > /dev/null 2>&1 + echo "exit" | cqlsh -u cassandra -p $CASSANDRA_PASS $CASSANDRA_IP $CASSANDRA_PORT res2=$? if [ $res1 -eq 0 -o $res2 -eq 0 ]; then - echo "`date` --- cqlsh is enabled to connect." + echo "`date` --- cqlsh is able to connect." is_up=1 else - echo "`date` --- cqlsh is NOT enabled to connect yet. sleep 5" + echo "`date` --- cqlsh is NOT able to connect yet. sleep 5" sleep 5 fi let "retry_num++" diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml index 0c25336542..ca95ef8cdc 100644 --- a/utils/webseal-simulator/pom.xml +++ b/utils/webseal-simulator/pom.xml @@ -214,6 +214,7 @@ <groupId>io.fabric8</groupId> <artifactId>docker-maven-plugin</artifactId> <configuration> + <verbose>${verbose}</verbose> <apiVersion>${docker.api.version}</apiVersion> <registry>nexus3.onap.org:10001</registry> <authConfig> diff --git a/utils/webseal-simulator/scripts/simulator_docker_run.sh b/utils/webseal-simulator/scripts/simulator_docker_run.sh index 51fc082e24..059947f263 100755 --- a/utils/webseal-simulator/scripts/simulator_docker_run.sh +++ b/utils/webseal-simulator/scripts/simulator_docker_run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh export PREFIX=${NEXUS_DOCKER_REPO}'/onap' PREFIX='onap' diff --git a/utils/webseal-simulator/sdc-simulator/Dockerfile b/utils/webseal-simulator/sdc-simulator/Dockerfile index 24a7dd1943..31af19e8be 100644 --- a/utils/webseal-simulator/sdc-simulator/Dockerfile +++ b/utils/webseal-simulator/sdc-simulator/Dockerfile @@ -1,17 +1,13 @@ -FROM jetty:9.4.31-jre11-slim +FROM onap/integration-java11:8.0.0 USER root +ARG JETTY_FOLDER=/app/jetty # Install Chef RUN set -ex && \ - apt-get update -y && \ - apt-get install -y \ - jq \ - curl \ - curl \ - vim \ - make \ - gcc \ + apk update && \ + apk add --no-cache \ + build-base \ ruby \ ruby-dev \ libffi-dev \ @@ -23,39 +19,28 @@ RUN set -ex && \ etc webrick \ --no-document && \ gem cleanup && \ - apt-get update -y && \ - apt-get install -y binutils jq && \ - apt-get clean + apk update -# Replace Jetty user ID -ENV USER_JETTY="jetty" -ENV GROUP_JETTY="jetty" -ENV UID_JETTY="352070" -ENV GID_JETTY="35953" +ENV JETTY_HOME=$JETTY_FOLDER +ENV JETTY_BASE=$JETTY_FOLDER +ENV JETTY_USER=onap +ENV JETTY_GROUP=onap -# Remove user: -RUN deluser ${USER_JETTY} -#RUN delgroup ${GROUP_JETTY} -RUN echo "${USER_JETTY}:x:${UID_JETTY}:${GID_JETTY}::/home/${USER_JETTY}:Linux User,,,:/home/jetty:/bin/false" >> /etc/passwd -RUN echo "${GROUP_JETTY}:x:${GID_JETTY}:${USER_JETTY}" >> /etc/group -RUN echo "${USER_JETTY}:!:17501:0:99999:7:::" >> /etc/shadow -RUN mkdir /home/${USER_JETTY} && chown ${USER_JETTY}:${GROUP_JETTY} /home/${USER_JETTY} -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps /var/lib/jetty +RUN mkdir $JETTY_FOLDER && chown onap:onap $JETTY_FOLDER -USER jetty +USER onap -COPY chef-solo /root/chef-solo/ +#Download jetty +RUN wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-distribution/9.4.31.v20200723/jetty-distribution-9.4.31.v20200723.tar.gz -O $JETTY_FOLDER/jetty.tar.gz && \ + tar xvz -C $JETTY_FOLDER -f $JETTY_FOLDER/jetty.tar.gz --strip 1 && \ + rm -rf $JETTY_FOLDER/jetty.tar.gz +RUN sed -i 's/"jetty"/"onap"/g' $JETTY_FOLDER/etc/jetty-setuid.xml -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +COPY --chown=onap:onap chef-solo $JETTY_FOLDER/chef-solo/ +COPY --chown=onap:onap chef-repo/cookbooks $JETTY_FOLDER/chef-solo/cookbooks/ +ADD --chown=onap:onap WSSimulator*.war $JETTY_FOLDER/webapps/ +COPY --chown=onap:onap startup.sh $JETTY_FOLDER/ -ADD WSSimulator*.war ${JETTY_BASE}/webapps/ +RUN chmod 770 $JETTY_FOLDER/startup.sh -USER root - -RUN chown -R jetty:jetty ${JETTY_BASE}/webapps - -COPY startup.sh ${JETTY_BASE}/ - -RUN chmod 777 ${JETTY_BASE}/startup.sh - -ENTRYPOINT [ "sh", "-c", "${JETTY_BASE}/startup.sh"] +ENTRYPOINT [ "sh", "-c", "${JETTY_HOME}/startup.sh"] diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_1_cleanup_jettydir.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_1_cleanup_jettydir.rb index c02aa7e58d..a1156ee742 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_1_cleanup_jettydir.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_1_cleanup_jettydir.rb @@ -1,7 +1,7 @@ directory "SDC_Simulator_tempdir_creation" do path "#{ENV['JETTY_BASE']}/temp" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -9,8 +9,8 @@ end directory "SDC_Simulator_create_config_dir" do path "#{ENV['JETTY_BASE']}/config" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end @@ -18,8 +18,8 @@ end directory "SDC_Simulator_create_sdc-simulator" do path "#{ENV['JETTY_BASE']}/config/sdc-simulator" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode '0755' action :create end diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb index bf859f13a3..3769a1f723 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb @@ -10,8 +10,8 @@ end template "webseal.conf" do path "#{ENV['JETTY_BASE']}/config/sdc-simulator/webseal.conf" source "SDC-Simulator-webseal.conf.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :fe_url =>"#{fe_url}" diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb index 14f83c34de..3abca7b8a8 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb @@ -1,7 +1,7 @@ cookbook_file "log4j2.properties" do path "#{ENV['JETTY_BASE']}/config/sdc-simulator/log4j2.properties" source "log4j2.properties" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" end
\ No newline at end of file diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_locate_keystore.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_locate_keystore.rb index e0b106de72..4c83e790ae 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_locate_keystore.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_locate_keystore.rb @@ -1,21 +1,21 @@ directory "Jetty_etcdir_creation" do path "#{ENV['JETTY_BASE']}/etc" - owner 'jetty' - group 'jetty' + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" 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" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode 0755 end cookbook_file "#{ENV['JETTY_BASE']}/etc/org.onap.sdc.p12" do source "org.onap.sdc.p12" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode 0755 end diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_5_create_jetty_modules.rb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_5_create_jetty_modules.rb index 5b67561b02..5e0d8eb50a 100644 --- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_5_create_jetty_modules.rb +++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_5_create_jetty_modules.rb @@ -6,22 +6,17 @@ 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 +execute "create-jetty-modules" do + command "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" + cwd "#{ENV['JETTY_BASE']}" + action :run end - template "http-ini" do path "#{ENV['JETTY_BASE']}/start.d/http.ini" source "SDC-Simulator-http-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :http_option => http_option, @@ -33,8 +28,8 @@ end template "https-ini" do path "#{ENV['JETTY_BASE']}/start.d/https.ini" source "SDC-Simulator-https-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :https_port => "8443" @@ -46,8 +41,8 @@ end template "ssl-ini" do path "#{ENV['JETTY_BASE']}/start.d/ssl.ini" source "SDC-Simulator-ssl-ini.erb" - owner "jetty" - group "jetty" + owner "#{ENV['JETTY_USER']}" + group "#{ENV['JETTY_GROUP']}" mode "0755" variables({ :https_port => "8443", @@ -57,10 +52,7 @@ template "ssl-ini" do }) end - -bash "echo status" do - code <<-EOH - echo "DOCKER STARTED" - EOH -end - +execute "echo status" do + command "echo 'DOCKER STARTED'" + action :run +end
\ No newline at end of file diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh index 3f6e2a02b5..e8774be9f0 100644 --- a/utils/webseal-simulator/sdc-simulator/startup.sh +++ b/utils/webseal-simulator/sdc-simulator/startup.sh @@ -1,24 +1,19 @@ #!/bin/sh -cd /root/chef-solo -chef-solo -c solo.rb -E ${ENVNAME} -rc=$? -if [ $rc -ne 0 ]; then - echo "Chef exaction failed." - exit $rc; -fi - -JAVA_OPTIONS=" ${JAVA_OPTIONS} \ +JAVA_OPTIONS=" $JAVA_OPTIONS \ -Xdebug -agentlib:jdwp=transport=dt_socket,address=5000,server=y,suspend=n -Xmx128m -Xms128m -Xss1m \ - -Dconfig.home=${JETTY_BASE}/config/sdc-simulator \ - -Dlog.home=${JETTY_BASE}/logs \ - -Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml \ - -Djavax.net.ssl.trustStore=${JETTY_BASE}/etc/org.onap.sdc.trust.jks \ + -Dconfig.home=$JETTY_BASE/config/sdc-simulator \ + -Dlog.home=$JETTY_BASE/logs \ + -Dlogback.configurationFile=$JETTY_BASE/config/sdc-simulator/logback.xml \ + -Djavax.net.ssl.trustStore=$JETTY_BASE/etc/org.onap.sdc.trust.jks \ -Djavax.net.ssl.trustStorePassword=z+KEj;t+,KN^iimSiS89e#p0 \ - -Djetty.console-capture.dir=${JETTY_BASE}/logs" + -Djetty.console-capture.dir=$JETTY_BASE/logs" -cd /var/lib/jetty +cd $JETTY_BASE/chef-solo +chef-solo -c solo.rb -E ${ENVNAME} + +cd $JETTY_HOME -java $JAVA_OPTIONS -jar "$JETTY_HOME/start.jar" +java $JAVA_OPTIONS -jar "${JETTY_HOME}/start.jar" |