From 8b14e3ce12c725d378a3f968288197ec8819905d Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Tue, 31 Jul 2018 13:32:23 +0100 Subject: [PATCH 1/6] Add webui service --- config/nginx/ernest.licensed | 22 ++++++++++++++++++++++ config/webui/app.globals.ts | 6 ++++++ definition.yml | 12 ++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 config/webui/app.globals.ts diff --git a/config/nginx/ernest.licensed b/config/nginx/ernest.licensed index aeb6b66..32ff069 100644 --- a/config/nginx/ernest.licensed +++ b/config/nginx/ernest.licensed @@ -18,6 +18,10 @@ upstream proxy { server papi:8081 weight=5; } +upstream webui { + server webui:4200 weight=5; +} + server { listen 443 ssl; server_name ERNESTHOSTNAME; @@ -68,6 +72,19 @@ server { error_page 504 =200 @notifysource-close-graceful; } + location /webui { + proxy_pass http://webui; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_http_version 1.1; + proxy_read_timeout 3600s; + chunked_transfer_encoding off; + proxy_buffering off; + proxy_cache off; + error_page 504 =200 @webuisource-close-graceful; + } + location @eventsource-close-graceful { add_header Content-Type text/event-stream; return 200; @@ -82,4 +99,9 @@ server { add_header Content-Type text/event-stream; return 200; } + + location @webuisource-close-graceful { + add_header Content-Type text/event-stream; + return 200; + } } diff --git a/config/webui/app.globals.ts b/config/webui/app.globals.ts new file mode 100644 index 0000000..8413a08 --- /dev/null +++ b/config/webui/app.globals.ts @@ -0,0 +1,6 @@ +export const GlobalVariable = Object.freeze({ + BASE_URL: 'ERNESTHOSTNAME', + BASE_API_URL: 'https://ERNESTHOSTNAME', + SESSION_LENGTH: 604800, //1 week + ENTERPRISE: true +}); diff --git a/definition.yml b/definition.yml index 956917b..06a78b1 100644 --- a/definition.yml +++ b/definition.yml @@ -339,3 +339,15 @@ repos: environment: NATS_URI: nats://nats:4222 restart: always + + - name: webui + edition: enterprise + path: git@github.com:ernestio/ernest-webui.git + branch: master + networks: + - ernest + ports: + - 4200:4200 + volumes: + - ./config/webui/app.globals.ts:/app/src/app/app.globals.ts + restart: always From 9dcdca67fba8b2ba2efa825324560c4debf45420 Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Tue, 31 Jul 2018 13:41:40 +0100 Subject: [PATCH 2/6] Add webui to setup --- setup | 1 + 1 file changed, 1 insertion(+) diff --git a/setup b/setup index 1f26bba..708d187 100755 --- a/setup +++ b/setup @@ -139,6 +139,7 @@ else fi sed -i.bak "s/ERNESTHOSTNAME/$ERNESTHOSTNAME/g" ./config/nginx/ernest.local && rm ./config/nginx/ernest.local.bak +sed -i.bak "s/ERNESTHOSTNAME/$ERNESTHOSTNAME/g" ./config/webui/app.globals.ts && rm ./config/webui/app.globals.ts.bak # Setup a random JWT Token for api-gateway if [[ -z $TOKEN ]]; then From c12751c187eda2fd148a1029955a5f7f68648772 Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Tue, 31 Jul 2018 13:55:21 +0100 Subject: [PATCH 3/6] Rename webui repository --- definition.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/definition.yml b/definition.yml index 06a78b1..724eec3 100644 --- a/definition.yml +++ b/definition.yml @@ -342,7 +342,7 @@ repos: - name: webui edition: enterprise - path: git@github.com:ernestio/ernest-webui.git + path: git@github.com:ernestio/webui.git branch: master networks: - ernest From f016bfb7c44413a04b4f5092e8d62df4efb1baa4 Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Tue, 31 Jul 2018 17:01:12 +0100 Subject: [PATCH 4/6] Add webui to nginx --- config/nginx/ernest.licensed | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/config/nginx/ernest.licensed b/config/nginx/ernest.licensed index 32ff069..22a5be9 100644 --- a/config/nginx/ernest.licensed +++ b/config/nginx/ernest.licensed @@ -18,20 +18,23 @@ upstream proxy { server papi:8081 weight=5; } -upstream webui { - server webui:4200 weight=5; -} - server { listen 443 ssl; server_name ERNESTHOSTNAME; ssl_certificate /etc/nginx/conf.d/ernest.crt; ssl_certificate_key /etc/nginx/conf.d/ernest.key; - location / { + location / { + proxy_pass http://webui/; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location /api/ { proxy_pass http://proxy/; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } location /events { proxy_pass http://backendmonitor; @@ -72,19 +75,6 @@ server { error_page 504 =200 @notifysource-close-graceful; } - location /webui { - proxy_pass http://webui; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_http_version 1.1; - proxy_read_timeout 3600s; - chunked_transfer_encoding off; - proxy_buffering off; - proxy_cache off; - error_page 504 =200 @webuisource-close-graceful; - } - location @eventsource-close-graceful { add_header Content-Type text/event-stream; return 200; @@ -99,9 +89,4 @@ server { add_header Content-Type text/event-stream; return 200; } - - location @webuisource-close-graceful { - add_header Content-Type text/event-stream; - return 200; - } } From dd7a62ac5b12901bdb38332594932651f3f2f95a Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Tue, 31 Jul 2018 18:21:52 +0100 Subject: [PATCH 5/6] Fix webui nginx config --- config/nginx/ernest.licensed | 22 ++++++++++++++-------- definition.yml | 2 +- setup | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/config/nginx/ernest.licensed b/config/nginx/ernest.licensed index 22a5be9..20ad157 100644 --- a/config/nginx/ernest.licensed +++ b/config/nginx/ernest.licensed @@ -24,17 +24,23 @@ server { ssl_certificate /etc/nginx/conf.d/ernest.crt; ssl_certificate_key /etc/nginx/conf.d/ernest.key; - location / { - proxy_pass http://webui/; + location / { + proxy_pass http://webui; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; - } - - location /api/ { - proxy_pass http://proxy/; - proxy_set_header Host $host; + } + + location /api { + proxy_pass http://proxy; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $remote_addr; + } + + location /auth { + proxy_pass http://proxy; + proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; - } + } location /events { proxy_pass http://backendmonitor; diff --git a/definition.yml b/definition.yml index 724eec3..798975a 100644 --- a/definition.yml +++ b/definition.yml @@ -349,5 +349,5 @@ repos: ports: - 4200:4200 volumes: - - ./config/webui/app.globals.ts:/app/src/app/app.globals.ts + - ./config/webui/app.globals.ts:/repo/src/app/app.globals.ts restart: always diff --git a/setup b/setup index 708d187..a3aa861 100755 --- a/setup +++ b/setup @@ -92,7 +92,7 @@ done # license check if [[ -f license.json ]]; then - printf "%s\n%s" "License found" "Validating... " + printf "\n%s\n%s" "License found" "Validating... " wget https://s3-eu-west-1.amazonaws.com/ernest-tools/ernest-verifier-`uname` -O ernest-verifier &> /dev/null chmod +x ernest-verifier From 5e3bfefe6d7aff2278a6855c61758561addc67f9 Mon Sep 17 00:00:00 2001 From: Mark Newman Date: Wed, 1 Aug 2018 12:03:11 +0100 Subject: [PATCH 6/6] Remove port exposure on webui --- definition.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/definition.yml b/definition.yml index 798975a..324f61d 100644 --- a/definition.yml +++ b/definition.yml @@ -346,8 +346,6 @@ repos: branch: master networks: - ernest - ports: - - 4200:4200 volumes: - ./config/webui/app.globals.ts:/repo/src/app/app.globals.ts restart: always