diff options
author | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2020-08-31 06:36:53 +0200 |
---|---|---|
committer | Michael Dürre <michael.duerre@highstreet-technologies.com> | 2020-08-31 08:31:42 +0200 |
commit | 4c984ce4f2cc4ef71b21134735b57d80ab09c6b1 (patch) | |
tree | c0370bf10b6dbd27ff9b5421c27be9203414efbd /installation/sdnc-web/src/main/scripts | |
parent | eef450e6f6c80c5d39517b0c84b9b5e01b5e65ae (diff) |
update sdnc-web image
cleanup installation and add more proxy fn
Issue-ID: SDNC-1337
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Change-Id: Id5fcee41dd43d4935b08b821521c6036c321b2e7
Signed-off-by: Michael Dürre <michael.duerre@highstreet-technologies.com>
Former-commit-id: c553802849a383176eca863fc35694426f9d31cb
Diffstat (limited to 'installation/sdnc-web/src/main/scripts')
-rw-r--r-- | installation/sdnc-web/src/main/scripts/configure.sh | 74 | ||||
-rw-r--r-- | installation/sdnc-web/src/main/scripts/run.sh | 15 |
2 files changed, 58 insertions, 31 deletions
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/<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 + # 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\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,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 networkMapApp.register\(\);\n linkCalculationApp.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 - - #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 - #cp /opt/bitnami/nginx/sbin/http_site.conf /opt/bitnami/nginx/conf/server_blocks - rm /opt/bitnami/nginx/conf/server_blocks/https_site.conf + + if [ "$WEBPROTOCOL" == "HTTPS" ] + then + FN=/opt/bitnami/nginx/conf/server_blocks/https_site.conf + rm /opt/bitnami/nginx/conf/server_blocks/http_site.conf + + sed -i 's|SSL_CERT_DIR|'$SSL_CERT_DIR'|g' $FN + sed -i 's|\bSSL_CERTIFICATE\b|'$SSL_CERTIFICATE'|g' $FN + sed -i 's|\bSSL_CERTIFICATE_KEY\b|'$SSL_CERTIFICATE_KEY'|g' $FN + + elif [ "$WEBPROTOCOL" == "HTTP" ] + then + FN=/opt/bitnami/nginx/conf/server_blocks/http_site.conf + rm /opt/bitnami/nginx/conf/server_blocks/https_site.conf fi + if [ -z "$FN" ]; then + echo "unknown env WEBPROTOCOL: $WEBPROTOCOL" + exit 1 + fi + + # replace needed parameters + sed -i 's|WEBPORT|'$WEBPORT'|g' $FN + sed -i 's|SDNRPROTOCOL|'$SDNRPROTOCOL'|g' $FN + sed -i 's|SDNRHOST|'$SDNRHOST'|g' $FN + sed -i 's|SDNRPORT|'$SDNRPORT'|g' $FN + + # handle optional parameters + if [ -z "$TRPCEURL" ]; then + echo "transportPCE forwarding disabled" + sed -i 's|proxy_pass TRPCEURL/$1;|return 404;|g' $FN + + else + sed -i 's|TRPCEURL|'$TRPCEURL'|g' $FN + fi + if [ -z "$TOPOURL" ]; then + echo "topology api forwarding disabled" + sed -i 's|proxy_pass TOPOURL/$1;|return 404;|g' $FN + else + sed -i 's|TOPOURL|'$TOPOURL'|g' $FN + fi + if [ -z "$TILEURL" ]; then + echo "tile server forwarding disabled" + sed -i 's|proxy_pass TILEURL/$1;|return 404;|g' $FN + else + sed -i 's|TILEURL|'$TILEURL'|g' $FN + fi + } update_index_html diff --git a/installation/sdnc-web/src/main/scripts/run.sh b/installation/sdnc-web/src/main/scripts/run.sh index 604ebdee..9d912a65 100644 --- a/installation/sdnc-web/src/main/scripts/run.sh +++ b/installation/sdnc-web/src/main/scripts/run.sh @@ -25,12 +25,15 @@ echo "starting sdnc-web" echo "=================" -echo " WEBPROTOCOL: $WEBPROTOCOL" -echo " WEBPORT: $WEBPORT" -echo " SDNRPROTOCOL: $SDNRPROTOCOL" -echo " SDNRHOST: $SDNRHOST" -echo " SDNRPORT: $SDNRPORT" -echo " SSL_CERT_DIR: $SSL_CERT_DIR" +echo " WEBPROTOCOL : $WEBPROTOCOL" +echo " WEBPORT : $WEBPORT" +echo " SDNRPROTOCOL : $SDNRPROTOCOL" +echo " SDNRHOST : $SDNRHOST" +echo " SDNRPORT : $SDNRPORT" +echo " TRPCEURL : $TRPCEURL" +echo " TOPOURL : $TOPOURL" +echo " TILEURL : $TILEURL" +echo " SSL_CERT_DIR : $SSL_CERT_DIR" echo -n " SSL_CERTIFICATE: $SSL_CERTIFICATE" if [ -f "$SSL_CERTIFICATE" ]; then echo " (exists)" |