From aa3351b0197d96469dd1c34abd0489c09756eaa4 Mon Sep 17 00:00:00 2001 From: avigaffa Date: Sun, 5 May 2019 16:20:24 +0300 Subject: [PATCH] Connection to WF designer times out Adding support for SSL to WFD-FE Issue-ID: SDC-2246 Change-Id: Ia16327f90e6c96e0584f2e2dbb9b2ee3afd7af08 Signed-off-by: avigaffa --- README.md | 16 +++++++++++++++- workflow-designer-ui/docker/Dockerfile | 16 ++++++++++++++++ workflow-designer-ui/docker/startup.sh | 25 ++++++++++++++++++++++++ workflow-designer-ui/pom.xml | 35 +++++++++++++++++++++++++--------- 4 files changed, 82 insertions(+), 10 deletions(-) create mode 100644 workflow-designer-ui/docker/Dockerfile create mode 100644 workflow-designer-ui/docker/startup.sh diff --git a/README.md b/README.md index a391684b..0c090314 100644 --- a/README.md +++ b/README.md @@ -174,17 +174,31 @@ nexus3.onap.org:10001/onap/workflow-frontend:latest` - JAVA_OPTIONS — optionally, JVM (Java Virtual Machine) arguments. +For SSL connectivity: + +- IS_HTTPS — flag to set if frontend accepts https connection from client. Default is false. + +- KEYSTORE_PATH +- KEYSTORE_PASSWORD +- KEYSTORE_TYPE +- TRUSTSTORE_PATH +- TRUSTSTORE_PASSWORD +- TRUSTSTORE_TYPE + +If not set then Using jetty default SSL keys. + ### Example `docker run -d --name workflow-frontend -e BACKEND=http://$(docker inspect workflow-backend --format={{.NetworkSettings.IPAddress}}):8080 --e JAVA_OPTIONS="-Xmx64m -Xms64m -Xss1m" -p 9088:8080 nexus3.onap.org:10001/onap/workflow-frontend:latest` +-e JAVA_OPTIONS="-Xmx64m -Xms64m -Xss1m" -p 9088:8080 -p 8186:8443 -e IS_HTTPS=true nexus3.onap.org:10001/onap/workflow-frontend:latest` Notice that port 8080 of the frontend container has been [mapped]( https://docs.docker.com/config/containers/container-networking/#published-ports) to port 9088 of the host machine. This makes the Workflow Designer Web application accessible from the outside world via the host machine's IP address/hostname. +To expose the https port 8443 of the container we have published in the example 8186. ### Troubleshooting In order to check if the Workflow Designer frontend has successfully started, look at the logs of the diff --git a/workflow-designer-ui/docker/Dockerfile b/workflow-designer-ui/docker/Dockerfile new file mode 100644 index 00000000..83e8d5ac --- /dev/null +++ b/workflow-designer-ui/docker/Dockerfile @@ -0,0 +1,16 @@ +FROM jetty:9.4.9-alpine + +EXPOSE 8080 +EXPOSE 8443 + +USER root + +ARG ARTIFACT + +ADD ${ARTIFACT} ${JETTY_BASE}/webapps/ +RUN chown -R jetty:jetty ${JETTY_BASE}/webapps + +COPY startup.sh . +RUN chmod 744 startup.sh + +ENTRYPOINT [ "./startup.sh" ] \ No newline at end of file diff --git a/workflow-designer-ui/docker/startup.sh b/workflow-designer-ui/docker/startup.sh new file mode 100644 index 00000000..359e6aca --- /dev/null +++ b/workflow-designer-ui/docker/startup.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +# adding support for https +HTTPS_ENABLED=${IS_HTTPS:-"false"} + +if [ "$HTTPS_ENABLED" = "true" ] +then + echo "enable ssl" + if [ -z "$KEYSTORE_PATH" ]; then + java -jar "${JETTY_HOME}/start.jar" --add-to-start=https,ssl \ + jetty.sslContext.keyStorePath=$KEYSTORE_PATH \ + jetty.sslContext.keyStorePassword=$KEYSTORE_PASSWORD \ + jetty.sslContext.keyStoreType=$KEYSTORE_TYPE \ + jetty.sslContext.trustStorePath=$TRUSTSTORE_PATH \ + jetty.sslContext.trustStorePassword=$TRUSTSTORE_PASSWORD \ + jetty.sslContext.trustStoreType=$TRUSTSTORE_TYPE \ + else + echo "Using jetty default SSL" + java -jar "${JETTY_HOME}/start.jar" --add-to-start=https,ssl + fi +else + echo "no ssl required" +fi + +java -DproxyTo=$BACKEND $JAVA_OPTIONS -jar $JETTY_HOME/start.jar \ No newline at end of file diff --git a/workflow-designer-ui/pom.xml b/workflow-designer-ui/pom.xml index 46c24536..4e55001e 100644 --- a/workflow-designer-ui/pom.xml +++ b/workflow-designer-ui/pom.xml @@ -146,6 +146,28 @@ + + maven-resources-plugin + 2.6 + + + copy-resources-docker + install + + copy-resources + + + ${basedir}/docker + + + ${project.build.directory} + ${project.artifactId}-${project.version}.war + + + + + + io.fabric8 docker-maven-plugin @@ -157,15 +179,10 @@ ${project.version} - jetty:9.4.11-alpine - root - - artifact - /var/lib/jetty/webapps - - - java -DproxyTo=$BACKEND $JAVA_OPTIONS -jar $JETTY_HOME/start.jar - + ${project.basedir}/docker + + ${project.artifactId}-${project.version}.war + -- 2.16.6