diff --git a/Makefile b/Makefile index 7d742e5..1c727af 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ YK_VERSION=18a3c7f # Add these near the top with other tool versions NODE_VERSION ?= 22.13.0 -PNPM_VERSION ?= latest +PNPM_VERSION ?= 9.15.4 # Add these with other LOCALBIN definitions NODE_DIR ?= $(LOCALBIN_TOOLING)/node @@ -319,14 +319,15 @@ test-k6-performance: ## run k6 performance tests. .PHONY: web-build web-build: node ## build the web components. +## Cleanup + rm -rf ./assets/** + rm -rf ./web/node_modules ## YHS Web $(NODE_PATH) $(PNPM) --prefix ./web install $(NODE_PATH) $(PNPM) --prefix ./web update yunikorn-web ## ensure that the yunikorn-web package is up to date - $(NODE_PATH) uhsApiURL=$(strip $(call uhs_api_url)) yunikornApiURL=$(strip $(call yunikorn_api_url)) \ - moduleFederationRemoteEntry=$(strip $(call uhs_api_url))/remoteEntry.js \ - localUhsComponentsWebAddress=$(strip $(call uhs_api_url)) \ + $(NODE_PATH) production=true \ $(NODE_PATH) $(PNPM) --prefix ./web setenv - $(NODE_PATH) $(PNPM) --prefix ./web build + $(NODE_PATH) $(PNPM) --prefix ./web build:prod echo "UHS Web Build Complete" ## Yunikorn Web echo "Removing node modules from yunikorn-web" @@ -336,10 +337,7 @@ web-build: node ## build the web components. echo "Installing yunikorn-web" $(NODE_PATH) $(PNPM) --prefix ./tmp install echo "Setting environment variables in yunikorn-web" - localSchedulerWebAddress=$(strip $(call yunikorn_api_url)) \ - uhsApiURL=$(strip $(call uhs_api_url)) yunikornApiURL=$(strip $(call yunikorn_api_url)) \ - moduleFederationRemoteEntry=$(strip $(call uhs_api_url))/remoteEntry.js \ - localUhsComponentsWebAddress=$(strip $(call uhs_api_url)) \ + $(NODE_PATH) production=true \ $(NODE_PATH) $(PNPM) --prefix ./tmp setenv:prod echo "Building yunikorn-web" $(NODE_PATH) $(PNPM) --prefix ./tmp build:prod @@ -615,11 +613,9 @@ $(K6): bin/tooling node: $(NODE_DIR) ## download and setup node locally if necessary. $(NODE_DIR): bin/tooling if [ ! -d $(NODE_DIR) ]; then \ - mkdir -p $(NODE_DIR) ; \ - fi ; \ - NODE_ARCH="$$(if [ "$$(uname -m)" = "x86_64" ]; then echo "x64"; elif [ "$$(uname -m)" = "aarch64" ]; then echo "arm64"; else echo "$$(uname -m)"; fi)" ; \ - echo "Downloading node $(NODE_VERSION) for $(OS)-$${NODE_ARCH}: https://nodejs.org/dist/v$(subst x,,$(NODE_VERSION))/node-v$(subst x,,$(NODE_VERSION))-$(OS)-$${NODE_ARCH}.tar.gz" ; \ - curl -fsSL https://nodejs.org/dist/v$(subst x,,$(NODE_VERSION))/node-v$(subst x,,$(NODE_VERSION))-$(OS)-$${NODE_ARCH}.tar.gz | tar -xz --strip-components=1 -C $(NODE_DIR) ; \ - PATH=$(NODE_DIR)/bin:$$PATH $(NODE_DIR)/bin/corepack enable && \ - PATH=$(NODE_DIR)/bin:$$PATH $(NODE_DIR)/bin/corepack prepare pnpm@$(PNPM_VERSION) --activate + mkdir -p $(NODE_DIR) && \ + curl -fsSL https://nodejs.org/dist/v$(subst x,,$(NODE_VERSION))/node-v$(subst x,,$(NODE_VERSION))-$(OS)-$(ARCH).tar.gz | tar -xz --strip-components=1 -C $(NODE_DIR) && \ + $(NODE_DIR)/bin/corepack enable && \ + $(NODE_DIR)/bin/npm install -g pnpm@9 ; \ + fi diff --git a/web/package.json b/web/package.json index 5eb3d91..a34ceb2 100644 --- a/web/package.json +++ b/web/package.json @@ -12,7 +12,6 @@ "run:all": "node node_modules/@angular-architects/module-federation/src/server/mf-dev-server.js", "setenv": "npx --yes ts-node ./src/environments/setEnvironmentVariables.ts", "setenv:prod": "npx --yes ts-node ./src/environments/setEnvironmentVariables.ts prod", - "prebuild:prod": "pnpm set-env-vars", "start:json-server": "json-server --watch mock-server/db.json --config mock-server/server.json", "prettify": "prettier --config ./.prettierrc --write 'src/**/*.{js,ts,json,css,scss,md,html}'" }, @@ -52,11 +51,11 @@ "ngx-build-plus": "^18.0.0", "prettier": "^3.3.3", "typescript": "5.5.4", - "yunikorn-web": "github:G-Research/yunikorn-web" + "yunikorn-web": "github:G-Research/yunikorn-web#denis-coric/dynamic-env" }, "engines": { "pnpm": "9", "node": "22" }, - "packageManager": "pnpm@9" + "packageManager": "pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0" } diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 11e181e..019e460 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -106,8 +106,8 @@ importers: specifier: 5.5.4 version: 5.5.4 yunikorn-web: - specifier: github:G-Research/yunikorn-web - version: https://codeload.github.com/G-Research/yunikorn-web/tar.gz/8628b4f8ee86e55e5c5089da0a7bf04bd86443fd(encoding@0.1.13) + specifier: github:G-Research/yunikorn-web#denis-coric/dynamic-env + version: https://codeload.github.com/G-Research/yunikorn-web/tar.gz/fe44c12687731a878bd35eb1cca9c36ba36ec73a(encoding@0.1.13) packages: @@ -4595,8 +4595,8 @@ packages: resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==} engines: {node: '>=18'} - yunikorn-web@https://codeload.github.com/G-Research/yunikorn-web/tar.gz/8628b4f8ee86e55e5c5089da0a7bf04bd86443fd: - resolution: {tarball: https://codeload.github.com/G-Research/yunikorn-web/tar.gz/8628b4f8ee86e55e5c5089da0a7bf04bd86443fd} + yunikorn-web@https://codeload.github.com/G-Research/yunikorn-web/tar.gz/fe44c12687731a878bd35eb1cca9c36ba36ec73a: + resolution: {tarball: https://codeload.github.com/G-Research/yunikorn-web/tar.gz/fe44c12687731a878bd35eb1cca9c36ba36ec73a} version: 0.0.0 engines: {node: '22', pnpm: '9'} @@ -9485,7 +9485,7 @@ snapshots: yoctocolors-cjs@2.1.2: {} - yunikorn-web@https://codeload.github.com/G-Research/yunikorn-web/tar.gz/8628b4f8ee86e55e5c5089da0a7bf04bd86443fd(encoding@0.1.13): + yunikorn-web@https://codeload.github.com/G-Research/yunikorn-web/tar.gz/fe44c12687731a878bd35eb1cca9c36ba36ec73a(encoding@0.1.13): dependencies: '@angular-architects/module-federation': 18.0.6(@angular/common@18.2.13(@angular/core@18.2.13(rxjs@7.8.1)(zone.js@0.14.10))(rxjs@7.8.1))(@angular/core@18.2.13(rxjs@7.8.1)(zone.js@0.14.10))(encoding@0.1.13) '@angular/animations': 18.2.13(@angular/core@18.2.13(rxjs@7.8.1)(zone.js@0.14.10)) diff --git a/web/src/app/services/envconfig/envconfig.service.ts b/web/src/app/services/envconfig/envconfig.service.ts index cb3eb41..51ebd0d 100644 --- a/web/src/app/services/envconfig/envconfig.service.ts +++ b/web/src/app/services/envconfig/envconfig.service.ts @@ -20,6 +20,7 @@ import { HttpClient } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { EnvConfig } from '@app/models/envconfig.model'; +import { environment } from 'src/environments/environment'; const ENV_CONFIG_JSON_URL = './assets/config/envconfig.json'; @@ -56,15 +57,18 @@ export class EnvConfigService { } getYuniKornWebAddress() { - if (this.envConfig.yunikornApiURL) { - return `${this.envConfig.yunikornApiURL}/ws`; + console.log('environment.production', environment.production); + if (!environment.production) { + return `${this.envConfig.yunikornApiURL}/api`; } - return `${this.uiProtocol}//${this.uiHostname}:${this.uiPort}/ws`; + return `${this.uiProtocol}//${this.uiHostname}:${this.uiPort}/api`; } getUHSWebAddress() { - if (this.envConfig.uhsApiURL) { + console.log('environment.production', environment.production); + + if (!environment.production) { return `${this.envConfig.uhsApiURL}/api`; } diff --git a/web/src/assets/config/envconfig.json b/web/src/assets/config/envconfig.json index 5c02805..159fb01 100644 --- a/web/src/assets/config/envconfig.json +++ b/web/src/assets/config/envconfig.json @@ -1,6 +1,6 @@ { - "localUhsComponentsWebAddress": "http://localhost:3100", + "localUhsComponentsWebAddress": "http://127.0.0.1:8989", "externalLogsURL": "https://logs.example.com?token=abc123&applicationId=", - "yunikornApiURL": "http://localhost:30001", - "uhsApiURL": "http://localhost:8989" -} + "yunikornApiURL": "http://127.0.0.1:30001", + "uhsApiURL": "http://127.0.0.1:8989" +} \ No newline at end of file diff --git a/web/src/environments/environment.ts b/web/src/environments/environment.ts index 5b44c22..8168100 100644 --- a/web/src/environments/environment.ts +++ b/web/src/environments/environment.ts @@ -16,22 +16,10 @@ * limitations under the License. */ -// This file can be replaced during build by using the `fileReplacements` array. -// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. -// The list of file replacements can be found in `angular.json`. - export const environment = { - production: false, + production: true, externalLogsURL: '', yunikornApiURL: '', uhsApiURL: '', + localUhsComponentsWebAddress: '', }; - -/* - * For easier debugging in development mode, you can import the following file - * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`. - * - * This import should be commented out in production mode because it will have a negative impact - * on performance if an error is thrown. - */ -// import 'zone.js/dist/zone-error'; // Included with Angular CLI.