From b565c3dc19ab4658db2c86fe2bd6d24072b72944 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20D=C3=BCrre?= Date: Mon, 3 Feb 2020 13:47:39 +0100 Subject: [PATCH] add sdnc-web dist MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit add osgifree dist for web based content Issue-ID: SDNC-1013 Signed-off-by: Michael Dürre Change-Id: I3964f13cf15479525862c2abddfd154fe9dcabee --- installation/pom.xml | 1 + installation/sdnc-web/pom.xml | 334 +++++++++++++++++++++ installation/sdnc-web/src/main/docker/Dockerfile | 57 ++++ .../sdnc-web/src/main/resources/http_site.conf | 69 +++++ .../sdnc-web/src/main/resources/https_site.conf | 89 ++++++ .../sdnc-web/src/main/scripts/TagVersion.groovy | 41 +++ .../sdnc-web/src/main/scripts/configure.sh | 66 ++++ installation/sdnc-web/src/main/scripts/run.sh | 27 ++ 8 files changed, 684 insertions(+) create mode 100644 installation/sdnc-web/pom.xml create mode 100644 installation/sdnc-web/src/main/docker/Dockerfile create mode 100644 installation/sdnc-web/src/main/resources/http_site.conf create mode 100644 installation/sdnc-web/src/main/resources/https_site.conf create mode 100644 installation/sdnc-web/src/main/scripts/TagVersion.groovy create mode 100644 installation/sdnc-web/src/main/scripts/configure.sh create mode 100644 installation/sdnc-web/src/main/scripts/run.sh diff --git a/installation/pom.xml b/installation/pom.xml index 5d81f196..4765c9f5 100644 --- a/installation/pom.xml +++ b/installation/pom.xml @@ -29,6 +29,7 @@ ansible-server sdnc + sdnc-web admportal ueb-listener dmaap-listener diff --git a/installation/sdnc-web/pom.xml b/installation/sdnc-web/pom.xml new file mode 100644 index 00000000..66db3d69 --- /dev/null +++ b/installation/sdnc-web/pom.xml @@ -0,0 +1,334 @@ + + + 4.0.0 + + + org.onap.ccsdk.parent + odlparent-lite + 1.5.1-SNAPSHOT + + + + org.onap.sdnc.oam + installation-sdnc-web + 1.8.0-SNAPSHOT + pom + + sdnc-oam :: installation :: ${project.artifactId} + Creates SDN Controller Docker container + + + docker.io/bitnami/nginx:1.16-debian-9 + oof-pci/ccsdk-odlwt-webserver + ${maven.build.timestamp} + org.onap.ccsdk.features.sdnr.wt + 0.7.1-SNAPSHOT + ${project.version} + ${https_proxy} + yyyyMMdd'T'HHmmss'Z' + deploy + true + 93C4A3FD7BB9C367 + + + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-odlux-framework + ${ccsdk.features.version} + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-odlux-apps-installer + ${ccsdk.features.version} + repo + zip + + + org.onap.ccsdk.features.sdnr.wt + sdnr-wt-helpserver-installer + ${ccsdk.features.version} + repo + zip + + + + + + + org.codehaus.groovy.maven + gmaven-plugin + 1.0 + + + validate + + execute + + + ${basedir}/src/main/scripts/TagVersion.groovy + + + + + + maven-resources-plugin + 2.6 + + + copy-dockerfile + + copy-resources + + validate + + ${basedir}/target/docker-stage + + + src/main/docker + + Dockerfile + + true + + + + + + copy-siteconf + + copy-resources + + validate + + ${basedir}/target/docker-stage + + + src/main/resources + + *.conf + + true + + + + + + + copy-scripts + + copy-resources + + validate + + ${basedir}/target/docker-stage/bin + + + src/main/scripts + + *.sh + + true + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack features + generate-sources + + unpack + + + + + + ${ccsdk.groupId} + sdnr-wt-odlux-framework + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-connectApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-eventLogApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-helpApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-maintenanceApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-minimumApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-configurationApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-demoApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-faultApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-inventoryApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-mediatorApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-odlux-app-performanceHistoryApp + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + odlux/* + + + + ${ccsdk.groupId} + sdnr-wt-helpserver-provider + ${ccsdk.features.version} + jar + false + ${project.build.directory}/docker-stage/html + help/* + + + + + + + + io.fabric8 + docker-maven-plugin + 0.16.5 + false + + + + ${image.name} + + try + ${basedir}/target/docker-stage + ${basedir}/target/docker-stage/Dockerfile + + ${project.docker.latestminortag.version} + ${project.docker.latestfulltag.version} + ${project.docker.latesttagtimestamp.version} + + + + + + + + generate-images + package + + build + + + + push-images + ${docker.push.phase} + + build + push + + + + + + + + org.apache.maven.wagon + wagon-http-lightweight + 2.2 + + + + diff --git a/installation/sdnc-web/src/main/docker/Dockerfile b/installation/sdnc-web/src/main/docker/Dockerfile new file mode 100644 index 00000000..37de7166 --- /dev/null +++ b/installation/sdnc-web/src/main/docker/Dockerfile @@ -0,0 +1,57 @@ +### +#============LICENSE_START======================================================= +# ONAP : ccsdk distribution web +# ================================================================================ +# Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. +# All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +# Base bitnami nginx image +FROM ${base.image.repo} +MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org) + +# copy ODLUX files to nginx +COPY html /opt/bitnami/nginx/html + +# copy site conf files +COPY http_site.conf /opt/bitnami/nginx/conf/server_blocks/ +COPY https_site.conf /opt/bitnami/nginx/conf/server_blocks/ + +# setup environment variables +ENV WEBPROTOCOL="HTTP" \ + WEBPORT="8080" \ + SDNRPROTOCOL="HTTP" \ + SDNRHOST="172.18.0.3" \ + SDNRPORT="8181" \ + LOCALDNS="127.0.0.11" \ + SSL_CERT_DIR="/app/cert" \ + SSL_CERTIFICATE="cert.pem" \ + SSL_CERTIFICATE_KEY="cert.key" + +# Check if /app can be used. If so, create "custom" directory and copy the files there. +COPY bin/configure.sh /opt/bitnami/nginx/sbin +COPY bin/run.sh /opt/bitnami/nginx/sbin + +USER root +RUN chmod +x /opt/bitnami/nginx/sbin/configure.sh +RUN chmod +x /opt/bitnami/nginx/sbin/run.sh +# By default, docker copies files with the permissions of the build user. To avoid cases where build user +# has 644 which can result in failure of certain commands +RUN chmod -R g+w /opt/bitnami/nginx/html/odlux + +USER 1001 +CMD [ "/opt/bitnami/nginx/sbin/run.sh" ] + diff --git a/installation/sdnc-web/src/main/resources/http_site.conf b/installation/sdnc-web/src/main/resources/http_site.conf new file mode 100644 index 00000000..e42ecc79 --- /dev/null +++ b/installation/sdnc-web/src/main/resources/http_site.conf @@ -0,0 +1,69 @@ +### +# ============LICENSE_START======================================================= +# ONAP : ccsdk distribution web +# ================================================================================ +# Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. +# All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen WEBPORT default_server ; + listen [::]:WEBPORT default_server; + +# root /var/www; + + index index.html index.htm index.nginx-debian.html; + + server_name _; + + set $sdnrserver "SDNRHOST"; + location / { + try_files $uri $uri/ @backend; + } + location /websocket { + resolver LOCALDNS; + proxy_pass SDNRPROTOCOL://$sdnrserver:SDNRPORT/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + location @backend { + resolver LOCALDNS; + proxy_pass SDNRPROTOCOL://$sdnrserver:SDNRPORT; + } + +} + diff --git a/installation/sdnc-web/src/main/resources/https_site.conf b/installation/sdnc-web/src/main/resources/https_site.conf new file mode 100644 index 00000000..11ba7288 --- /dev/null +++ b/installation/sdnc-web/src/main/resources/https_site.conf @@ -0,0 +1,89 @@ +### +# ============LICENSE_START======================================================= +# ONAP : ccsdk distribution web +# ================================================================================ +# Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. +# All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen WEBPORT ssl default_server ; + listen [::]:WEBPORT ssl default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + ssl_certificate SSL_CERT_DIR/SSL_CERTIFICATE; + ssl_certificate_key SSL_CERT_DIR/SSL_CERTIFICATE_KEY; + +# root /var/www; + + index index.html index.htm index.nginx-debian.html; + + server_name _; + + set $sdnrserver "SDNRHOST"; + + location / { + try_files $uri $uri/ @backend; + } + location /websocket { + resolver LOCALDNS; + proxy_pass SDNRPROTOCOL://$sdnrserver:SDNRPORT/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + location @backend { + resolver LOCALDNS; + proxy_pass SDNRPROTOCOL://$sdnrserver:SDNRPORT; + } + +} + diff --git a/installation/sdnc-web/src/main/scripts/TagVersion.groovy b/installation/sdnc-web/src/main/scripts/TagVersion.groovy new file mode 100644 index 00000000..16880561 --- /dev/null +++ b/installation/sdnc-web/src/main/scripts/TagVersion.groovy @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP CCSDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * =================================================================== + * + */ + +package org.onap.ccsdk.distribution + + +def versionArray; +if ( project.properties['ccsdk.features.version'] != null ) { + versionArray = project.properties['ccsdk.features.version'].split('\\.'); +} + +if ( project.properties['ccsdk.features.version'].endsWith("-SNAPSHOT") ) { + patchArray = versionArray[2].split('-'); + project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-SNAPSHOT-latest"; + project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-latest"; + project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + patchArray[0] + "-SNAPSHOT-"+project.properties['ccsdk.build.timestamp']; +} else { + project.properties['project.docker.latestminortag.version']=versionArray[0] + '.' + versionArray[1] + "-STAGING-latest"; + project.properties['project.docker.latestfulltag.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-latest"; + project.properties['project.docker.latesttagtimestamp.version']=versionArray[0] + '.' + versionArray[1] + '.' + versionArray[2] + "-STAGING-"+project.properties['ccsdk.build.timestamp']; +} diff --git a/installation/sdnc-web/src/main/scripts/configure.sh b/installation/sdnc-web/src/main/scripts/configure.sh new file mode 100644 index 00000000..b8385fd5 --- /dev/null +++ b/installation/sdnc-web/src/main/scripts/configure.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# ONAP : ccsdk distribution web +# ================================================================================ +# Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. +# All rights reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +# Comment listening on 8080 in nginx.conf as we don't want nginx to listen on any port other than SDNR +sed -i 's/listen/\#listen/g' /opt/bitnami/nginx/conf/nginx.conf + +update_index_html() { + + # Backup the index.html file + cp /opt/bitnami/nginx/html/odlux/index.html /opt/bitnami/nginx/html/odlux/index.html.backup + sed -z 's/