From 7db08bf43fee59ecd03d0c8026b63d44a6b4b88e Mon Sep 17 00:00:00 2001 From: kexkey Date: Sat, 15 Dec 2018 15:01:45 -0500 Subject: [PATCH] Moved statuspage from proxy to gatekeeper and refactored correctly --- api_auth_docker/default-ssl.conf | 3 +- api_auth_docker/statuspage.html | 53 +++++++++++++++++++ .../installer/docker/docker-compose.yaml | 1 + .../app/templates/installer/start.sh | 2 +- .../app/templates/installer/testfeatures.sh | 2 +- proxy_docker/app/script/requesthandler.sh | 6 --- proxy_docker/app/script/responsetoclient.sh | 2 +- proxy_docker/app/script/statuspage.sh | 23 -------- 8 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 api_auth_docker/statuspage.html delete mode 100644 proxy_docker/app/script/statuspage.sh diff --git a/api_auth_docker/default-ssl.conf b/api_auth_docker/default-ssl.conf index 726191f..65f40bc 100644 --- a/api_auth_docker/default-ssl.conf +++ b/api_auth_docker/default-ssl.conf @@ -10,7 +10,8 @@ server { location /status { auth_basic "status"; auth_basic_user_file conf.d/status/htpasswd; - proxy_pass http://proxy:8888; + root /etc/nginx/conf.d; + index statuspage.html; } location / { diff --git a/api_auth_docker/statuspage.html b/api_auth_docker/statuspage.html new file mode 100644 index 0000000..f0030a9 --- /dev/null +++ b/api_auth_docker/statuspage.html @@ -0,0 +1,53 @@ + + + + + + + + + +

+


+
+
diff --git a/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml b/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml
index aa0d208..638e0f5 100644
--- a/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml
+++ b/install/generator-cyphernode/generators/app/templates/installer/docker/docker-compose.yaml
@@ -14,6 +14,7 @@ services:
       - "<%= gatekeeper_datapath %>/keys.properties:/etc/nginx/conf.d/keys.properties"
       - "<%= gatekeeper_datapath %>/api.properties:/etc/nginx/conf.d/api.properties"
       - "<%= gatekeeper_datapath %>/htpasswd:/etc/nginx/conf.d/status/htpasswd"
+      - "<%= gatekeeper_datapath %>/installation.json:/etc/nginx/conf.d/status/installation.json"
     command: $USER
 
 #    deploy:
diff --git a/install/generator-cyphernode/generators/app/templates/installer/start.sh b/install/generator-cyphernode/generators/app/templates/installer/start.sh
index b5fe209..c4ae464 100644
--- a/install/generator-cyphernode/generators/app/templates/installer/start.sh
+++ b/install/generator-cyphernode/generators/app/templates/installer/start.sh
@@ -15,7 +15,7 @@ docker-compose -f $current_path/docker-compose.yaml up -d --remove-orphans
 docker run --rm -it -v $current_path/testfeatures.sh:/testfeatures.sh \
 -v $current_path/gatekeeper/keys.properties:/keys.properties \
 -v $current_path/gatekeeper/cert.pem:/cert.pem \
--v <%= proxy_datapath %>:/proxy \
+-v <%= gatekeeper_datapath %>:/gatekeeper \
 --network cyphernodenet alpine:3.8 /testfeatures.sh
 
 echo "Point your favorite browser to one of the following URLs to access Cyphernode's status page:"
diff --git a/install/generator-cyphernode/generators/app/templates/installer/testfeatures.sh b/install/generator-cyphernode/generators/app/templates/installer/testfeatures.sh
index dd874c0..2c17bc1 100644
--- a/install/generator-cyphernode/generators/app/templates/installer/testfeatures.sh
+++ b/install/generator-cyphernode/generators/app/templates/installer/testfeatures.sh
@@ -311,6 +311,6 @@ result="${result}$(feature_status ${returncode} 'Lightning error!')}"
 
 result="{${result}]}"
 
-echo "${result}" > /proxy/installation.json
+echo "${result}" > /gatekeeper/installation.json
 
 echo -e "\r\n\e[1;32mTests finished.\e[0m" > /dev/console
diff --git a/proxy_docker/app/script/requesthandler.sh b/proxy_docker/app/script/requesthandler.sh
index 81d7fe0..4be59ed 100644
--- a/proxy_docker/app/script/requesthandler.sh
+++ b/proxy_docker/app/script/requesthandler.sh
@@ -244,12 +244,6 @@ main()
           serve_ots_getfile $(echo "${line}" | cut -d ' ' -f2 | cut -d '/' -f3)
           break
           ;;
-        status)
-          # curl (GET) http://192.168.111.152:8080/status
-
-          status_page
-          break
-          ;;
       esac
       break
     fi
diff --git a/proxy_docker/app/script/responsetoclient.sh b/proxy_docker/app/script/responsetoclient.sh
index 774fb66..ad4467d 100644
--- a/proxy_docker/app/script/responsetoclient.sh
+++ b/proxy_docker/app/script/responsetoclient.sh
@@ -18,7 +18,7 @@ response_to_client()
   echo -en "Content-Type: ${contenttype}\r\nContent-Length: ${#response}\r\n\r\n${response}"
 
   # Small delay needed for the data to be processed correctly by peer
-  sleep 0.2s
+  sleep 0.5s
 }
 
 htmlfile_response_to_client()
diff --git a/proxy_docker/app/script/statuspage.sh b/proxy_docker/app/script/statuspage.sh
deleted file mode 100644
index a86956c..0000000
--- a/proxy_docker/app/script/statuspage.sh
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-. ./trace.sh
-. ./responsetoclient.sh
-
-status_page() {
-  cat < statuspage.html
-
-
-
-
-Hello from Cyphernode!

-EOF - - cat db/installation.json >> statuspage.html - - cat <> statuspage.html - - -EOF - - htmlfile_response_to_client ./ statuspage.html -}