add https support to simulato
Change-Id: I16f68532a7e7a09fbf96c09dff19d857c03fedd8
Issue-ID: SDC-832
Signed-off-by: Michael Lando <ml636r@att.com>
diff --git a/utils/webseal-simulator/pom.xml b/utils/webseal-simulator/pom.xml
index 18e5b32b..c0e9fe6 100644
--- a/utils/webseal-simulator/pom.xml
+++ b/utils/webseal-simulator/pom.xml
@@ -5,13 +5,10 @@
<groupId>org.openecomp.sdc</groupId>
<artifactId>webseal-simulator</artifactId>
<packaging>war</packaging>
- <version>0.0.1-SNAPSHOT</version>
+ <version>0.1.0-SNAPSHOT</version>
<properties>
<jetty-version>9.2.10.v20150310</jetty-version>
- <docker.tag>${project.version}-${maven.build.timestamp}</docker.tag>
- <docker.latest.tag>${project.version}-latest</docker.latest.tag>
- <!--maven-->
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
<nexus.proxy>https://nexus.onap.org</nexus.proxy>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -83,7 +80,7 @@
</dependencies>
<build>
- <finalName>WSSimulator</finalName>
+ <finalName>WSSimulator-${project.version}</finalName>
<plugins>
<!-- ================================================== -->
<!-- Set the JDK compiler version. -->
@@ -99,20 +96,6 @@
</configuration>
</plugin>
- <plugin>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-maven-plugin</artifactId>
- <version>${jetty-version}</version>
- <configuration>
- <contextPath>/</contextPath>
- <webApp>
- <contextPath>/</contextPath>
- <webInfIncludeJarPattern>.*/.*jersey-[^/]\.jar$</webInfIncludeJarPattern>
- </webApp>
- <war>WSSimulator.war</war>
- </configuration>
- </plugin>
-
</plugins>
</build>
@@ -124,11 +107,6 @@
<url>${nexus.proxy}/content/repositories/releases/</url>
</repository>
<repository>
- <id>ecomp-staging</id>
- <name>Staging Repository</name>
- <url>${nexus.proxy}/content/repositories/staging/</url>
- </repository>
- <repository>
<id>ecomp-snapshots</id>
<name>Snapshots Repository</name>
<url>${nexus.proxy}/content/repositories/snapshots/</url>
@@ -143,14 +121,6 @@
<profiles>
<profile>
- <id>docker-staging</id>
- <properties>
- <docker.tag>${project.version}-STAGING-${maven.build.timestamp}</docker.tag>
- <docker.latest.tag>${project.version}-STAGING-latest</docker.latest.tag>
- </properties>
- </profile>
-
- <profile>
<id>docker</id>
<activation>
<activeByDefault>false</activeByDefault>
@@ -204,7 +174,7 @@
<resource>
<directory>${project.basedir}/target</directory>
<includes>
- <include>WSSimulator.war</include>
+ <include>WSSimulator*.war</include>
</includes>
</resource>
</resources>
@@ -236,7 +206,7 @@
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
- <version>0.23.0</version>
+ <version>0.24.0</version>
<configuration>
<verbose>true</verbose>
@@ -256,11 +226,10 @@
<alias>sdc-simulator</alias>
<build>
<cleanup>try</cleanup>
- <dockerFileDir>${basedir}\sdc-simulator</dockerFileDir>
+ <dockerFileDir>${basedir}/sdc-simulator</dockerFileDir>
<tags>
<tag>${docker.tag}</tag>
<tag>${docker.latest.tag}</tag>
- <tag>1.1-STAGING-latest</tag>
</tags>
</build>
</image>
@@ -273,12 +242,7 @@
<goals>
<goal>remove</goal>
</goals>
- <configuration>
- <removeAll>true</removeAll>
- <image>openecomp/sdc-simulator</image>
- </configuration>
</execution>
-
<execution>
<id>generate-images</id>
<phase>install</phase>
@@ -286,17 +250,12 @@
<goal>build</goal>
</goals>
</execution>
-
<execution>
<id>push-images</id>
<phase>deploy</phase>
<goals>
- <goal>build</goal>
<goal>push</goal>
</goals>
- <configuration>
- <image>openecomp/sdc-simulator</image>
- </configuration>
</execution>
</executions>
</plugin>
diff --git a/utils/webseal-simulator/scripts/simulator_docker_run.sh b/utils/webseal-simulator/scripts/simulator_docker_run.sh
index c7ded8d..079dc1e 100644
--- a/utils/webseal-simulator/scripts/simulator_docker_run.sh
+++ b/utils/webseal-simulator/scripts/simulator_docker_run.sh
@@ -70,8 +70,10 @@
dir_perms
+JAVA_OPTIONS=" -Xmx128m -Xms128m -Xss1m"
+
# SDC-Simulator
-docker run --detach --name sdc-sim --env HOST_IP=${IP} --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --log-driver=json-file --log-opt max-size=100m --log-opt max-file=10 --ulimit memlock=-1:-1 --memory 256m --memory-swap=256m --ulimit nofile=4096:100000 --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/WS/:/var/lib/jetty/logs --volume /data/environments:/root/chef-solo/environments --publish 8285:8080 ${PREFIX}/sdc-simulator:${RELEASE}
+docker run --detach --name sdc-sim --env JAVA_OPTIONS="${JAVA_OPTIONS}" --env ENVNAME="${DEP_ENV}" --env http_proxy=${http_proxy} --env https_proxy=${https_proxy} --env no_proxy=${no_proxy} --volume /etc/localtime:/etc/localtime:ro --volume /data/logs/WS/:/var/lib/jetty/logs --volume /data/environments:/root/chef-solo/environments --publish 8285:8080 --publish 8286:8443 ${PREFIX}/sdc-simulator:${RELEASE}
if [ $? -ne 0 ]; then
diff --git a/utils/webseal-simulator/scripts/ws-compose.yaml b/utils/webseal-simulator/scripts/ws-compose.yaml
new file mode 100644
index 0000000..7c07f62
--- /dev/null
+++ b/utils/webseal-simulator/scripts/ws-compose.yaml
@@ -0,0 +1,21 @@
+version: '3'
+
+services:
+ WS:
+ container_name: sdc-sim
+ image: onap/sdc-simulator:latest
+ volumes:
+ - "/etc/localtime:/etc/localtime:ro"
+ - "/data/logs/WS/:/var/lib/jetty/logs"
+ - "/data/environments:/root/chef-solo/environments"
+ ports:
+ - "8286:8443"
+ - "8285:8080"
+ restart: always
+ environment:
+ HOST_IP: "10.0.2.15"
+ ENVNAME: "AUTO"
+ http_proxy: http://one.proxy.att.com:8080
+ https_proxy: http://one.proxy.att.com:8080
+ no_proxy: "localhost,127.0.0.1"
+ JAVA_OPTIONS: "-Xmx128m -Xms128m -Xss1m"
diff --git a/utils/webseal-simulator/sdc-simulator/Dockerfile.template b/utils/webseal-simulator/sdc-simulator/Dockerfile.template
deleted file mode 100644
index 673b56f..0000000
--- a/utils/webseal-simulator/sdc-simulator/Dockerfile.template
+++ /dev/null
@@ -1,25 +0,0 @@
-FROM jetty
-
-RUN apt-get -y update
-RUN apt-get -y install apt-utils
-RUN apt-get -y install curl
-RUN apt-get -y install vim
-
-COPY chef-solo /root/chef-solo/
-COPY chef-repo/cookbooks /root/chef-solo/cookbooks/
-
-ENV BASE_NEXUS zl999y:ChangeMe@10.208.197.75:8443/repository/maven-public/org/openecomp/sdc
-
-# install chef-solo
-RUN curl -L https://www.opscode.com/chef/install.sh | bash
-
-RUN cp /usr/local/jetty/resources/log4j.properties /var/lib/jetty/resources/log4j.properties
-
-ADD sdc-simulator-__SDC-RELEASE__.war /var/lib/jetty/webapps/
-RUN chown -R jetty:jetty /var/lib/jetty/webapps
-
-COPY startup.sh /root/
-
-RUN chmod 770 /root/startup.sh
-
-ENTRYPOINT [ "/root/startup.sh" ]
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 85fedfd..6c081d6 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
@@ -1,5 +1,13 @@
jetty_base="/var/lib/jetty"
+if !ENV['FE_URL'].nil?
+ fe_url="#{ENV['FE_URL']}"
+elsif node['disableHttp']
+ fe_url="https://#{node['Nodes']['FE']}:#{node['FE'][:https_port]}"
+else
+ fe_url="http://#{node['Nodes']['FE']}:#{node['FE'][:http_port]}"
+end
+
template "webseal.conf" do
path "#{jetty_base}/config/sdc-simulator/webseal.conf"
@@ -8,7 +16,6 @@
group "jetty"
mode "0755"
variables({
- :fe_host_ip => node['HOST_IP'],
- :fe_http_port => "#{node['FE'][:http_port]}"
+ :fe_url =>"#{fe_url}"
})
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 38b87fa..3dde6ee 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
@@ -1,7 +1,6 @@
jetty_base="/var/lib/jetty"
jetty_home="/usr/local/jetty"
-###### create Jetty modules
bash "create-jetty-modules" do
cwd "#{jetty_base}"
code <<-EOH
@@ -9,6 +8,29 @@
java -jar "/#{jetty_home}"/start.jar --add-to-start=deploy
java -jar "/#{jetty_home}"/start.jar --add-to-startd=http,https,logging,setuid
EOH
-not_if "ls /#{jetty_base}/start.d/https.ini"
+end
+
+template "ssl-ini" do
+ path "/#{jetty_base}/start.d/ssl.ini"
+ source "SDC-Simulator-ssl-ini.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ variables({
+ :https_port => "8443",
+ :jetty_keystore_pwd => "OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4",
+ :jetty_keymanager_pwd => "OBF:1u2u1wml1z7s1z7a1wnl1u2g"
+ })
+end
+
+template "https-ini" do
+ path "/#{jetty_base}/start.d/https.ini"
+ source "SDC-Simulator-https-ini.erb"
+ owner "jetty"
+ group "jetty"
+ mode "0755"
+ variables ({
+ :https_port => "8443"
+ })
end
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-https-ini.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-https-ini.erb
new file mode 100644
index 0000000..9999a41
--- /dev/null
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-https-ini.erb
@@ -0,0 +1,29 @@
+# ---------------------------------------
+# Module: https
+--module=https
+
+### HTTPS Connector Configuration
+
+## Connector host/address to bind to
+# jetty.https.host=0.0.0.0
+
+## Connector port to listen on
+jetty.https.port=<%= @https_port %>
+
+## Connector idle timeout in milliseconds
+jetty.https.idleTimeout=30000
+
+## Connector socket linger time in seconds (-1 to disable)
+# jetty.https.soLingerTime=-1
+
+## Number of acceptors (-1 picks default based on number of cores)
+# jetty.https.acceptors=-1
+
+## Number of selectors (-1 picks default based on number of cores)
+# jetty.https.selectors=-1
+
+## ServerSocketChannel backlog (0 picks platform default)
+# jetty.https.acceptorQueueSize=0
+
+## Thread priority delta to give to acceptor threads
+# jetty.https.acceptorPriorityDelta=0
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb
index 426e0e4..86848bf 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-ssl-ini.erb
@@ -8,7 +8,7 @@
# jetty.ssl.host=0.0.0.0
## Connector port to listen on
-jetty.ssl.port=<%= @FE_https_port %>
+jetty.ssl.port=<%= @https_port %>
## Connector idle timeout in milliseconds
# jetty.ssl.idleTimeout=30000
@@ -49,6 +49,7 @@
## Keystore password
# jetty.sslContext.keyStorePassword=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
+jetty.sslContext.keyStorePassword=<%= @jetty_keystore_pwd %>
## Keystore type and provider
# jetty.sslContext.keyStoreType=JKS
@@ -56,9 +57,11 @@
## KeyManager password
# jetty.sslContext.keyManagerPassword=OBF:1u2u1wml1z7s1z7a1wnl1u2g
+jetty.sslContext.keyManagerPassword=<%= @jetty_keymanager_pwd %>
## Truststore password
# jetty.sslContext.trustStorePassword=OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4
+#jetty.sslContext.trustStorePassword=<%= @jetty_truststore_pwd %>
## Truststore type and provider
# jetty.sslContext.trustStoreType=JKS
@@ -81,3 +84,7 @@
## Set the timeout (in seconds) of the SslSession cache timeout
# jetty.sslContext.sslSessionTimeout=-1
+
+## Allow SSL renegotiation
+# jetty.sslContext.renegotiationAllowed=true
+# jetty.sslContext.renegotiationLimit=5
diff --git a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-webseal.conf.erb b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-webseal.conf.erb
index d5e2cbe..e4c5d75 100644
--- a/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-webseal.conf.erb
+++ b/utils/webseal-simulator/sdc-simulator/chef-repo/cookbooks/sdc-simulator/templates/default/SDC-Simulator-webseal.conf.erb
@@ -1,6 +1,6 @@
{
webseal {
- fe="http://<%= @fe_host_ip %>:<%= @fe_http_port %>"
+ fe="<%= @fe_url %>"
users = [
{
userId="cs0008"
diff --git a/utils/webseal-simulator/sdc-simulator/startup.sh b/utils/webseal-simulator/sdc-simulator/startup.sh
index aca8b5e..48b6a0d 100644
--- a/utils/webseal-simulator/sdc-simulator/startup.sh
+++ b/utils/webseal-simulator/sdc-simulator/startup.sh
@@ -1,12 +1,26 @@
#!/bin/sh
-export CHEFNAME=${ENVNAME}
-cd /root/chef-solo
-echo "normal['HOST_IP'] = \"${HOST_IP}\"" > /root/chef-solo/cookbooks/sdc-simulator/attributes/default.rb
-chef-solo -c solo.rb -E ${CHEFNAME}
-sed -i '/^set -e/aJAVA_OPTIONS=\"-Xdebug -Xmx128m -Xms128m -Xss1m -Dconfig.home=${JETTY_BASE}/config/sdc-simulator -Dlog.home=${JETTY_BASE}/logs -Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml -Djetty.logging.dir=${JETTY_BASE}/logs -Djetty.base=${JETTY_BASE} \"' /docker-entrypoint.sh
-sed -i '/^set -e/aTMPDIR=${JETTY_BASE}\/temp' /docker-entrypoint.sh
+
+cd /root/chef-solo
+chef-solo -c solo.rb -E ${ENVNAME}
+rc=$?
+if [[ $rc != 0 ]]; then
+ echo "Chef exaction failed."
+ exit $rc;
+fi
+
+JAVA_OPTIONS=" ${JAVA_OPTIONS} \
+ -Dconfig.home=${JETTY_BASE}/config/sdc-simulator \
+ -Dlog.home=${JETTY_BASE}/logs \
+ -Dlogback.configurationFile=${JETTY_BASE}/config/sdc-simulator/logback.xml \
+ -Djetty.logging.dir=${JETTY_BASE}/logs"
+
+echo "---------------------------------------------"
+echo $TMPDIR
+echo $JAVA_OPTIONS
+echo $JETTY_BASE
+echo "---------------------------------------------"
cd /var/lib/jetty
/docker-entrypoint.sh