From 38509f1fbad27de70eef1e81eaa2c5084765ca8f Mon Sep 17 00:00:00 2001 From: Michael DÜrre Date: Thu, 27 Jan 2022 13:43:37 +0100 Subject: improve sdnc-web for external apps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add package manager for more flexibility Issue-ID: SDNC-1658 Signed-off-by: Michael DÜrre Change-Id: I30f4aaa24cf05fce212282b06d5e08437dbcfa8b Signed-off-by: Michael DÜrre Former-commit-id: f41f011ff2e18befd77dd63ab828ea14aafac2a7 --- installation/sdnc-web/README.md | 56 ++++ installation/sdnc-web/certs/cacert.pem | 31 ++ installation/sdnc-web/certs/cert.pem | 102 +++++++ installation/sdnc-web/certs/key.pem | 29 ++ installation/sdnc-web/pom.xml | 31 +- installation/sdnc-web/src/main/docker/Dockerfile | 21 +- .../sdnc-web/src/main/resources/favicon.ico | Bin 0 -> 268322 bytes .../sdnc-web/src/main/resources/http_site.conf | 33 +- .../sdnc-web/src/main/resources/https_site.conf | 34 +-- .../sdnc-web/src/main/resources/location.rules | 46 +++ .../src/main/resources/odlux.application.list | 9 + .../sdnc-web/src/main/scripts/configure.py | 34 +++ .../sdnc-web/src/main/scripts/configure.sh | 106 ------- installation/sdnc-web/src/main/scripts/core.py | 333 +++++++++++++++++++++ installation/sdnc-web/src/main/scripts/opm.py | 126 ++++++++ installation/sdnc-web/src/main/scripts/run.sh | 11 +- 16 files changed, 817 insertions(+), 185 deletions(-) create mode 100644 installation/sdnc-web/README.md create mode 100644 installation/sdnc-web/certs/cacert.pem create mode 100644 installation/sdnc-web/certs/cert.pem create mode 100644 installation/sdnc-web/certs/key.pem create mode 100644 installation/sdnc-web/src/main/resources/favicon.ico create mode 100644 installation/sdnc-web/src/main/resources/location.rules create mode 100644 installation/sdnc-web/src/main/resources/odlux.application.list create mode 100644 installation/sdnc-web/src/main/scripts/configure.py delete mode 100644 installation/sdnc-web/src/main/scripts/configure.sh create mode 100644 installation/sdnc-web/src/main/scripts/core.py create mode 100755 installation/sdnc-web/src/main/scripts/opm.py (limited to 'installation') diff --git a/installation/sdnc-web/README.md b/installation/sdnc-web/README.md new file mode 100644 index 00000000..d793b676 --- /dev/null +++ b/installation/sdnc-web/README.md @@ -0,0 +1,56 @@ +# sdnc web image + + +## folder structure + +| folder | description | +| ------ | ----------- | +| /opt/bitnami/nginx/conf/server_blocks/http(s)_site.conf | nginx config | +| /opt/bitnami/nginx/conf/server_blocks/location.rules | forwarding rules for nginx | +| /app/odlux | http content files (html, js, css, ...) | +| /app/odlux.application.list | application list file | +| /app/opm.py | Odlux package manager for install or uninstall apps | +| /app/init.d/ | autoinstall folder for opm | + +## Default app order + +| index | application | +| ----- | ----------- | +| 1 | connectApp | +| 10 | faultApp | +| 20 | maintenanceApp | +| 30 | configurationApp | +| 55 | performanceHistoryApp | +| 70 | inventoryApp | +| 75 | eventLogApp | +| 90 | mediatorApp | +| 200 | helpApp | + + +## usage + +### auto installation + +To auto install additional applications for odlux they can be easily injected before startup into the ```/app/init.d/``` folder. There are two options of file format allowed. + +[1] The first fileformat is e.g. 55linkCalculationApp.jar but also .zip is allowed. The important thing is that a number is leading the app package to specify the order number where the menu item is ordered in the menu bar. So the linkCalculationApp would be located between performanceApp and inventoryApp. + +[2] The second is the default jar format, like it would be installed into the opendaylight karaf environment, including a blueprint and the sources. There the filename is not important because application name and index will be detected by the blueprint information. + + +### manual method +``` +opm install --name myApp --index 53 --file myarchive.zip +``` +``` +opm install --url https://link-to-my-odlux-application.jar +``` + +``` +opm uninstall --name myApp +``` + +``` +opm list +``` + diff --git a/installation/sdnc-web/certs/cacert.pem b/installation/sdnc-web/certs/cacert.pem new file mode 100644 index 00000000..0146e6b4 --- /dev/null +++ b/installation/sdnc-web/certs/cacert.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFPjCCAyagAwIBAgIJAJ6u7cCnzrWdMA0GCSqGSIb3DQEBCwUAMCwxDjAMBgNV +BAsMBU9TQUFGMQ0wCwYDVQQKD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Nd6IbiMz +L87zmNMDmHcGbfoRCj8OkhuggX9Lx1/CkhpXimuYsZOFQi5blr/u+v4mIbsgbmi9 +7j+cUHDP0zLycvSvxKHty51LwmaX9a4wkJl5zBU4O1sd/H9tWcEmwJ39ltKoBKBx +c94Zc3iMm5ytRWGj+0rKzLDAXEWpoZ5bE5PLJauA6UDCxDLfs3FwhbS7uDggxYvf +jySF5FCNET94oJ+m8s7VeHvoa8iPGKvXrIqdd7XDHnqJJlVKr7m9S0fMbyEB8ci2 +RtOXDt93ifY1uhoEtEykn4dqBSp8ezvNMnwoXdYPDvTd9uCAFeWFLVreBAWxd25h +PsBTkZA5hpa/rA+mKv6Af4VBViYr8cz4dZCsFChuioVebe9ighrfjB//qKepFjPF +CyjzKN1u0JKm/2x/ORqxkTONG8p3uDwoIOyimUcTtTMv42bfYD88RKakqSFXE9G+ +Z0LlaKABqfjK49o/tsAp+c5LoNlYllKhnetO3QAdraHwdmC36BhoghzR1jpX751A +cZn2VH3Q4XKyp01cJNCJIrua+A+bx6zh3RyW6zIIkbRCbET+UD+4mr8WIcSE3mtR +ZVlnhUDO4z9//WKMVzwS9Rh8/kuszrGFI1KQozXCHLrce3YP6RYZfOed79LXaRwX +dYY= +-----END CERTIFICATE----- diff --git a/installation/sdnc-web/certs/cert.pem b/installation/sdnc-web/certs/cert.pem new file mode 100644 index 00000000..1195a126 --- /dev/null +++ b/installation/sdnc-web/certs/cert.pem @@ -0,0 +1,102 @@ +Bag Attributes + friendlyName: sdnc@sdnc.onap.org + localKeyID: 54 69 6D 65 20 31 36 31 31 36 38 33 32 39 38 35 32 32 +Key Attributes: +-----BEGIN ENCRYPTED PRIVATE KEY----- +MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIk4s7xBaGXdgCAggA +MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECI7qjnyFxa3mBIIEyHgvXzCmhOT/ +atHsneicZqaGXxz57z1mPosvGwf2w6WerxOyW+cFej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yEG+GgPglQUj9TBIRGmn9e067M6dB9 +vhnK12SBQNTyoH5vWSbP2u5wk6jV5QKYyqMbNHAD1uvsBbWy4FpoI+epp2Y3XcAr +kgBzopKSaCbj1thxxUHsMYBspVDR+D0SR4fsHhj+Y3jmr37s3q1NOSkWUMcMa7Hi +zaozRSo8hYUwP5RHpPcNCTcK0dhFPAWXyGPtP7IribGQDhUAdde/s4yPuSLa28zy +uTKWU5vSlaE+9WRSKvbA8HdKTPv45dV/qUCHITvPOdsqkWJ3qhNQMrrD9Mx17oj/ +zGZTcRGQG62dfYUR9v2rGE6Gj7MzaE1SrQgYqtCzWfJ9e3fBqOlko5jtZ5Kz86DU +ZFISrkb1sATngzWFtvyNgHFx4fUsYDJbc8XlB47H5Byyj/6SypS6dMpwqpNezn8s +xQi3yUfpg7GQzTFKdwmqK/KVeh0KZF/0FM+ZCUPh6IaRDcp8+Hm7H72ZD4vPxs4s +8bvLx9bxfiI+/6Om51IQrQ== +-----END ENCRYPTED PRIVATE KEY----- +Bag Attributes + friendlyName: sdnc@sdnc.onap.org + localKeyID: 54 69 6D 65 20 31 36 31 31 36 38 33 32 39 38 35 32 32 +subject=CN = sdnc, OU = sdnc@sdnc.onap.org:DEV, OU = OSAAF, O = ONAP, C = US + +issuer=C = US, O = ONAP, OU = OSAAF, CN = intermediateCA_9 + +-----BEGIN CERTIFICATE----- +MIIE6zCCA9OgAwIBAgIJALyx+8HFJuYTMA0GCSqGSIb3DQEBCwUAMEcxCzAJBgNV +BAYTAlVTMQ0wCwYDVQQKDARPTkFQMQ4wDAYDVQQLDAVPU0FBRjEZMBcGA1UEAwwQ +aW50ZXJtZWRpYXRlQ0FfOTAeFw0yMTAxMjYxNzQ4MThaFw0yMjAxMjYxNzQ4MTha +MFwxDTALBgNVBAMMBHNkbmMxHzAdBgNVBAsMFnNkbmNAc2RuYy5vbmFwLm9yZzpE +RVYxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJ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CIaXe5C4JbwLGKweAost5E6ud2rscN/c5UYNPs/ +IskfnMxULLzJpEXdUHwLQaLJj0fQQBRHq23s8P7Emu44ZeEzxAQfI+4pKRzTYxag +4dIitf91nhUq5SQI/pcki+/ElkwfeKHYQLBDU8ygG/gZKh1UHxIjfva7v/ENqL2h +H8UDXsLhOx/guaJzH2CRQdKMminsdtnNgSRRPzWRe4EMc2ah6G6E4B/Za/n7Rhq5 +r6jpvM/XIxPCY4ci5jJIbvdahS4I54kMaLRTSl4gT8+n8ie/GzhZlXX+1MR8HCZc +8SWDYxmc8MkJ20iekiSc +-----END CERTIFICATE----- +Bag Attributes + friendlyName: CN=intermediateCA_9,OU=OSAAF,O=ONAP,C=US +subject=C = US, O = ONAP, OU = OSAAF, CN = intermediateCA_9 + +issuer=OU = OSAAF, O = ONAP, C = US + +-----BEGIN CERTIFICATE----- +MIIEdTCCAl2gAwIBAgIBBzANBgkqhkiG9w0BAQsFADAsMQ4wDAYDVQQLDAVPU0FB +RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVMwHhcNMTgwODE3MTg1MTM3WhcN +MjMwODE3MTg1MTM3WjBHMQswCQYDVQQGEwJVUzENMAsGA1UECgwET05BUDEOMAwG +A1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVkaWF0ZUNBXzkwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCv0HHUkba3uNtNI3jPKimUcd6RNwmhSCJL +neMWpnjqp5/A+HCKyNsEaT4y177hNLmCm/aMm1u2JIfikc+8wEqLCSBBPz+P0h+d +o+sZ7U+4oeQizdYYpEdzHJ2SieHHa8vtu80rU3nO2NEIkuYC20HcKSEtl8fFKsk3 +nqlhY+tGfYJPTXcDOQAO40BTcgat3C3uIJHkWJJ4RivunE4LEuRv9QyKgAw7rkJV +v+f7guqpZlXy6dzAkuU7XULWcgo55MkZlssoiErMvEZJad5aWKvRY3g7qUjaQ6wO +15wOAUoRBW96eeZZbytgn8kybcBy++Ue49gPtgm1MF/KlAsp0MD5AgMBAAGjgYYw +gYMwHQYDVR0OBBYEFIH3mVsQuciM3vNSXupOaaBDPqzdMB8GA1UdIwQYMBaAFFNV +M/JL69BRscF4msEoMXvv6u1JMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/ +BAQDAgGGMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0B +AQsFAAOCAgEADxNymiCNr2e37iLReoaxKmZvwox0cTiNAaj7iafRzmwIoY3VXO8Q +ix5IYcp4FaQ7fV1jyp/AmaSnyHf6Osl0sx8PxsQkO7ALttxKUrjfbvNSVUA2C/vl +u5m7UVJLIUtFDZBWanzUSmkTsYLHpiANFQKd2c/cU1qXcyzgJVFEFVyyHNkF7Is+ ++pjG9M1hwQHOoTnEuU013P7X1mHek+RXEfhJWwe7UsZnBKZaZKbQZu7hEtqKWYp/ +QsHgnjoLYXsh0WD5rz/mBxdTdDLGpFqWDzDqb8rsYnqBzoowvsasV8X8OSkov0Ht +8Yka0ckFH9yf8j1Cwmbl6ttuonOhky3N/gwLEozuhy7TPcZGVyzevF70kXy7g1CX +kpFGJyEHXoprlNi8FR4I+NFzbDe6a2cFow1JN19AJ9Z5Rk5m7M0mQPaQ4RcikjB3 +aoLsASCJTm1OpOFHfxEKiBW4Lsp3Uc5/Rb9ZNbfLrwqWZRM7buW1e3ekLqntgbky +uKKISHqVJuw/vXHl1jNibEo9+JuQ88VNuAcm7WpGUogeCa2iAlPTckPZei+MwZ8w +tpvxTyYlZEC8DWzY1VC29+W2N5cvh01e2E3Ql08W1zL63dqrgdEZ3VWjzooYi4ep +BmMXTvouW+Flyvcw/0oTcfN0biDIt0mCkZ5CQVjfGL9DTOYteR5hw+k= +-----END CERTIFICATE----- diff --git a/installation/sdnc-web/certs/key.pem b/installation/sdnc-web/certs/key.pem new file mode 100644 index 00000000..04bc8491 --- /dev/null +++ b/installation/sdnc-web/certs/key.pem @@ -0,0 +1,29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WudYt4ooBcJL99XgTGxFAb2q04JKxh18V6DRfj7pY2uhZongI +OdcMSE2H4wKBgQCUzNEcAkhUbmEd264oCB/VsFR9UZZ7pPD3l3X8jZ2WmVQvdS69 +eCuXOfenMjIIiUfeo24g/HuLSER2Ch6pDnykm6WTEd9c+9Bnru8QgT4dFFbyZusC +2WtmZa1lkBpzInMdPptAsVr+ATSbkh3tn9xnYiPNNUfRo738K2AAauvugQKBgQCd +dzbqoOXdr4sOm0LzybtTyDBwJB/x2ej0Se9/EpjUw5DqCu6YduE2YTVPK7lEpTol +JE0G+0NAt5CtzbntB1/Ihwf1gQZ3lsuCkiJJ0K8DPGeC38ZOx5kFpUObp+EfcU29 +KUmlhsImX1xMWJiUD9B6ETN6hxTghVc2o1bXX7YJnQKBgQCGiRnjCEmKd8hefkS8 +ub9F4kdOzXmG4XhK+oZWVGPXIGfnoxm6IbWcjSArA/m8TLfJSHPKujnLOnOkffpi +7+PWzTHn5BFDGUb8z3mxwJV8e9szoDkljoiUwYU/S8eatAm6lyJv1gp2wmDI9DfT +86BefCEvGk3EzAo3L6hhHdICzA== +-----END PRIVATE KEY----- + diff --git a/installation/sdnc-web/pom.xml b/installation/sdnc-web/pom.xml index 8817c936..2724c7a5 100644 --- a/installation/sdnc-web/pom.xml +++ b/installation/sdnc-web/pom.xml @@ -59,7 +59,7 @@ copy-dockerfile copy-resources - + validate ${basedir}/target/docker-stage @@ -78,27 +78,27 @@ copy-siteconf copy-resources - + validate - ${basedir}/target/docker-stage + ${basedir}/target/docker-stage/conf src/main/resources *.conf + *.rules true - copy-scripts copy-resources - + validate ${basedir}/target/docker-stage/bin @@ -107,12 +107,33 @@ src/main/scripts *.sh + *.py true + + copy-favicon + + copy-resources + + validate + + ${basedir}/target/docker-stage/html + + + src/main/resources + + favicon.ico + odlux.application.list + + false + + + + diff --git a/installation/sdnc-web/src/main/docker/Dockerfile b/installation/sdnc-web/src/main/docker/Dockerfile index a552137f..9f3f6870 100644 --- a/installation/sdnc-web/src/main/docker/Dockerfile +++ b/installation/sdnc-web/src/main/docker/Dockerfile @@ -22,12 +22,14 @@ # Base bitnami nginx image FROM ${base.image.repo} LABEL maintainer="CCSDK Team (onap-ccsdk@lists.onap.org)" - +USER root +RUN apt-get update && apt-get install python3-minimal python3-urllib3 unzip openssl -y +USER 1001 # copy ODLUX files to nginx COPY html /opt/bitnami/nginx/html # copy site conf files -COPY *.conf /opt/bitnami/nginx/conf/server_blocks/ +COPY conf/* /opt/bitnami/nginx/conf/server_blocks/ # setup environment variables ENV WEBPROTOCOL="HTTP" \ @@ -38,20 +40,25 @@ ENV WEBPROTOCOL="HTTP" \ TRPCEURL="" \ TOPOURL="" \ TILEURL="" \ - DNS_RESOLVER="1.1.1.1" \ + SITEDOCURL="" \ + DNS_RESOLVER="1.1.1.1 ipv6=off" \ + DNS_INTERNAL_RESOLVER="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/*.sh /opt/bitnami/nginx/sbin/ +COPY bin/* /opt/bitnami/nginx/sbin/ USER root -RUN chmod +x /opt/bitnami/nginx/sbin/configure.sh /opt/bitnami/nginx/sbin/run.sh +RUN chmod +x /opt/bitnami/nginx/sbin/run.sh /opt/bitnami/nginx/sbin/opm.py # 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 - +RUN chmod -R g+w /opt/bitnami/nginx/html/odlux && mkdir /app/init.d +RUN chmod 666 /opt/bitnami/nginx/conf/server_blocks/*.rules +#RUN chown 1001:1001 /app/odlux.application.list && chmod 777 /app/odlux.application.list +RUN chown -R 1001:1001 /app +RUN ln -s /opt/bitnami/nginx/sbin/opm.py /usr/local/bin/opm USER 1001 CMD [ "/opt/bitnami/nginx/sbin/run.sh" ] diff --git a/installation/sdnc-web/src/main/resources/favicon.ico b/installation/sdnc-web/src/main/resources/favicon.ico new file mode 100644 index 00000000..650067eb Binary files /dev/null and b/installation/sdnc-web/src/main/resources/favicon.ico differ diff --git a/installation/sdnc-web/src/main/resources/http_site.conf b/installation/sdnc-web/src/main/resources/http_site.conf index ea6c33be..3d9ade13 100644 --- a/installation/sdnc-web/src/main/resources/http_site.conf +++ b/installation/sdnc-web/src/main/resources/http_site.conf @@ -49,36 +49,5 @@ server { 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 { - proxy_pass TOPOURL; - } - location ~ ^/tiles/ { - resolver DNS_RESOLVER; - 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; - } + include server_blocks/location.rules; } diff --git a/installation/sdnc-web/src/main/resources/https_site.conf b/installation/sdnc-web/src/main/resources/https_site.conf index 5e61fece..6dcfb790 100644 --- a/installation/sdnc-web/src/main/resources/https_site.conf +++ b/installation/sdnc-web/src/main/resources/https_site.conf @@ -68,36 +68,6 @@ server { 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 { - proxy_pass TOPOURL; - } - location ~ ^/tiles/ { - resolver DNS_RESOLVER; - 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; - } + include server_blocks/location.rules; + } diff --git a/installation/sdnc-web/src/main/resources/location.rules b/installation/sdnc-web/src/main/resources/location.rules new file mode 100644 index 00000000..83120d60 --- /dev/null +++ b/installation/sdnc-web/src/main/resources/location.rules @@ -0,0 +1,46 @@ +location ~ ^/$ { + return 301 " /odlux/index.html"; +} +location ~ ^/help/$ { + try_files /help/$args.json $uri; +} +location ~ ^/transportpce { + resolver DNS_INTERNAL_RESOLVER; + if ($request_uri ~* "/transportpce/(.*)") { + proxy_pass TRPCEURL/$1; + } +} +location ~ ^/topology/ { + resolver DNS_INTERNAL_RESOLVER; + proxy_pass TOPOURL; +} +location ~ ^/sitedoc/ { + resolver DNS_INTERNAL_RESOLVER; + if ($request_uri ~* "/sitedoc/(.*)") { + proxy_pass SITEDOCURL/topology/stadok/$1; + } +} +location ~ ^/tiles/ { + resolver DNS_RESOLVER; + if ($request_uri ~* "/tiles/(.*)") { + proxy_pass TILEURL/$1; + } +} +location ~ ^/terrain/ { + resolver DNS_INTERNAL_RESOLVER; + if ($request_uri ~* "/terrain/(.*)") { + proxy_pass TERRAINURL/$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; +} \ No newline at end of file diff --git a/installation/sdnc-web/src/main/resources/odlux.application.list b/installation/sdnc-web/src/main/resources/odlux.application.list new file mode 100644 index 00000000..9176aae6 --- /dev/null +++ b/installation/sdnc-web/src/main/resources/odlux.application.list @@ -0,0 +1,9 @@ +1 connectApp +10 faultApp +20 maintenanceApp +30 configurationApp +55 performanceHistoryApp +70 inventoryApp +75 eventLogApp +90 mediatorApp +200 helpApp diff --git a/installation/sdnc-web/src/main/scripts/configure.py b/installation/sdnc-web/src/main/scripts/configure.py new file mode 100644 index 00000000..255cbcd5 --- /dev/null +++ b/installation/sdnc-web/src/main/scripts/configure.py @@ -0,0 +1,34 @@ +#!/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========================================================= +### + +# load core methods to call +from core import * + +# Comment listening on 8080 in nginx.conf as we don't want nginx to listen on any port other than SDNR +sedInFile('listen','\#listen', '/opt/bitnami/nginx/conf/nginx.conf') +initial_load() +update_index_html() + +check_for_rule_template() + +update_nginx_site_conf() diff --git a/installation/sdnc-web/src/main/scripts/configure.sh b/installation/sdnc-web/src/main/scripts/configure.sh deleted file mode 100644 index a257e6e1..00000000 --- a/installation/sdnc-web/src/main/scripts/configure.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/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 - #default values - ODLUX_AUTH_METHOD="basic" - ENABLE_ODLUX_RBAC=${ENABLE_ODLUX_RBAC:-false} - - if [ "$ENABLE_OAUTH" == "true" ]; then - ODLUX_AUTH_METHOD="oauth" - fi - echo "authentication is $ODLUX_AUTH_METHOD" - echo "rbac access is enabled: $ENABLE_ODLUX_RBAC" - ODLUX_CONFIG='{"authentication":"'$ODLUX_AUTH_METHOD'","enablePolicy":'$ENABLE_ODLUX_RBAC'}' -# sed -z 's/