summaryrefslogtreecommitdiffstats
path: root/installation/sdnc-web/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'installation/sdnc-web/src/main')
-rw-r--r--installation/sdnc-web/src/main/docker/Dockerfile57
-rw-r--r--installation/sdnc-web/src/main/resources/http_site.conf69
-rw-r--r--installation/sdnc-web/src/main/resources/https_site.conf89
-rw-r--r--installation/sdnc-web/src/main/scripts/TagVersion.groovy41
-rw-r--r--installation/sdnc-web/src/main/scripts/configure.sh66
-rw-r--r--installation/sdnc-web/src/main/scripts/run.sh27
6 files changed, 349 insertions, 0 deletions
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