From 97910451fcb1f3f34c81578fc4063017f0f0a6f3 Mon Sep 17 00:00:00 2001 From: Andrew Kapuscinski <akapusci@nrao.edu> Date: Fri, 12 Mar 2021 15:59:27 +0000 Subject: [PATCH] Update ui nginx ws dev --- apps/web/Dockerfile.dev | 2 +- apps/web/angular.json | 24 ++++++++++++++++ .../services/capability-launcher.service.ts | 3 +- apps/web/src/environments/environment.dev.ts | 7 +++++ apps/web/ws-nginx.conf | 28 +++++++++---------- apps/web/ws-nginx.local.conf | 22 +++++++++++++++ docker-compose.yml | 8 ++++++ schema/Dockerfile.local | 3 +- 8 files changed, 79 insertions(+), 18 deletions(-) create mode 100644 apps/web/src/environments/environment.dev.ts create mode 100644 apps/web/ws-nginx.local.conf diff --git a/apps/web/Dockerfile.dev b/apps/web/Dockerfile.dev index 6151362df..1422df1de 100644 --- a/apps/web/Dockerfile.dev +++ b/apps/web/Dockerfile.dev @@ -17,7 +17,7 @@ COPY ./apps/web ./ # TODO: Run e2e tests here # Build the angular app -RUN ./node_modules/.bin/ng build --configuration=test --output-path=dist +RUN ./node_modules/.bin/ng build --configuration=dev --output-path=dist # Use nginx base image FROM nginx:1.19.7-alpine diff --git a/apps/web/angular.json b/apps/web/angular.json index 6c5a0e4b1..2db54fc24 100644 --- a/apps/web/angular.json +++ b/apps/web/angular.json @@ -83,6 +83,30 @@ "maximumError": "5mb" } ] + }, + "dev": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.dev.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "extractCss": true, + "namedChunks": false, + "aot": true, + "extractLicenses": true, + "vendorChunk": false, + "buildOptimizer": true, + "budgets": [ + { + "type": "initial", + "maximumWarning": "2mb", + "maximumError": "5mb" + } + ] } } }, diff --git a/apps/web/src/app/workspaces/services/capability-launcher.service.ts b/apps/web/src/app/workspaces/services/capability-launcher.service.ts index 896ca534a..2523a7db2 100644 --- a/apps/web/src/app/workspaces/services/capability-launcher.service.ts +++ b/apps/web/src/app/workspaces/services/capability-launcher.service.ts @@ -23,7 +23,6 @@ export class CapabilityLauncherService { parameters: any ): Observable<CapabilityRequest> { const url = - environment.workspacesUrl + this.endpoint + capabilityName + '/request/create'; @@ -38,7 +37,7 @@ export class CapabilityLauncherService { capabilityName: string, requestId: string ): Observable<CapabilityExecution> { - const url = `${environment.workspacesUrl}${this.endpoint}${capabilityName}/request/${requestId}/submit`; + const url = `${this.endpoint}${capabilityName}/request/${requestId}/submit`; return this.httpClient.post<CapabilityExecution>(url, null); } } diff --git a/apps/web/src/environments/environment.dev.ts b/apps/web/src/environments/environment.dev.ts new file mode 100644 index 000000000..fd037058f --- /dev/null +++ b/apps/web/src/environments/environment.dev.ts @@ -0,0 +1,7 @@ +export const environment = { + production: true, + // archive search services + apiUrl: 'https://webtest.aoc.nrao.edu/archiveServices/', + // workspace services + workspacesUrl: 'https://ws-dev.nrao.edu/' +}; diff --git a/apps/web/ws-nginx.conf b/apps/web/ws-nginx.conf index ee210b770..cdc5416f6 100644 --- a/apps/web/ws-nginx.conf +++ b/apps/web/ws-nginx.conf @@ -1,25 +1,25 @@ -# Workspaces NGINX config - server { - listen 80; - server_name shipman.aoc.nrao.edu; + listen 80; + root /usr/share/nginx/html; location / { - root /usr/share/nginx/html; - index index.html index.htm; + index index.html index.htm; try_files $uri $uri/ /index.html; } - location ^/capability/(.*) { - proxy_redirect off; - proxy_pass http://shipman.aoc.nrao.edu:3457; - proxy_set_header Origin http://shipman.aoc.nrao.edu:4444; - proxy_hide_header Access-Control-Allow-Origin; - add_header Access-Control-Allow-Origin *; + location /capability { + proxy_pass http://capability:3457; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } - error_page 500 502 503 504 /50x.html; + error_page 500 502 503 504 /50x.html; location = /50x.html { - root /usr/share/nginx/html; + root /usr/share/nginx/html; } } \ No newline at end of file diff --git a/apps/web/ws-nginx.local.conf b/apps/web/ws-nginx.local.conf new file mode 100644 index 000000000..e7c2156ae --- /dev/null +++ b/apps/web/ws-nginx.local.conf @@ -0,0 +1,22 @@ +server { + listen 80; + + location / { + proxy_pass http://frontend:4200; + proxy_set_header Host $host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $http_connection; + } + + location /capability { + proxy_pass http://capability:3457; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection 'upgrade'; + proxy_set_header Host $host; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index eff804407..974b01669 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,13 @@ version: '3.8' services: + nginx: + image: nginx:1.19.7-alpine + restart: always + ports: + - "4444:80" + command: nginx -g "daemon off;" + volumes: + - ./apps/web/ws-nginx.local.conf:/etc/nginx/conf.d/default.conf db: image: marconi.aoc.nrao.edu/ops/ci/db:workspaces restart: always diff --git a/schema/Dockerfile.local b/schema/Dockerfile.local index 81c4877c9..ab4f12ec7 100644 --- a/schema/Dockerfile.local +++ b/schema/Dockerfile.local @@ -4,4 +4,5 @@ FROM marconi.aoc.nrao.edu/ops/base:workspaces WORKDIR /code/schema -ENTRYPOINT ["./bin/run-migrations.sh", "docker"] +CMD ["./bin/run-migrations.sh", "docker"] + -- GitLab