aboutsummaryrefslogtreecommitdiffstats
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/Dockerfile1
-rw-r--r--installation/sdnc-web/src/main/resources/http_site.conf13
-rw-r--r--installation/sdnc-web/src/main/resources/https_site.conf12
-rw-r--r--installation/sdnc-web/src/main/resources/location.rules18
-rw-r--r--installation/sdnc-web/src/main/scripts/core.py15
-rw-r--r--installation/sdnc-web/src/main/scripts/run.sh26
6 files changed, 55 insertions, 30 deletions
diff --git a/installation/sdnc-web/src/main/docker/Dockerfile b/installation/sdnc-web/src/main/docker/Dockerfile
index 9f3f6870..6433d3f6 100644
--- a/installation/sdnc-web/src/main/docker/Dockerfile
+++ b/installation/sdnc-web/src/main/docker/Dockerfile
@@ -37,6 +37,7 @@ ENV WEBPROTOCOL="HTTP" \
SDNRPROTOCOL="HTTP" \
SDNRHOST="172.18.0.3" \
SDNRPORT="8181" \
+ SDNRWEBSOCKETPORT="8182" \
TRPCEURL="" \
TOPOURL="" \
TILEURL="" \
diff --git a/installation/sdnc-web/src/main/resources/http_site.conf b/installation/sdnc-web/src/main/resources/http_site.conf
index 3d9ade13..1fe43039 100644
--- a/installation/sdnc-web/src/main/resources/http_site.conf
+++ b/installation/sdnc-web/src/main/resources/http_site.conf
@@ -50,4 +50,17 @@ server {
server_name _;
include server_blocks/location.rules;
+
+ gzip on;
+ gzip_min_length 1000;
+ gzip_comp_level 5;
+ gzip_proxied any;
+ gzip_vary on;
+ gzip_types text/plain
+ application/json
+ application/xml
+ application/yang-data+json
+ application/yang-data+xml
+ text/javascript
+ application/javascript;
}
diff --git a/installation/sdnc-web/src/main/resources/https_site.conf b/installation/sdnc-web/src/main/resources/https_site.conf
index 6dcfb790..734a48bc 100644
--- a/installation/sdnc-web/src/main/resources/https_site.conf
+++ b/installation/sdnc-web/src/main/resources/https_site.conf
@@ -70,4 +70,16 @@ server {
include server_blocks/location.rules;
+ gzip on;
+ gzip_min_length 1000;
+ gzip_comp_level 5;
+ gzip_proxied any;
+ gzip_vary on;
+ gzip_types text/plain
+ application/json
+ application/xml
+ application/yang-data+json
+ application/yang-data+xml
+ text/javascript
+ application/javascript;
}
diff --git a/installation/sdnc-web/src/main/resources/location.rules b/installation/sdnc-web/src/main/resources/location.rules
index 83120d60..8f1f527f 100644
--- a/installation/sdnc-web/src/main/resources/location.rules
+++ b/installation/sdnc-web/src/main/resources/location.rules
@@ -10,33 +10,17 @@ location ~ ^/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_pass http://SDNRHOST:SDNRWEBSOCKETPORT/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
diff --git a/installation/sdnc-web/src/main/scripts/core.py b/installation/sdnc-web/src/main/scripts/core.py
index feb57348..6bdd4b59 100644
--- a/installation/sdnc-web/src/main/scripts/core.py
+++ b/installation/sdnc-web/src/main/scripts/core.py
@@ -76,14 +76,22 @@ def add_application(name, index, file=None):
def initial_load():
files = os.listdir(INIT_FOLDER)
regex = r"([0-9]+)([a-zA-Z]+)\.(jar|zip)"
+ regexUrl = r"([0-9]+)([a-zA-Z]+)\.(url)"
for file in files:
matches = re.finditer(regex,file)
match = next(matches, None)
+ matchesUrl = re.finditer(regexUrl,file)
+ matchUrl = next(matchesUrl, 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)
+ elif matchUrl 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)
@@ -269,8 +277,14 @@ def update_nginx_site_conf():
WEBPROTOCOL=getEnv('WEBPROTOCOL')
WEBPORT=getEnv('WEBPORT')
SDNRPROTOCOL=getEnv('SDNRPROTOCOL')
+ SDNCWEBHOST=getEnv('HOSTNAME')
SDNRHOST=getEnv('SDNRHOST')
+ if SDNRHOST == "sdnc.onap":
+ # Request is from K8s
+ SDNCWEBHOSTINDEX=SDNCWEBHOST[SDNCWEBHOST.rindex("-")+1:]
+ SDNRHOST = "sdnc-" + SDNCWEBHOSTINDEX + ".onap"
SDNRPORT=getEnv('SDNRPORT')
+ SDNRWEBSOCKETPORT=getEnv('SDNRWEBSOCKETPORT',SDNRPORT)
DNS_RESOLVER=getEnv('DNS_RESOLVER')
DNS_INTERNAL_RESOLVER=getEnv('DNS_INTERNAL_RESOLVER')
if FN is None:
@@ -286,6 +300,7 @@ def update_nginx_site_conf():
sedInFile('SDNRPROTOCOL',SDNRPROTOCOL,FN)
sedInFile('SDNRHOST',SDNRHOST ,FN)
sedInFile('SDNRPORT',SDNRPORT,FN)
+ sedInFile('SDNRWEBSOCKETPORT',SDNRWEBSOCKETPORT, FN)
sedInFile('DNS_RESOLVER',DNS_RESOLVER ,FN)
sedInFile('DNS_INTERNAL_RESOLVER',DNS_INTERNAL_RESOLVER ,FN)
diff --git a/installation/sdnc-web/src/main/scripts/run.sh b/installation/sdnc-web/src/main/scripts/run.sh
index 3343faf4..630a3e36 100644
--- a/installation/sdnc-web/src/main/scripts/run.sh
+++ b/installation/sdnc-web/src/main/scripts/run.sh
@@ -25,19 +25,19 @@ python3 /opt/bitnami/nginx/sbin/configure.py
echo "starting sdnc-web"
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 " WEBPROTOCOL : $WEBPROTOCOL"
+echo " WEBPORT : $WEBPORT"
+echo " SDNRPROTOCOL : $SDNRPROTOCOL"
+echo " SDNRHOST : $SDNRHOST"
+echo " SDNRPORT : $SDNRPORT"
+echo " SDNRWSPORT : $SDNRWEBSOCKETPORT"
+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 "======================="
if [ "$WEBPROTOCOL" == "HTTPS" ]; then
echo " SSL_CERT_DIR : $SSL_CERT_DIR"