aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--installation/sdnc-web/README.md56
-rw-r--r--installation/sdnc-web/certs/cacert.pem31
-rw-r--r--installation/sdnc-web/certs/cert.pem102
-rw-r--r--installation/sdnc-web/certs/key.pem29
-rw-r--r--installation/sdnc-web/pom.xml31
-rw-r--r--installation/sdnc-web/src/main/docker/Dockerfile21
-rw-r--r--installation/sdnc-web/src/main/resources/favicon.icobin0 -> 268322 bytes
-rw-r--r--installation/sdnc-web/src/main/resources/http_site.conf33
-rw-r--r--installation/sdnc-web/src/main/resources/https_site.conf34
-rw-r--r--installation/sdnc-web/src/main/resources/location.rules46
-rw-r--r--installation/sdnc-web/src/main/resources/odlux.application.list9
-rw-r--r--installation/sdnc-web/src/main/scripts/configure.py34
-rw-r--r--installation/sdnc-web/src/main/scripts/configure.sh106
-rw-r--r--installation/sdnc-web/src/main/scripts/core.py333
-rwxr-xr-xinstallation/sdnc-web/src/main/scripts/opm.py126
-rw-r--r--installation/sdnc-web/src/main/scripts/run.sh11
16 files changed, 817 insertions, 185 deletions
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
+BAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzAeFw0xODA0MDUx
+NDE1MjhaFw0zODAzMzExNDE1MjhaMCwxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQK
+DARPTkFQMQswCQYDVQQGEwJVUzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
+ggIBAMA5pkgRs7NhGG4ew5JouhyYakgYUyFaG121+/h8qbSdt0hVQv56+EA41Yq7
+XGie7RYDQK9NmAFF3gruE+6X7wvJiChp+Cyd7sFMnb65uWhxEdxWTM2BJFrgfzUn
+H8ZCxgaCo3XH4PzlKRy2LQQJEJECwl/RZmRCXijMt5e9h8XoZY/fKkKcZZUsWNCM
+pTo266wjvA9MXLmdgReRj0+vrCjrNqy+htwJDztoiHWiYPqT6o8EvGcgjNqjlZx7
+NUNf8MfLDByqKF6+wRbHv1GKjn3/V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fYD88RKakqSFXE9G+
+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: <No Attributes>
+-----BEGIN ENCRYPTED PRIVATE KEY-----
+MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQIk4s7xBaGXdgCAggA
+MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECI7qjnyFxa3mBIIEyHgvXzCmhOT/
+atHsneicZqaGXxz57z1mPosvGwf2w6WerxOyW+cFejNepgMH+c5MQAfTuTD0H5g3
+SoyC9TKfHBld439sKO3hnDBROsypugO2uP4ownGiKQxOdwHNCOS8nC1EbUYC6nHR
+B5QtRpDHZzB2t9dd6+RU1PuPUFRxjIPZsCM1DdKKhMHQHr8WDSbi170XfzC6O2Ko
+23tgDq9cQYTqmgFedjyWpEmxfcibaujGOZ4VQej+tn60A03cXHG05tN/XvDCbQty
+9bw1kiS8e+qmdUhkEIhR2aY0Z9sCUOLwJPDg/1vE0ZwK/bRGRD432PD+dmSLFV+v
+m2m/ec8IQer8hCleI6GBaFI28QZyS2jznbzS7b/hU+nyxkZXejAymU1OBcNV4H8M
+qf5ITWs+Ma5fc/8X90MlJacmBo3JuusTvDImLFP+5Nn5Yo3cnDeiAyMo0vFuywrv
+bATYAncPlz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5Byyj/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
+RVYxDjAMBgNVBAsMBU9TQUFGMQ0wCwYDVQQKDARPTkFQMQswCQYDVQQGEwJVUzCC
+ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALQtwrW3Eiru18BADUiBIbEU
+sruiLu63h6jDprLqrxGt57d5MSpxaRoOPoWDPE/Z6LvMwTGfiQIPsFnZ2H3YtDsI
+/p1fOFAHxCUl5Cs4HnYjJUkDs2U7dXUYZR8enNPZRfFZNUOajxERUgyE/0g+yHS1
+AlysMInFDblmNEYgQoNiN996FpBamHivCDXw612bBkkZQOTeKJaCZ0DPGIYGAJtf
+Q1kIL7Y1D3c3C0VD39homtxqIb21rje63YVISprbfKX0RxijkWw0wXjaRDwxPGwH
+TrDHgsrPH/zv9Hak6cJkTw5e7VBHHlL1sHYgPSDLd/8PFGkmD4a/N/IKL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KUrjfbvNSVUA2C/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 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC0LcK1txIq7tfA
+QA1IgSGxFLK7oi7ut4eow6ay6q8Rree3eTEqcWkaDj6FgzxP2ei7zMExn4kCD7BZ
+2dh92LQ7CP6dXzhQB8QlJeQrOB52IyVJA7NlO3V1GGUfHpzT2UXxWTVDmo8REVIM
+hP9IPsh0tQJcrDCJxQ25ZjRGIEKDYjffehaQWph4rwg18OtdmwZJGUDk3iiWgmdA
+zxiGBgCbX0NZCC+2NQ93NwtFQ9/YaJrcaiG9ta43ut2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5CtzbntB1/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 @@
<id>copy-dockerfile</id>
<goals>
<goal>copy-resources</goal>
- </goals> <!-- here the phase you need -->
+ </goals>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage</outputDirectory>
@@ -78,27 +78,27 @@
<id>copy-siteconf</id>
<goals>
<goal>copy-resources</goal>
- </goals> <!-- here the phase you need -->
+ </goals>
<phase>validate</phase>
<configuration>
- <outputDirectory>${basedir}/target/docker-stage</outputDirectory>
+ <outputDirectory>${basedir}/target/docker-stage/conf</outputDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>*.conf</include>
+ <include>*.rules</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 -->
+ </goals>
<phase>validate</phase>
<configuration>
<outputDirectory>${basedir}/target/docker-stage/bin</outputDirectory>
@@ -107,12 +107,33 @@
<directory>src/main/scripts</directory>
<includes>
<include>*.sh</include>
+ <include>*.py</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
+ <execution>
+ <id>copy-favicon</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/docker-stage/html</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <includes>
+ <include>favicon.ico</include>
+ <include>odlux.application.list</include>
+ </includes>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
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
--- /dev/null
+++ b/installation/sdnc-web/src/main/resources/favicon.ico
Binary files 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/<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 run.configure('$ODLUX_CONFIG'); \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
-
- #replace require expression
- sed -z 's/require(\["run"\],\ function\ (run)/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\)/' -i /opt/bitnami/nginx/html/odlux/index.html
- #replace run.runApplication expression
- sed -z 's/run.runApplication();/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();/' -i /opt/bitnami/nginx/html/odlux/index.html
- #replace run.configure expression if exists
- sed -z 's/run.configureApplication([^)]\+)/run.configureApplication('$ODLUX_CONFIG');/' -i /opt/bitnami/nginx/html/odlux/index.html
-
-}
-
-update_nginx_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
- sed -i 's|DNS_RESOLVER|'$DNS_RESOLVER'|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;|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
-
-update_nginx_site_conf
diff --git a/installation/sdnc-web/src/main/scripts/core.py b/installation/sdnc-web/src/main/scripts/core.py
new file mode 100644
index 00000000..feb57348
--- /dev/null
+++ b/installation/sdnc-web/src/main/scripts/core.py
@@ -0,0 +1,333 @@
+###
+# ============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=========================================================
+###
+import subprocess
+import os
+import json
+import zipfile
+import re
+import uuid
+import urllib3
+import shutil
+import re
+import ssl
+urllib3.disable_warnings()
+
+APPLICATION_LISTFILE="/app/odlux.application.list"
+INIT_FOLDER="/app/init.d"
+ODLUX_BASE_FOLDER='/app/odlux'
+INDEX_HTML=ODLUX_BASE_FOLDER+'/index.html'
+INDEX_HTML_TEMPLATE=INDEX_HTML+'.template'
+DEFAULT_APPLICATIONS=["connectApp" "faultApp" "maintenanceApp" "configurationApp" "performanceHistoryApp" "inventoryApp" "eventLogApp" "mediatorApp" "helpApp"]
+http = urllib3.PoolManager(cert_reqs=ssl.CERT_NONE)
+
+def exec(command):
+ output = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE).stdout.read()
+ return output
+def execToStdOut(commandArray):
+ process = subprocess.Popen(commandArray, shell=False)
+ process.communicate()
+
+def download(url, dst):
+ print("downloading from {}...".format(url),end="")
+ with open(dst, 'wb') as out_file:
+ resp= http.request('GET',url, preload_content=False)
+ shutil.copyfileobj(resp, out_file)
+ resp.release_conn()
+ print("done")
+
+def getEnv(key, defaultValue=None):
+ x=os.getenv(key)
+ return x if x is not None and len(x)>0 else defaultValue
+
+def sedInFile(old, nu, fn):
+ execToStdOut(['sed', '-i', 's|{}|{}|g'.format(old,nu),fn])
+
+def add_application(name, index, file=None):
+ apps = load_applications()
+ if index==0:
+ print("no index given. put it to last position")
+ index=apps[len(apps)-1]['index']+10
+ apps.append(dict(index=index,name=name))
+ if file is not None and os.path.exists(file):
+ extract(file)
+ else:
+ print('unable to find file {}'.format(file))
+ write_applications(apps)
+ print("{} installed on index {}".format(name, index))
+
+def initial_load():
+ files = os.listdir(INIT_FOLDER)
+ regex = r"([0-9]+)([a-zA-Z]+)\.(jar|zip)"
+ for file in files:
+ matches = re.finditer(regex,file)
+ match = next(matches, None)
+ if match is not None:
+ print("installing {}".format(file))
+ index = int(match.group(1))
+ name = match.group(2)
+ add_application(name,index,INIT_FOLDER+'/'+file)
+ else:
+ print("no index naming format found. try to autodetect")
+ infos = autoDetectInfosFromJar(file)
+ if infos is None:
+ print("unable to detect index and application name for {}".format(file))
+ else:
+ add_application(infos['name'],infos['index'],INIT_FOLDER+'/'+file)
+
+
+
+def containsBlueprintExpression(file) -> bool:
+ print("check if file {} is blueprint".format(file))
+ with open(file, 'r') as fp:
+ lines = fp.readlines()
+ for line in lines:
+ if "<blueprint" in line:
+ return True
+ fp.close()
+ return False
+
+def findBlueprintXml(dir):
+ result = [os.path.join(dp, f) for dp, dn, filenames in os.walk(dir) for f in filenames if os.path.splitext(f)[1] == '.xml']
+ for file in result:
+ if containsBlueprintExpression(file):
+ return file
+ return None
+
+def autoDetectInfosFromJar(file):
+ print("autodetect infos(appName and index) from jar {}".format(file))
+ tmpDir=getRandomTempDir()
+ regexBundleName = r"<property[\ ]+name=\"bundleName\"[\ ]+value=\"([^\"]+)\""
+ regexIndex = r"<property[\ ]+name=\"index\"[\ ]+value=\"([^\"]+)\""
+ name=None
+ index=0
+ with zipfile.ZipFile(file, 'r') as zip_ref:
+ zip_ref.extractall(tmpDir)
+ blueprint = findBlueprintXml(tmpDir)
+ if blueprint is None:
+ return None
+ with open(blueprint) as fp:
+ lines = fp.readlines()
+ for line in lines:
+ if name is None:
+ matches = re.finditer(regexBundleName, line)
+ match = next(matches,None)
+ if match is not None:
+ name = match.group(1)
+ if index == 0:
+ matches = re.finditer(regexIndex, line)
+ match = next(matches,None)
+ if match is not None:
+ index = int(match.group(1))
+
+ fp.close()
+ print("found infos from jar: name={} index={}".format(name,index))
+ return dict(index=index,name=name)
+
+def getRandomTempDir(create=False):
+ while(True):
+ dir='/tmp/{}'.format(uuid.uuid4())
+ if not os.path.exists(dir):
+# print("found random not-existing dir {}".format(dir))
+ if create:
+ os.makedirs(dir)
+ return dir
+# print("dir {} already exists. try new".format(dir))
+ return None
+
+def getRandomTempFile():
+ dir = getRandomTempDir(True)
+ if dir is None:
+ return None
+
+ while True:
+ file='{}/{}.dat'.format(dir,uuid.uuid4())
+ if not os.path.exists(file):
+# print("found random not-existing file {}".format(file))
+ return file
+# print("file {} already exists. try new".format(file))
+ return None
+
+def extract(fn):
+
+ tmpDir=getRandomTempDir()
+ with zipfile.ZipFile(fn, 'r') as zip_ref:
+ zip_ref.extractall(tmpDir)
+ exec(" ".join(['cp','-r',tmpDir+'/odlux/*',ODLUX_BASE_FOLDER+'/']))
+ zip_ref.close()
+
+
+def load_applications():
+ apps=[]
+ if os.path.exists(APPLICATION_LISTFILE):
+ with open(APPLICATION_LISTFILE,'r') as fp:
+ lines= fp.readlines()
+ for line in lines:
+ if len(line.rstrip())<=0:
+ continue
+ try:
+ hlp=line.split(' ')
+ apps.append(dict(index=int(hlp[0]),name=hlp[1].rstrip()))
+ except:
+ print('problem reading line {}'.format(line))
+ fp.close()
+ else:
+ index=10
+ for app in DEFAULT_APPLICATIONS:
+ apps.append(dict(index=index,name=app))
+ index+=10
+# print('applications loaded={}'.format(apps))
+ return sorted(apps, key=lambda d: d['index'])
+
+def write_applications(apps):
+# print('saving applications={}'.format(apps))
+ apps = sorted(apps, key=lambda d: d['index'])
+ os.remove(APPLICATION_LISTFILE)
+ with open(APPLICATION_LISTFILE,'w') as fp:
+ for app in apps:
+ fp.write('{} {}\n'.format(app['index'], app['name']))
+ fp.close()
+
+def update_index_html(apps=None):
+
+# # Backup the index.html file
+ if not os.path.exists(INDEX_HTML_TEMPLATE):
+ execToStdOut(['cp',INDEX_HTML,INDEX_HTML_TEMPLATE])
+ else:
+ execToStdOut(['cp',INDEX_HTML_TEMPLATE,INDEX_HTML])
+# #default values
+ if apps is None:
+ apps=load_applications()
+ ODLUX_AUTH_METHOD="basic"
+ ENABLE_ODLUX_RBAC=getEnv('ENABLE_ODLUX_RBAC','false')
+ TRPCEGUIURL=getEnv('TRPCEGUIURL')
+
+ if getEnv('ENABLE_OAUTH') == "true":
+ ODLUX_AUTH_METHOD="oauth"
+ ODLUX_CONFIG=dict(authentication=ODLUX_AUTH_METHOD,enablePolicy=ENABLE_ODLUX_RBAC == 'true')
+ print("authentication is {}".format(ODLUX_AUTH_METHOD))
+ print("rbac access is enabled: {}".format(ENABLE_ODLUX_RBAC))
+
+ if TRPCEGUIURL is not None:
+ ODLUX_CONFIG['transportpceUrl']=TRPCEGUIURL
+ print("trpce gui url is: {}".format(TRPCEGUIURL))
+
+# 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 run.configure('$ODLUX_CONFIG'); \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
+ requireArg=""
+ fnArgs=""
+ appCalls=""
+ for app in apps:
+ requireArg+='"{}",'.format(app['name'])
+ fnArgs+='{},'.format(app['name'])
+ appCalls+='{}.register();\\n'.format(app['name'])
+ #replace require expression
+ execToStdOut(['sed', '-z', 's/require(\["run"\],\ function\ (run)/require\(\[{}\"run\"\], function \({}run\)/'.format(requireArg,fnArgs), '-i', INDEX_HTML])
+ #replace run.runApplication expression
+ execToStdOut(['sed','-z', 's/run.runApplication();/{}run.runApplication();/'.format(appCalls), '-i',INDEX_HTML])
+ #replace run.configure expression if exists
+ execToStdOut(['sed', '-z', 's|run.configureApplication([^)]\+)|run.configureApplication({});|'.format(json.dumps(ODLUX_CONFIG)), '-i', INDEX_HTML])
+
+
+def check_for_rule_template():
+ if os.path.exists('/opt/bitnami/nginx/conf/server_blocks/location.rules.tmpl'):
+ print("using template for forwarding rules")
+ execToStdOut(['cp','/opt/bitnami/nginx/conf/server_blocks/location.rules.tmpl','/opt/bitnami/nginx/conf/server_blocks/location.rules'])
+
+def update_nginx_site_conf():
+ FN=None
+ if getEnv('WEBPROTOCOL') == "HTTPS":
+ FN='/opt/bitnami/nginx/conf/server_blocks/https_site.conf'
+ execToStdOut(['rm', '/opt/bitnami/nginx/conf/server_blocks/http_site.conf'])
+ SSL_CERT_DIR=getEnv('SSL_CERT_DIR')
+ SSL_CERTIFICATE=getEnv('SSL_CERTIFICATE')
+ SSL_CERTIFICATE_KEY=getEnv('SSL_CERTIFICATE_KEY')
+ sedInFile('SSL_CERTIFICATE_KEY',SSL_CERTIFICATE_KEY,FN)
+ sedInFile('SSL_CERT_DIR',SSL_CERT_DIR,FN)
+ sedInFile('SSL_CERTIFICATE',SSL_CERTIFICATE, FN)
+
+ elif getEnv('WEBPROTOCOL') == "HTTP":
+ FN='/opt/bitnami/nginx/conf/server_blocks/http_site.conf'
+ execToStdOut(['rm', '/opt/bitnami/nginx/conf/server_blocks/https_site.conf'])
+
+ WEBPROTOCOL=getEnv('WEBPROTOCOL')
+ WEBPORT=getEnv('WEBPORT')
+ SDNRPROTOCOL=getEnv('SDNRPROTOCOL')
+ SDNRHOST=getEnv('SDNRHOST')
+ SDNRPORT=getEnv('SDNRPORT')
+ DNS_RESOLVER=getEnv('DNS_RESOLVER')
+ DNS_INTERNAL_RESOLVER=getEnv('DNS_INTERNAL_RESOLVER')
+ if FN is None:
+ print("unknown env WEBPROTOCOL: {}".format(WEBPROTOCOL))
+ exit(1)
+
+ # replace needed base parameters
+ sedInFile('WEBPORT',WEBPORT,FN)
+
+ FN='/opt/bitnami/nginx/conf/server_blocks/location.rules'
+ # replace needed parameters in forwarding rules
+ sedInFile('WEBPORT',WEBPORT,FN)
+ sedInFile('SDNRPROTOCOL',SDNRPROTOCOL,FN)
+ sedInFile('SDNRHOST',SDNRHOST ,FN)
+ sedInFile('SDNRPORT',SDNRPORT,FN)
+ sedInFile('DNS_RESOLVER',DNS_RESOLVER ,FN)
+ sedInFile('DNS_INTERNAL_RESOLVER',DNS_INTERNAL_RESOLVER ,FN)
+
+ TRPCEURL=getEnv('TRPCEURL')
+ TOPOURL=getEnv('TOPOURL')
+ SITEDOCURL=getEnv('SITEDOCURL')
+ TILEURL=getEnv('TILEURL')
+ DATAPROVIDERURL=getEnv('DATAPROVIDERURL')
+ TERRAINURL=getEnv('TERRAINURL')
+ # handle optional parameters
+ if TRPCEURL is None:
+ print("transportPCE forwarding disabled")
+ sedInFile('proxy_pass TRPCEURL/$1;','return 404;',FN)
+ else:
+ sedInFile('TRPCEURL',TRPCEURL ,FN)
+
+ if TOPOURL is None:
+ print("topology api forwarding disabled")
+ sedInFile('proxy_pass TOPOURL;','return 404;',FN)
+ else:
+ sedInFile('TOPOURL',TOPOURL ,FN)
+
+ if SITEDOCURL is None:
+ print("sitedoc api forwarding disabled")
+ sedInFile('proxy_pass SITEDOCURL/topology/stadok/$1;','return 404;', FN)
+ else:
+ sedInFile('SITEDOCURL',SITEDOCURL, FN)
+
+ if TILEURL is None:
+ print("tile server forwarding disabled")
+ sedInFile('proxy_pass TILEURL/$1;','return 404;',FN)
+ else:
+ sedInFile('TILEURL',TILEURL ,FN)
+
+ if DATAPROVIDERURL is None:
+ print("data provider forwarding disabled")
+ sedInFile('proxy_pass DATAPROVIDERURL/$1;','return 404;',FN)
+ else:
+ sedInFile('DATAPROVIDERURL',DATAPROVIDERURL ,FN)
+
+ if TERRAINURL is None:
+ print("terrain server forwarding disabled")
+ sedInFile('proxy_pass TERRAINURL/$1;','return 404;',FN)
+ else:
+ sedInFile('TERRAINURL',TERRAINURL ,FN)
diff --git a/installation/sdnc-web/src/main/scripts/opm.py b/installation/sdnc-web/src/main/scripts/opm.py
new file mode 100755
index 00000000..955822aa
--- /dev/null
+++ b/installation/sdnc-web/src/main/scripts/opm.py
@@ -0,0 +1,126 @@
+#!/usr/bin/python3
+###
+# ============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=========================================================
+###
+
+# opm = ODLUX package manager
+# install odlux application inside of the container
+# $1 install|uninstall
+# $2 appName
+# $3 zip file to add(extract)
+
+import sys
+from core import *
+
+
+
+
+# install application
+# $1 appName
+# $2
+# $2 zip file (optional)
+def run_install(name, index=0, file=None):
+ if name is None:
+ error("no name given")
+ add_application(name, index, file)
+ update_index_html()
+
+
+# install application from url
+# $1 url
+# $2 name (optional)
+# $3 index (optional)
+def run_install_from_url(url, name=None, index=0):
+ if url is None:
+ error("no url given")
+ print("installing from url...")
+ localFile = getRandomTempFile()
+ download(url,localFile)
+ if (name is None) or (index==0):
+ infos = autoDetectInfosFromJar(localFile)
+ if infos is not None:
+ if name is None:
+ name = infos['name']
+ if index == 0:
+ index = infos['index']
+ add_application(name,index,localFile)
+
+# uninstall application
+# $1 appName
+def run_uninstall(name):
+ if name is None:
+ error("no name given")
+ apps = load_applications()
+ apps = [app for app in apps if app['name']!=name]
+ write_applications(apps)
+ update_index_html()
+
+def run_list(args):
+ apps = load_applications()
+ print('installed apps')
+ for app in apps:
+ print('{} {}'.format(app['index'],app['name']))
+
+def print_help():
+ print("ODLUX package manager")
+ print("=====================")
+ print("usage:")
+ print(" opm.py install --name myApplication --index 23 --file app.zip")
+ print(" opm.py install --url https://link-to-my-odlux-application.jar")
+ print(" opm.py list")
+ print(" opm.py uninstall --name myApplication")
+
+def error(msg):
+ print('ERROR: {}'.format(msg))
+ exit(1)
+
+args = sys.argv
+args.pop(0)
+cmd = args.pop(0)
+name=None
+index=0
+file=None
+url=None
+while(len(args)>0):
+ x=args.pop(0)
+ if x=='--name':
+ name=args.pop(0) if len(args)>0 else error("no name given")
+ elif x=='--index':
+ index=int(args.pop(0)) if len(args)>0 else error("no index given")
+ elif x=='--file':
+ file=args.pop(0) if len(args)>0 else error("no file given")
+ elif x=='--url':
+ url=args.pop(0) if len(args)>0 else error("no file given")
+
+print("command={} name={} index={} file={} url={}".format(cmd,name,index, file, url))
+
+if cmd=='install':
+ if url is not None:
+ run_install_from_url(url, name, index)
+ else:
+ run_install(name,index,file)
+elif cmd=='uninstall':
+ run_uninstall(name)
+elif cmd=='list':
+ run_list(args)
+else:
+ print_help
+ exit(1)
+exit(0)
diff --git a/installation/sdnc-web/src/main/scripts/run.sh b/installation/sdnc-web/src/main/scripts/run.sh
index c310837f..3343faf4 100644
--- a/installation/sdnc-web/src/main/scripts/run.sh
+++ b/installation/sdnc-web/src/main/scripts/run.sh
@@ -21,19 +21,24 @@
#============LICENSE_END=========================================================
###
-/opt/bitnami/nginx/sbin/configure.sh
+python3 /opt/bitnami/nginx/sbin/configure.py
echo "starting sdnc-web"
-echo "================="
+echo "======================="
echo " WEBPROTOCOL : $WEBPROTOCOL"
echo " WEBPORT : $WEBPORT"
echo " SDNRPROTOCOL : $SDNRPROTOCOL"
echo " SDNRHOST : $SDNRHOST"
echo " SDNRPORT : $SDNRPORT"
echo " DNS_RESOLVER : $DNS_RESOLVER"
+echo " DNS_INTERNAL_RESOLVER : $DNS_INTERNAL_RESOLVER"
echo " TRPCEURL : $TRPCEURL"
+echo " TRPCEGUIURL : $TRPCEGUIURL"
echo " TOPOURL : $TOPOURL"
echo " TILEURL : $TILEURL"
+echo " SITEDOCURL : $SITEDOCURL"
+echo " TERRAINURL : $TERRAINURL"
+echo "======================="
if [ "$WEBPROTOCOL" == "HTTPS" ]; then
echo " SSL_CERT_DIR : $SSL_CERT_DIR"
echo -n " SSL_CERTIFICATE: $SSL_CERTIFICATE"
@@ -71,4 +76,4 @@ if [ ! -z "$DEBUG" ]; then
fi
# Call the base images' run.sh to start NGINX
-bash /run.sh
+bash /opt/bitnami/scripts/nginx/run.sh