summaryrefslogtreecommitdiffstats
path: root/utils/webseal-simulator/sdc-simulator
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-09-21 22:13:05 +0200
committerMichael Morris <michael.morris@est.tech>2021-05-12 10:27:10 +0000
commitdf353be353e1ec25ac2a0e64a9eb617dcbc87703 (patch)
treee79c636bc4f67bdd8392b24c85f2f6cb26e3c67a /utils/webseal-simulator/sdc-simulator
parent936781153118364e60662529dbd7217416a26148 (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>
Diffstat (limited to 'utils/webseal-simulator/sdc-simulator')
-rw-r--r--utils/webseal-simulator/sdc-simulator/Dockerfile61
-rw-r--r--utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_1_cleanup_jettydir.rb12
-rw-r--r--utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_2_setup_configuration.rb4
-rw-r--r--utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_3_logback.rb4
-rw-r--r--utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_4_locate_keystore.rb12
-rw-r--r--utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/recipes/SDC_Simulator_5_create_jetty_modules.rb36
-rw-r--r--utils/webseal-simulator/sdc-simulator/startup.sh27
7 files changed, 64 insertions, 92 deletions
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"