diff options
author | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2020-02-03 13:47:39 +0100 |
---|---|---|
committer | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2020-02-03 13:47:57 +0100 |
commit | 7dc46a626fbec4ca58568f1066569fe3fe3b635e (patch) | |
tree | 6c9a0da25b2466a2376117a85d6331908afebec0 | |
parent | 134b574d085564b43ceca263a0ead17c7c29346d (diff) |
add sdnc-web dist
add osgifree dist for web based content
Issue-ID: SDNC-1013
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: I3964f13cf15479525862c2abddfd154fe9dcabee
Former-commit-id: b565c3dc19ab4658db2c86fe2bd6d24072b72944
-rw-r--r-- | installation/pom.xml | 1 | ||||
-rw-r--r-- | installation/sdnc-web/pom.xml | 334 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/docker/Dockerfile | 57 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/resources/http_site.conf | 69 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/resources/https_site.conf | 89 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/scripts/TagVersion.groovy | 41 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/scripts/configure.sh | 66 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/scripts/run.sh | 27 |
8 files changed, 684 insertions, 0 deletions
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 @@ <modules> <module>ansible-server</module> <module>sdnc</module> + <module>sdnc-web</module> <module>admportal</module> <module>ueb-listener</module> <module>dmaap-listener</module> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>1.5.1-SNAPSHOT</version> + <relativePath /> + </parent> + + <groupId>org.onap.sdnc.oam</groupId> + <artifactId>installation-sdnc-web</artifactId> + <version>1.8.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>sdnc-oam :: installation :: ${project.artifactId}</name> + <description>Creates SDN Controller Docker container</description> + + <properties> + <base.image.repo>docker.io/bitnami/nginx:1.16-debian-9</base.image.repo> + <image.name>oof-pci/ccsdk-odlwt-webserver</image.name> + <ccsdk.build.timestamp>${maven.build.timestamp}</ccsdk.build.timestamp> + <ccsdk.groupId>org.onap.ccsdk.features.sdnr.wt</ccsdk.groupId> + <ccsdk.features.version>0.7.1-SNAPSHOT</ccsdk.features.version> + <platform-logic-installer.version>${project.version}</platform-logic-installer.version> + <docker.buildArg.https_proxy>${https_proxy}</docker.buildArg.https_proxy> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <docker.push.phase>deploy</docker.push.phase> + <docker.verbose>true</docker.verbose> + <ansible.gpg.key>93C4A3FD7BB9C367</ansible.gpg.key> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-odlux-framework</artifactId> + <version>${ccsdk.features.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-odlux-apps-installer</artifactId> + <version>${ccsdk.features.version}</version> + <classifier>repo</classifier> + <type>zip</type> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> + <artifactId>sdnr-wt-helpserver-installer</artifactId> + <version>${ccsdk.features.version}</version> + <classifier>repo</classifier> + <type>zip</type> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.groovy.maven</groupId> + <artifactId>gmaven-plugin</artifactId> + <version>1.0</version> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source>${basedir}/src/main/scripts/TagVersion.groovy</source> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-dockerfile</id> + <goals> + <goal>copy-resources</goal> + </goals> <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <resources> + <resource> + <directory>src/main/docker</directory> + <includes> + <include>Dockerfile</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + <execution> + <id>copy-siteconf</id> + <goals> + <goal>copy-resources</goal> + </goals> <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/docker-stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources</directory> + <includes> + <include>*.conf</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + <execution> + <id>copy-scripts</id> + <goals> + <goal>copy-resources</goal> + </goals> <!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/docker-stage/bin</outputDirectory> + <resources> + <resource> + <directory>src/main/scripts</directory> + <includes> + <include>*.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>unpack features</id> + <phase>generate-sources</phase> + <goals> + <goal>unpack</goal> + </goals> + + <configuration> + <artifactItems> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-framework</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- connectApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-connectApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- eventLogApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-eventLogApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- helpApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-helpApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- maintenanceApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-maintenanceApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- minimumApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-minimumApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- configurationApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-configurationApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- demoApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-demoApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- faultApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-faultApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- inventoryApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-inventoryApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- mediatorApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-mediatorApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- performanceHistoryApp --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-odlux-app-performanceHistoryApp</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>odlux/*</includes> + </artifactItem> + <!-- helpserver resources --> + <artifactItem> + <groupId>${ccsdk.groupId}</groupId> + <artifactId>sdnr-wt-helpserver-provider</artifactId> + <version>${ccsdk.features.version}</version> + <type>jar</type> + <overWrite>false</overWrite> + <outputDirectory>${project.build.directory}/docker-stage/html</outputDirectory> + <includes>help/*</includes> + </artifactItem> + </artifactItems> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <version>0.16.5</version> + <inherited>false</inherited> + <configuration> + <images> + <image> + <name>${image.name}</name> + <build> + <cleanup>try</cleanup> + <dockerFileDir>${basedir}/target/docker-stage</dockerFileDir> + <dockerFile>${basedir}/target/docker-stage/Dockerfile</dockerFile> + <tags> + <tag>${project.docker.latestminortag.version}</tag> + <tag>${project.docker.latestfulltag.version}</tag> + <tag>${project.docker.latesttagtimestamp.version}</tag> + </tags> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>generate-images</id> + <phase>package</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>${docker.push.phase}</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + <extensions> + <extension><!-- this extension is required by wagon in order to pass the proxy --> + <groupId>org.apache.maven.wagon</groupId> + <artifactId>wagon-http-lightweight</artifactId> + <version>2.2</version> + </extension> + </extensions> + </build> +</project> 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/<script>[^<]*<\/script>/<script>\n \/\/ run the application \n require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,helpApp,run\) \{ \n connectApp.register\(\); \n faultApp.register\(\);\n maintenanceApp.register\(\); \n configurationApp.register\(\);\n performanceHistoryApp.register\(\); \n inventoryApp.register\(\);\n eventLogApp.register\(\);\n mediatorApp.register\(\);\n helpApp.register\(\);\n run.runApplication();\n \}\);\n <\/script>/' -i /opt/bitnami/nginx/html/odlux/index.html + +} + +update_nginx_site_conf() { + + if [ "$WEBPROTOCOL" == "HTTPS" ] + then + + sed -i 's|WEBPORT|'$WEBPORT'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|SSL_CERT_DIR|'$SSL_CERT_DIR'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|\bSSL_CERTIFICATE\b|'$SSL_CERTIFICATE'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|\bSSL_CERTIFICATE_KEY\b|'$SSL_CERTIFICATE_KEY'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|SDNRPROTOCOL|'$SDNRPROTOCOL'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|SDNRHOST|'$SDNRHOST'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|SDNRPORT|'$SDNRPORT'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + sed -i 's|LOCALDNS|'$LOCALDNS'|g' /opt/bitnami/nginx/conf/server_blocks/https_site.conf + + #cp /opt/bitnami/nginx/sbin/https_site.conf /opt/bitnami/nginx/conf/server_blocks + rm /opt/bitnami/nginx/conf/server_blocks/http_site.conf + elif [ "$WEBPROTOCOL" == "HTTP" ] + then + sed -i 's|WEBPORT|'$WEBPORT'|g' /opt/bitnami/nginx/conf/server_blocks/http_site.conf + sed -i 's|SDNRPROTOCOL|'$SDNRPROTOCOL'|g' /opt/bitnami/nginx/conf/server_blocks/http_site.conf + sed -i 's|SDNRHOST|'$SDNRHOST'|g' /opt/bitnami/nginx/conf/server_blocks/http_site.conf + sed -i 's|SDNRPORT|'$SDNRPORT'|g' /opt/bitnami/nginx/conf/server_blocks/http_site.conf + sed -i 's|LOCALDNS|'$LOCALDNS'|g' /opt/bitnami/nginx/conf/server_blocks/http_site.conf + #cp /opt/bitnami/nginx/sbin/http_site.conf /opt/bitnami/nginx/conf/server_blocks + rm /opt/bitnami/nginx/conf/server_blocks/https_site.conf + fi + +} + +update_index_html + +update_nginx_site_conf diff --git a/installation/sdnc-web/src/main/scripts/run.sh b/installation/sdnc-web/src/main/scripts/run.sh new file mode 100644 index 00000000..d2489ea0 --- /dev/null +++ b/installation/sdnc-web/src/main/scripts/run.sh @@ -0,0 +1,27 @@ +#!/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========================================================= +### + +/opt/bitnami/nginx/sbin/configure.sh + +# Call the base images' run.sh to start NGINX +bash /run.sh
\ No newline at end of file |