From 4c984ce4f2cc4ef71b21134735b57d80ab09c6b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michael=20D=C3=BCrre?= Date: Mon, 31 Aug 2020 06:36:53 +0200 Subject: [PATCH] update sdnc-web image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit cleanup installation and add more proxy fn Issue-ID: SDNC-1337 Signed-off-by: Michael Dürre Change-Id: Id5fcee41dd43d4935b08b821521c6036c321b2e7 Signed-off-by: Michael Dürre Former-commit-id: c553802849a383176eca863fc35694426f9d31cb --- installation/sdnc-web/pom.xml | 156 ++------------------- installation/sdnc-web/src/main/docker/Dockerfile | 26 ++-- .../sdnc-web/src/main/resources/http_site.conf | 63 +++++---- .../sdnc-web/src/main/resources/https_site.conf | 100 +++++++------ .../sdnc-web/src/main/scripts/configure.sh | 74 ++++++---- installation/sdnc-web/src/main/scripts/run.sh | 15 +- 6 files changed, 177 insertions(+), 257 deletions(-) diff --git a/installation/sdnc-web/pom.xml b/installation/sdnc-web/pom.xml index 8e449752..b06ca009 100644 --- a/installation/sdnc-web/pom.xml +++ b/installation/sdnc-web/pom.xml @@ -20,9 +20,8 @@ docker.io/bitnami/nginx:1.16-debian-9 onap/sdnc-web-image ${project.version} + 1.0.1-SNAPSHOT ${maven.build.timestamp} - org.onap.ccsdk.features.sdnr.wt - 1.0.0 ${https_proxy} yyyyMMdd'T'HHmmss'Z' deploy @@ -32,19 +31,7 @@ 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} - zip - repo - - - org.onap.ccsdk.features.sdnr.wt - sdnr-wt-helpserver-installer + sdnr-wt-odlux-installer ${ccsdk.features.version} zip repo @@ -141,141 +128,14 @@ unpack features generate-sources - unpack + unpack-dependencies - - - - ${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/** - - + ${basedir}/target/docker-stage/html + true + false + true + true diff --git a/installation/sdnc-web/src/main/docker/Dockerfile b/installation/sdnc-web/src/main/docker/Dockerfile index 5009a215..e4c594b2 100644 --- a/installation/sdnc-web/src/main/docker/Dockerfile +++ b/installation/sdnc-web/src/main/docker/Dockerfile @@ -27,26 +27,26 @@ MAINTAINER CCSDK Team (onap-ccsdk@lists.onap.org) 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/ +COPY *.conf /opt/bitnami/nginx/conf/server_blocks/ # setup environment variables ENV WEBPROTOCOL="HTTP" \ - WEBPORT="8080" \ - SDNRPROTOCOL="HTTP" \ - SDNRHOST="172.18.0.3" \ - SDNRPORT="8181" \ - SSL_CERT_DIR="/app/cert" \ - SSL_CERTIFICATE="cert.pem" \ - SSL_CERTIFICATE_KEY="cert.key" + WEBPORT="8080" \ + SDNRPROTOCOL="HTTP" \ + SDNRHOST="172.18.0.3" \ + SDNRPORT="8181" \ + TRPCEURL="" \ + TOPOURL="" \ + TILEURL="" \ + 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 +COPY bin/*.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 +RUN chmod +x /opt/bitnami/nginx/sbin/configure.sh /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 diff --git a/installation/sdnc-web/src/main/resources/http_site.conf b/installation/sdnc-web/src/main/resources/http_site.conf index 640668a1..70554ef0 100644 --- a/installation/sdnc-web/src/main/resources/http_site.conf +++ b/installation/sdnc-web/src/main/resources/http_site.conf @@ -40,33 +40,48 @@ # Default server configuration # server { - listen WEBPORT default_server ; - listen [::]:WEBPORT default_server; + listen WEBPORT default_server ; + listen [::]:WEBPORT default_server; -# root /var/www; +# root /var/www; - index index.html index.htm index.nginx-debian.html; + index index.html index.htm index.nginx-debian.html; - server_name _; - - location ~ ^/$ { - return 301 /odlux/index.html; - } - location ~ /help/$ { - try_files /help/$args.json $uri; - } - location / { - try_files $uri $uri/ @backend; - } - location /websocket { - proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - location @backend { - proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT; - } + server_name _; + location ~ ^/$ { + return 301 /odlux/index.html; + } + location ~ ^/help/$ { + try_files /help/$args.json $uri; + } + location ~ ^/transportpce { + if ($request_uri ~* "/transportpce/(.*)") { + proxy_pass TRPCEURL/$1; + } + } + location ~ ^/topology { + if ($request_uri ~* "/topology/(.*)") { + proxy_pass TOPOURL/$1; + } + } + location ~ ^/tiles/ { + resolver 1.1.1.1; + if ($request_uri ~* "/tiles/(.*)") { + proxy_pass TILEURL/$1; + } + } + location / { + try_files $uri $uri/ @backend; + } + location ^/websocket$ { + proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + location @backend { + proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT; + } } diff --git a/installation/sdnc-web/src/main/resources/https_site.conf b/installation/sdnc-web/src/main/resources/https_site.conf index 5dc4cfba..335aef49 100644 --- a/installation/sdnc-web/src/main/resources/https_site.conf +++ b/installation/sdnc-web/src/main/resources/https_site.conf @@ -40,52 +40,70 @@ # Default server configuration # server { - listen WEBPORT ssl default_server ; - listen [::]:WEBPORT ssl default_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 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; + ssl_certificate SSL_CERT_DIR/SSL_CERTIFICATE; + ssl_certificate_key SSL_CERT_DIR/SSL_CERTIFICATE_KEY; - index index.html index.htm index.nginx-debian.html; +# root /var/www; - server_name _; + index index.html index.htm index.nginx-debian.html; - location ~ ^/$ { - return 301 /odlux/index.html; - } - location ~ /help/$ { - try_files /help/$args.json $uri; - } - location / { - try_files $uri $uri/ @backend; - } - location /websocket { - proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT/websocket; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - location @backend { - proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT; - } + server_name _; + + location ~ ^/$ { + return 301 /odlux/index.html; + } + location ~ ^/help/$ { + try_files /help/$args.json $uri; + } + location ~ ^/transportpce { + try_files $uri $uri/ @backend-transportpce; + } + location ~ ^/topology { + try_files $uri $uri/ @backend-topology; + } + location ~ ^/tiles { + try_files $uri $uri/ @backend-tiles; + } + location / { + try_files $uri $uri/ @backend; + } + location ^/websocket$ { + proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT/websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + location @backend { + proxy_pass SDNRPROTOCOL://SDNRHOST:SDNRPORT; + } + location @backend-transportpce { + proxy_pass TRPCEURL; + } + location @backend-topology { + proxy_pass TOPOURL; + } + location @backend-tiles { + proxy_pass TILEURL; + } } diff --git a/installation/sdnc-web/src/main/scripts/configure.sh b/installation/sdnc-web/src/main/scripts/configure.sh index ca2ea764..2a007672 100644 --- a/installation/sdnc-web/src/main/scripts/configure.sh +++ b/installation/sdnc-web/src/main/scripts/configure.sh @@ -26,37 +26,61 @@ 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/