diff options
author | MichaelMorris <michael.morris@est.tech> | 2020-03-10 12:37:48 +0000 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-03-16 08:45:37 +0000 |
commit | 69ba31d1ea0b20c19df0e462a5bbb4b67097146a (patch) | |
tree | 99e5512aef2fb147fc3a7accbb72b7288e3255be | |
parent | 9272b75cc0d70645de21885b98200c1b9684dac9 (diff) |
Run pods as non-root user
Summary of changes:
sdc-cassandra-init
Added user sdc (in base image base_sdc-cqlsh - https://gerrit.onap.org/r/103436)
Run entrypoint as user sdc
Moved relevant files from /root/ to /home/sdc/
sdc-backend-init
Added user sdc (in base image base_sdc-python - https://gerrit.onap.org/r/103436)
Run entrypoint as user sdc
Moved relevant files from /root/ to /home/sdc/
sdc-backend
Run entrypoint as user jetty
Moved relevant files from /root/ to /var/lib/jetty/
Moved cadi & cert files from /opt/app/jetty to /var/lib/jetty/
Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh
sdc-frontend
Run entrypoint as user jetty
Moved relevant files from /root/ to /var/lib/jetty/
Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh
sdc-onboard-backend-docker
Run entrypoint as user jetty
Moved relevant files from /root/ to /var/lib/jetty/
Moved ready_probe from /var/lib/read-probe.sh to /var/lib/jetty/read-probe.sh
sdc-onboard-db-init-docker
Run entrypoint as user sdc
Added user sdc (in base image base_sdc-cqlsh - https://gerrit.onap.org/r/103436)
Moved relevant files from /root/ to /home/sdc/
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Issue-ID: SDC-2798
Change-Id: I85be320a4a5e1cc5aeebbb98c4484d5d6fd06dfc
(cherry picked from commit a2abf6ea18d512d367277bacaf7476754dc0eff5)
25 files changed, 87 insertions, 130 deletions
diff --git a/.gitignore b/.gitignore index 33ad652efd..852967b58a 100644 --- a/.gitignore +++ b/.gitignore @@ -272,3 +272,4 @@ asdctool/report_test_1538046722484.json /ajcore*.txt **/.factorypath +**/.checkstyle diff --git a/asdctool/sdc-cassandra-init/Dockerfile b/asdctool/sdc-cassandra-init/Dockerfile index 64dbe05e5d..b1ff2ae95e 100644 --- a/asdctool/sdc-cassandra-init/Dockerfile +++ b/asdctool/sdc-cassandra-init/Dockerfile @@ -1,12 +1,12 @@ -FROM onap/base_sdc-cqlsh:1.5.0-SNAPSHOT-latest +FROM onap/base_sdc-cqlsh:1.6.0-SNAPSHOT-latest -COPY chef-solo /root/chef-solo/ +COPY --chown=sdc:sdc chef-solo /home/sdc/chef-solo/ -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +COPY --chown=sdc:sdc chef-repo/cookbooks /home/sdc/chef-solo/cookbooks/ -COPY startup.sh /root/ +COPY --chown=sdc:sdc startup.sh /home/sdc/ -RUN chmod 770 /root/startup.sh +RUN chmod 770 /home/sdc/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT [ "/home/sdc/startup.sh" ] diff --git a/asdctool/sdc-cassandra-init/startup.sh b/asdctool/sdc-cassandra-init/startup.sh index 13c882ab09..3e474f3c89 100644 --- a/asdctool/sdc-cassandra-init/startup.sh +++ b/asdctool/sdc-cassandra-init/startup.sh @@ -1,6 +1,6 @@ #!/bin/bash -cd /root/chef-solo +cd /home/sdc/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? -if [[ $rc != 0 ]]; then exit $rc; fi
\ No newline at end of file +if [[ $rc != 0 ]]; then exit $rc; fi diff --git a/catalog-be/sdc-backend-init/Dockerfile b/catalog-be/sdc-backend-init/Dockerfile index 8b1a2e60ea..cb26610859 100644 --- a/catalog-be/sdc-backend-init/Dockerfile +++ b/catalog-be/sdc-backend-init/Dockerfile @@ -1,11 +1,11 @@ -FROM onap/base_sdc-python:1.4.1 +FROM onap/base_sdc-python:1.6.0-SNAPSHOT-latest -COPY chef-solo /root/chef-solo/ +COPY --chown=sdc:sdc chef-solo /home/sdc/chef-solo/ -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +COPY --chown=sdc:sdc chef-repo/cookbooks /home/sdc/chef-solo/cookbooks/ -COPY startup.sh /root/ +COPY --chown=sdc:sdc startup.sh /home/sdc/ -RUN chmod 770 /root/startup.sh +RUN chmod 770 /home/sdc/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT [ "/home/sdc/startup.sh" ] diff --git a/catalog-be/sdc-backend-init/startup.sh b/catalog-be/sdc-backend-init/startup.sh index 0a96e49723..a379677bfb 100644 --- a/catalog-be/sdc-backend-init/startup.sh +++ b/catalog-be/sdc-backend-init/startup.sh @@ -1,6 +1,6 @@ #!/bin/sh -cd /root/chef-solo || exit $? +cd /home/sdc/chef-solo || exit $? chef-solo -c solo.rb -E "${ENVNAME}" rc=$? if [ $rc != 0 ]; then exit $rc; fi diff --git a/catalog-be/sdc-backend/Dockerfile b/catalog-be/sdc-backend/Dockerfile index 104bbd9274..833008dfac 100644 --- a/catalog-be/sdc-backend/Dockerfile +++ b/catalog-be/sdc-backend/Dockerfile @@ -1,16 +1,13 @@ FROM onap/base_sdc-jetty:1.6.0 - -COPY chef-solo /root/chef-solo/ - -COPY chef-repo/cookbooks/. /root/chef-solo/cookbooks/ + +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 catalog-be-*.war ${JETTY_BASE}/webappwar/ ADD --chown=jetty:jetty context.xml ${JETTY_BASE}/webapps/ -USER root - -COPY startup.sh /root/ +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ -RUN chmod 770 /root/startup.sh +RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT ${JETTY_BASE}/startup.sh diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi.properties b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi.properties index 2d234c367f..1011ba344d 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi.properties +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi.properties @@ -1,4 +1,4 @@ ############################################################# # This file should be replaced with jetty cadi.properties: # -# /opt/app/jetty/base/be/etc/cadi.properties # -#############################################################
\ No newline at end of file +# /var/lib/jetty/base/be/etc/cadi.properties # +############################################################# diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi_truststore.jks b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi_truststore.jks index 6720910c1d..0835ef4542 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi_truststore.jks +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/cadi_truststore.jks @@ -1,4 +1,4 @@ ################################################################## ## This file should be replaced with jetty cadi_truststore.jks: # -## /opt/app/jetty/base/be/etc/cadi_truststore.jks # -##################################################################
\ No newline at end of file +## /var/lib/jetty/base/be/etc/cadi_truststore.jks # +################################################################## diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keyfile b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keyfile index 41876b7c09..43d20d4c05 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keyfile +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/files/default/keyfile @@ -1,4 +1,4 @@ ############################################################# # This file should be replaced with jetty keyfile: # -# /opt/app/jetty/base/be/etc/keyfile # -#############################################################
\ No newline at end of file +# /var/lib/jetty/base/be/etc/keyfile # +############################################################# diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb index b06f8a5342..3a79cfc874 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb +++ b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_10_setup_cadi.rb @@ -35,51 +35,3 @@ template "#{jetty_base}/etc/cadi.properties" do mode "0755" end - -#Workaround due to hardcode definition in cata,log-be web.xml file -directory "/opt/app/jetty" do - path "/opt/app/jetty" - owner 'jetty' - group 'jetty' - mode '0755' - recursive true - action :create -end - -directory "/opt/app/jetty/base/" do - path "/opt/app/jetty/base/" - owner 'jetty' - group 'jetty' - mode '0755' - recursive true - action :create -end - - -directory "/opt/app/jetty/base/be/" do - path "/opt/app/jetty/base/be/" - owner 'jetty' - group 'jetty' - mode '0755' - recursive true - action :create -end - -directory "/opt/app/jetty/base/be/etc" do - path "/opt/app/jetty/base/be/etc" - owner 'jetty' - group 'jetty' - mode '0755' - recursive true - action :create -end - -#Workaround due to hardcode definition in catalog-be web.xml file -template "/opt/app/jetty/base/be/etc/cadi.properties" do - path "/opt/app/jetty/base/be/etc/cadi.properties" - source "cadi.properties.erb" - owner "jetty" - group "jetty" - mode "0755" -end - diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb index 8d42c26acc..81e1a855f4 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/recipes/BE_9_prepareProbeFile.rb +++ b/catalog-be/sdc-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/ready-probe.sh" do +template "/var/lib/jetty/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 @@ -14,4 +14,4 @@ template "/var/lib/ready-probe.sh" do :protocol => protocol, :port => port }) -end
\ No newline at end of file +end diff --git a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb b/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb index a9df5c305e..0fa6936f74 100644 --- a/catalog-be/sdc-backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-distribution-engine-configuration.yaml.erb +++ b/catalog-be/sdc-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: /opt/app/jetty/base/be/etc/non-prod.jks + keyStore: /var/lib/jetty/base/be/etc/non-prod.jks keyStorePassword: hmXYcznAljMSisdy8zgcag== headers: X-FromAppId: asdc diff --git a/catalog-be/sdc-backend/startup.sh b/catalog-be/sdc-backend/startup.sh index e41aff40f0..abb307490f 100644 --- a/catalog-be/sdc-backend/startup.sh +++ b/catalog-be/sdc-backend/startup.sh @@ -11,7 +11,7 @@ export JAVA_OPTIONS=" -Dconfig.home=${JETTY_BASE}/config \ -Djetty.console-capture.dir=${JETTY_BASE}/logs \ ${JAVA_OPTIONS} " -cd /root/chef-solo +cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} status=$? diff --git a/catalog-be/src/main/resources/cadi.properties b/catalog-be/src/main/resources/cadi.properties index 0d6aee1d99..bbce36124d 100644 --- a/catalog-be/src/main/resources/cadi.properties +++ b/catalog-be/src/main/resources/cadi.properties @@ -13,7 +13,7 @@ hostname=onapportal csp_domain=PROD # Add Absolute path to Keyfile -cadi_keyfile=/opt/app/jetty/base/be/etc/keyfile +cadi_keyfile=/var/lib/jetty/opt/be/etc/keyfile # This is required to accept Certificate Authentication from Certman certificates. @@ -31,7 +31,7 @@ cadi_loglevel=DEBUG # Default TrustStore - REQUIRED for changing PROTOCOL Defaults for DME2 # Read https://wiki.web.att.com/pages/viewpage.action?pageId=574623569#URGENT:SolvingSSL2-3/TLSv1removalissues-Up-to-dateTruststore # Add Absolute path to truststore2018.jks -cadi_truststore=/opt/app/jetty/base/be/etc/cadi_truststore.jks +cadi_truststore=/var/lib/jetty/base/be/etc/cadi_truststore.jks # Note: This is the ONLY password that doesn't have to be encrypted. All Java's TrustStores are this passcode by default, because they are public certs cadi_truststore_password=changeit @@ -52,4 +52,4 @@ cadi_latitude=32.780140 cadi_longitude=-96.800451 aaf_root_ns=com.att.aaf -aaf_api_version=2.0
\ No newline at end of file +aaf_api_version=2.0 diff --git a/catalog-be/src/main/resources/config/configuration.yaml b/catalog-be/src/main/resources/config/configuration.yaml index 482bea1906..8dfe646629 100644 --- a/catalog-be/src/main/resources/config/configuration.yaml +++ b/catalog-be/src/main/resources/config/configuration.yaml @@ -111,7 +111,7 @@ cassandraConfig: username: asdc_user password: Aa1234%^! ssl: true - truststorePath : /opt/app/jetty/base/be/config/.truststore + truststorePath : /var/lib/jetty/opt/base/be/config/.truststore truststorePassword : Aa123456 keySpaces: - { name: dox, replicationStrategy: NetworkTopologyStrategy, replicationInfo: ['DC-sdc-iltlv650', '1']} @@ -816,7 +816,7 @@ dmaapConsumerConfiguration: password: XyCUPhFx9u70aklYGo6OiA== aftDme2SslEnable: true aftDme2ClientIgnoreSslConfig: false - aftDme2ClientKeystore: /opt/app/jetty/base/be/config/.truststore + aftDme2ClientKeystore: /var/lib/jetty/opt/base/be/config/.truststore aftDme2ClientKeystorePassword: XyCUPhFx9u70aklYGo6OiA== aftDme2ClientSslCertAlias: certman @@ -850,7 +850,7 @@ dmaapProducerConfiguration: password: XyCUPhFx9u70aklYGo6OiA== aftDme2SslEnable: true aftDme2ClientIgnoreSslConfig: false - aftDme2ClientKeystore: /opt/app/jetty/base/be/config/.truststore + aftDme2ClientKeystore: /var/lib/jetty/opt/jetty/base/be/config/.truststore aftDme2ClientKeystorePassword: XyCUPhFx9u70aklYGo6OiA== aftDme2ClientSslCertAlias: certman @@ -901,9 +901,9 @@ aafAuthNeeded: false cadiFilterParams: hostname: 192.168.33.10 csp_domain: PROD - cadi_keyfile: /opt/app/jetty/base/be/config/catalog-be/keyfile + cadi_keyfile: /var/lib/jetty/opt/base/be/config/catalog-be/keyfile cadi_loglevel: DEBUG - cadi_truststore: /opt/app/jetty/base/be/config/.truststore + cadi_truststore: /var/lib/jetty/opt/base/be/config/.truststore cadi_truststore_password: enc:XyCUPhFx9u70aklYGo6OiA== #aaf_url: https://aaf.onap.org/service=? aaf_id: aaf@sdc.onap.org @@ -918,4 +918,4 @@ cadiFilterParams: # This configuration entry lists all node type names prefix that shall be allowed on SDC. definedResourceNamespace: - - org.openecomp.resource.
\ No newline at end of file + - org.openecomp.resource. 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 1817ecbb2b..65a41e448e 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: /opt/app/jetty/base/be/etc/non-prod.jks + keyStore: /var/lib/jetty/opt/base/be/etc/non-prod.jks keyStorePassword: hmXYcznAljMSisdy8zgcag== headers: X-FromAppId: asdc diff --git a/catalog-fe/sdc-frontend/Dockerfile b/catalog-fe/sdc-frontend/Dockerfile index 5733dd25f5..66aea7b2cf 100644 --- a/catalog-fe/sdc-frontend/Dockerfile +++ b/catalog-fe/sdc-frontend/Dockerfile @@ -1,17 +1,17 @@ FROM onap/base_sdc-jetty:1.6.0 -COPY chef-solo /root/chef-solo/ +RUN mkdir -p ${JETTY_BASE}/config/catalog-fe -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +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*.war ${JETTY_BASE}/webapps/ ADD --chown=jetty:jetty catalog-fe-*.war ${JETTY_BASE}/webapps/ -USER root - -COPY startup.sh /root/ +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE} -RUN chmod 770 /root/startup.sh +RUN chmod 770 ${JETTY_BASE}/startup.sh -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT ${JETTY_BASE}/startup.sh 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 85ae99b847..2ce61b9c09 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/ready-probe.sh" do +template "/var/lib/jetty/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 @@ -14,4 +14,4 @@ template "/var/lib/ready-probe.sh" do :protocol => protocol, :port => port }) -end
\ No newline at end of file +end diff --git a/catalog-fe/sdc-frontend/startup.sh b/catalog-fe/sdc-frontend/startup.sh index 6080856f65..dda1e02dbf 100644 --- a/catalog-fe/sdc-frontend/startup.sh +++ b/catalog-fe/sdc-frontend/startup.sh @@ -10,7 +10,7 @@ JAVA_OPTIONS=" ${JAVA_OPTIONS} \ -Djavax.net.ssl.trustStorePassword=].][xgtze]hBhz*wy]}m#lf* \ -Djetty.console-capture.dir=${JETTY_BASE}/logs " -cd /root/chef-solo +cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} cd /var/lib/jetty diff --git a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile index e6a0dc1ec2..acc84ab393 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/Dockerfile @@ -1,17 +1,15 @@ FROM onap/base_sdc-jetty:1.6.0 -COPY chef-solo /root/chef-solo/ +COPY --chown=jetty:jetty chef-solo ${JETTY_BASE}/chef-solo/ -COPY chef-repo/cookbooks /root/chef-solo/cookbooks/ +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/ -USER root +COPY --chown=jetty:jetty startup.sh ${JETTY_BASE}/ -COPY startup.sh /root/ +RUN chmod 770 ${JETTY_BASE}/startup.sh -RUN chmod 770 /root/startup.sh - -ENTRYPOINT [ "/root/startup.sh" ] +ENTRYPOINT ${JETTY_BASE}/startup.sh 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 c8102e43ee..8d77d61481 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/ready-probe.sh" do +template "/var/lib/jetty/ready-probe.sh" do source "ready-probe.sh.erb" sensitive true mode 0755 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 413fdb317e..df8cefbd85 100644 --- a/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh +++ b/openecomp-be/dist/sdc-onboard-backend-docker/artifacts/startup.sh @@ -1,7 +1,7 @@ #!/bin/sh -cd /root/chef-solo +cd /var/lib/jetty/chef-solo chef-solo -c solo.rb -E ${ENVNAME} rc=$? if [[ $rc != 0 ]]; then @@ -21,4 +21,4 @@ cd /var/lib/jetty /docker-entrypoint.sh & -while true; do sleep 2; done
\ No newline at end of file +while true; do sleep 2; done 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 29189dbb4c..8dfc8a86f5 100644 --- a/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile +++ b/openecomp-be/dist/sdc-onboard-db-init-docker/artifacts/Dockerfile @@ -1,14 +1,13 @@ -FROM onap/base_sdc-cqlsh:1.5.0-SNAPSHOT-latest +FROM onap/base_sdc-cqlsh:1.6.0-SNAPSHOT-latest -COPY init_keyspaces.cql /root/ +COPY --chown=sdc:sdc init_keyspaces.cql /home/sdc/ -COPY init_schemas.cql /root/ +COPY --chown=sdc:sdc init_schemas.cql /home/sdc/ -COPY alter_tables.cql /root/ +COPY --chown=sdc:sdc alter_tables.cql /home/sdc/ -COPY startup.sh /root/ +COPY --chown=sdc:sdc startup.sh /home/sdc/ -RUN chmod 770 /root/startup.sh - -ENTRYPOINT [ "/root/startup.sh" ] +RUN chmod 770 /home/sdc/startup.sh +ENTRYPOINT [ "/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 02354dbd6e..2f398b2f91 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,6 +1,6 @@ #!/bin/bash -cd /root +cd /home/sdc CS_PORT="" CS_HOST=127.0.0.1 diff --git a/sdc-os-chef/scripts/docker_run.sh b/sdc-os-chef/scripts/docker_run.sh index 7d24c98c10..e51f499588 100755 --- a/sdc-os-chef/scripts/docker_run.sh +++ b/sdc-os-chef/scripts/docker_run.sh @@ -113,6 +113,16 @@ function ready_probe { } # +function ready_probe_jetty { + docker exec $1 /var/lib/jetty/ready-probe.sh > /dev/null 2>&1 + rc=$? + if [[ ${rc} == 0 ]]; then + echo DOCKER $1 start finished in $2 seconds + return ${SUCCESS} + fi + return ${FAILURE} +} +# function probe_docker { MATCH=`docker logs --tail 30 $1 | grep "DOCKER STARTED"` @@ -181,15 +191,15 @@ function monitor_docker { status=$? ; ;; sdc-BE) - ready_probe ${DOCKER_NAME} ${TIME} ; + ready_probe_jetty ${DOCKER_NAME} ${TIME} ; status=$? ; ;; sdc-FE) - ready_probe ${DOCKER_NAME} ${TIME} ; + ready_probe_jetty ${DOCKER_NAME} ${TIME} ; status=$? ; ;; sdc-onboard-BE) - ready_probe ${DOCKER_NAME} ${TIME} ; + ready_probe_jetty ${DOCKER_NAME} ${TIME} ; status=$? ; ;; sdc-api-tests) @@ -287,7 +297,7 @@ function sdc-cs-init { if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-cassandra-init:${RELEASE} fi - docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1 + docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --env HOST_IP=${IP} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-cassandra-init:${RELEASE} > /dev/null 2>&1 rc=$? docker_logs ${DOCKER_NAME} if [[ ${rc} != 0 ]]; then exit ${rc}; fi @@ -302,7 +312,7 @@ function sdc-cs-onboard-init { if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} fi - docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env CS_HOST_PORT=${CS_PORT} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/root/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} + docker run --name ${DOCKER_NAME} --env RELEASE="${RELEASE}" --env CS_HOST_IP=${IP} --env CS_HOST_PORT=${CS_PORT} --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env CS_PASSWORD="${CS_PASSWORD}" --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/CS:/var/lib/cassandra --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments --volume ${WORKSPACE}/data/CS-Init:/home/sdc/chef-solo/cache ${PREFIX}/sdc-onboard-cassandra-init:${RELEASE} rc=$? docker_logs ${DOCKER_NAME} if [[ ${rc} != 0 ]]; then exit ${rc}; fi @@ -319,7 +329,7 @@ function sdc-BE { else ADDITIONAL_ARGUMENTS=${BE_DEBUG_PORT} fi - docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} + docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env JAVA_OPTIONS="${BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:${JETTY_BASE}/chef-solo/environments --publish 8443:8443 --publish 8080:8080 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-backend:${RELEASE} command_exit_status $? ${DOCKER_NAME} echo "please wait while BE is starting..." monitor_docker ${DOCKER_NAME} @@ -334,7 +344,7 @@ function sdc-BE-init { if [ ${LOCAL} = false ]; then docker pull ${PREFIX}/sdc-backend-init:${RELEASE} fi - docker run --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1 + docker run --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/logs/BE/:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/home/sdc/chef-solo/environments ${PREFIX}/sdc-backend-init:${RELEASE} > /dev/null 2>&1 rc=$? docker_logs ${DOCKER_NAME} if [[ ${rc} != 0 ]]; then exit ${rc}; fi @@ -353,7 +363,7 @@ function sdc-onboard-BE { else ADDITIONAL_ARGUMENTS=${ONBOARD_DEBUG_PORT} fi - docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env SDC_CLUSTER_NAME="SDC-CS-${DEP_ENV}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env SDC_CERT_DIR="${SDC_CERT_DIR}" --env JAVA_OPTIONS="${ONBOARD_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:${JETTY_BASE}/onap/cert --volume ${WORKSPACE}/data/logs/ONBOARD:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments --publish 8445:8445 --publish 8081:8081 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-onboard-backend:${RELEASE} + docker run --detach --name ${DOCKER_NAME} --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env cassandra_ssl_enabled="false" --env SDC_CLUSTER_NAME="SDC-CS-${DEP_ENV}" --env SDC_USER="${SDC_USER}" --env SDC_PASSWORD="${SDC_PASSWORD}" --env SDC_CERT_DIR="${SDC_CERT_DIR}" --env JAVA_OPTIONS="${ONBOARD_BE_JAVA_OPTIONS}" --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --ulimit nofile=4096:100000 ${LOCAL_TIME_MOUNT_CMD} --volume ${WORKSPACE}/data/${SDC_CERT_DIR}:${JETTY_BASE}/onap/cert --volume ${WORKSPACE}/data/logs/ONBOARD:${JETTY_BASE}/logs --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments --publish 8445:8445 --publish 8081:8081 ${ADDITIONAL_ARGUMENTS} ${PREFIX}/sdc-onboard-backend:${RELEASE} command_exit_status $? ${DOCKER_NAME} echo "please wait while sdc-onboard-BE is starting..." monitor_docker ${DOCKER_NAME} @@ -391,7 +401,7 @@ function sdc-FE { --ulimit memlock=-1:-1 \ --ulimit nofile=4096:100000 \ --volume ${WORKSPACE}/data/logs/FE/:${JETTY_BASE}/logs \ - --volume ${WORKSPACE}/data/environments:/root/chef-solo/environments \ + --volume ${WORKSPACE}/data/environments:/${JETTY_BASE}/chef-solo/environments \ ${LOCAL_TIME_MOUNT_CMD} \ ${PLUGINS_CONF_VOLUME_MOUNT} \ --publish 9443:9443 \ |