diff --git a/apps/web/Dockerfile.dev b/apps/web/Dockerfile.dev index 6151362df1199d1fa97deab48705844406af85f6..1422df1de1c4e966c38180f84004e5edce78c9b5 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 6c5a0e4b1c31d4c49b4cdd22325053d9cb2fa252..2db54fc24cf461f2b031293965288b4150b0d772 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 896ca534af4ef0e95f890a22689b9c8f146fcfdf..2523a7db2e67a2c41de6f44b4d29a4257b05257d 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 0000000000000000000000000000000000000000..fd037058f7057ea7153d4a25bfaecff6dfce81aa --- /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 ee210b77083c0a7cd4aa9b4c88cb994d17c2bd3a..cdc5416f696186413ad1cc53bc104786492feafb 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 0000000000000000000000000000000000000000..e7c2156ae7c2655ec00a08db22f470a7a6c621c8 --- /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 eff8044074f5d183de98ae47c2c6194893c99e4d..974b01669fce5c40ee4bd4c4fad9f8728c4c8cb5 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 81c4877c92467de19dfefefdd522285ec76d5dd8..ab4f12ec7d48ba8b425fd2e9338bfa6e14612f60 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"] +