From 0fb40f07a0d1c9188964e29e330dd610dd3f75dc Mon Sep 17 00:00:00 2001 From: acies312 Date: Mon, 11 Dec 2023 18:06:11 +0300 Subject: [PATCH 01/11] updated local deployment instruction --- save-cloud-charts/save-cloud/README.md | 16 ++++++++---- .../save-cloud/values-images.yaml | 25 +++++++++++++++++++ 2 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 save-cloud-charts/save-cloud/values-images.yaml diff --git a/save-cloud-charts/save-cloud/README.md b/save-cloud-charts/save-cloud/README.md index 243e5dfd2b..0dc0a52bb4 100644 --- a/save-cloud-charts/save-cloud/README.md +++ b/save-cloud-charts/save-cloud/README.md @@ -47,6 +47,16 @@ command line using `--set` flag. ## Local deployment * Install minikube: https://minikube.sigs.k8s.io/docs/start/ +* install csi addon in minikube to provide this StorageClass type in your minikube cluster + ```bash + minikube addons enable csi-hostpath-driver + ``` +* [optional] modify kube config file to use base64 encripted info about certs and keys instead of using path to cert file + ```yaml + certificate-authority-data: + client-certificate-data: + client-key-data: + ``` * Environment should be prepared: ```bash minikube ssh @@ -60,13 +70,9 @@ command line using `--set` flag. build.docker.tls-verify=true build.docker.cert-path=/.minikube/certs ``` -* (Required only once) Install Helm chart using `values-minikube.yaml`: - ```bash - $ helm install save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml - ``` * (On consecutive deployments) Upgrade an existing Helm release: ```bash - $ helm upgrade save-cloud save-cloud-0.1.0.tgz --namespace save-cloud --values values-minikube.yaml + $ helm --kube-context=minikube --namespace=save-cloud upgrade -i save-cloud save-cloud-0.1.0.tgz/ --values values-minikube.yaml --values=values-images.yaml ``` * Database migrations can be run by setting value `mysql.migrations.enabled` to `true` (no additional setup, migrations are executed by init container, but may be too slow with constant recreations of backend/sandbox pods) diff --git a/save-cloud-charts/save-cloud/values-images.yaml b/save-cloud-charts/save-cloud/values-images.yaml new file mode 100644 index 0000000000..e7c1283710 --- /dev/null +++ b/save-cloud-charts/save-cloud/values-images.yaml @@ -0,0 +1,25 @@ +chartVersion: '0.2.1+1056' + +# The version from the "Build and push Docker images" action. +# +# Search the log for the "Successfully built image +# 'ghcr.io/saveourtool/api-gateway:master'" line, or simply +# look up the version of the latest published package at +# . +dockerTag: '0.4.0-alpha.0.379-70423bd' +gateway: + dockerTag: '0.4.0-alpha.0.379-70423bd' +backend: + dockerTag: '0.4.0-alpha.0.379-70423bd' +frontend: + dockerTag: '0.4.0-alpha.0.379-70423bd' +preprocessor: + dockerTag: '0.4.0-alpha.0.379-70423bd' +orchestrator: + dockerTag: '0.4.0-alpha.0.379-70423bd' +sandbox: + dockerTag: '0.4.0-alpha.0.379-70423bd' +demo: + dockerTag: '0.4.0-alpha.0.379-70423bd' +demo_cpg: + dockerTag: '0.4.0-alpha.0.379-70423bd' From 1cd28e05d7b7ac39c51a565f98b49a50f748d3e8 Mon Sep 17 00:00:00 2001 From: acies312 Date: Wed, 20 Dec 2023 13:11:39 +0300 Subject: [PATCH 02/11] properties for internal HIS cluster --- .../main/resources/application-internal.yml | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 api-gateway/src/main/resources/application-internal.yml diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml new file mode 100644 index 0000000000..0533903b3f --- /dev/null +++ b/api-gateway/src/main/resources/application-internal.yml @@ -0,0 +1,52 @@ +gateway: + backend: + url: http://localhost:5800 + frontend: + # In the "dev" environment, the front-end uses TCP port 8080 when run using `webpack-dev-server` (i.e. `browserDevelopmentRun` or `run` Gradle task). + url: http://localhost:8080 + sandbox: + url: http://localhost:5400 + demo: + url: http://localhost:5421 + demo-cpg: + url: http://localhost:5500 +spring: + security: + oauth2: + client: + provider: + codehub: + authorization-uri: https://codehub-g.huawei.com/oauth/authorize + token-uri: https://codehub-g.huawei.com/oauth/token + user-info-uri: https://codehub-g.huawei.com/api/v4/user + user-name-attribute: username + user-info-authentication-method: post + registration: + codehub: + provider: codehub + client-id: qp_f_Xrr5TFpliCyskVbG8mMN-nmAFNc2fo6bPhp1VnU3A0cZD_vNiKIfN61bKox + client-secret: r6h2Qoiks2MvgxKcYe3hAEAr242qgTGqZ5t2iK6QFCwxh6rGTsM4_vt_RSXijvTm + redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}' + authorization-grant-type: authorization_code + client-authentication-method: client_secret_post + # can be + # - openid (doesn't work due to invalid_nonce) + # - email (works but user allowed to not select to share an email) + # - profile + scope: profile + +logging: + level: + org.springframework.web: DEBUG + org.springframework.security: DEBUG + com.nimbusds: TRACE + +--- +spring: + error: + whitelabel: + enabled: false + +server: + error: + path: /error From d6496816560696782cd57b202e5bc62d38105d3e Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Wed, 20 Dec 2023 14:48:44 +0300 Subject: [PATCH 03/11] Update application-internal.yml deleted credentials --- api-gateway/src/main/resources/application-internal.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml index 0533903b3f..65a5fd583e 100644 --- a/api-gateway/src/main/resources/application-internal.yml +++ b/api-gateway/src/main/resources/application-internal.yml @@ -24,8 +24,6 @@ spring: registration: codehub: provider: codehub - client-id: qp_f_Xrr5TFpliCyskVbG8mMN-nmAFNc2fo6bPhp1VnU3A0cZD_vNiKIfN61bKox - client-secret: r6h2Qoiks2MvgxKcYe3hAEAr242qgTGqZ5t2iK6QFCwxh6rGTsM4_vt_RSXijvTm redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}' authorization-grant-type: authorization_code client-authentication-method: client_secret_post From bad2610e6800ec5eb3e4e50fa358c06e336b0546 Mon Sep 17 00:00:00 2001 From: acies312 Date: Wed, 20 Dec 2023 17:03:38 +0300 Subject: [PATCH 04/11] logo for codehub sign in button --- .../save/frontend/common/utils/LoginUtils.kt | 1 + .../src/main/resources/img/codehub.svg | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 save-frontend/src/main/resources/img/codehub.svg diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt index 85222e1701..f8c7b5000f 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt @@ -110,5 +110,6 @@ fun mapKnownUploadedIcons(registrationId: String) = "gitee" -> "/img/gitee.svg" "github" -> "/img/github.svg" "google" -> "/img/google.svg" + "codehub" -> "/img/codehub.svg" else -> "" } diff --git a/save-frontend/src/main/resources/img/codehub.svg b/save-frontend/src/main/resources/img/codehub.svg new file mode 100644 index 0000000000..6153995a75 --- /dev/null +++ b/save-frontend/src/main/resources/img/codehub.svg @@ -0,0 +1,37 @@ + + logo + + + + + + + + + + + + + + + + + + + + + + + + Layer 1 + + + \ No newline at end of file From 2904e775627f52a9997763fffaf3fe21b07972d3 Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:32:31 +0300 Subject: [PATCH 05/11] Update application-internal.yml left only properties that relates to codehub authorization --- .../main/resources/application-internal.yml | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml index 65a5fd583e..ddc6f24411 100644 --- a/api-gateway/src/main/resources/application-internal.yml +++ b/api-gateway/src/main/resources/application-internal.yml @@ -1,15 +1,3 @@ -gateway: - backend: - url: http://localhost:5800 - frontend: - # In the "dev" environment, the front-end uses TCP port 8080 when run using `webpack-dev-server` (i.e. `browserDevelopmentRun` or `run` Gradle task). - url: http://localhost:8080 - sandbox: - url: http://localhost:5400 - demo: - url: http://localhost:5421 - demo-cpg: - url: http://localhost:5500 spring: security: oauth2: @@ -32,19 +20,3 @@ spring: # - email (works but user allowed to not select to share an email) # - profile scope: profile - -logging: - level: - org.springframework.web: DEBUG - org.springframework.security: DEBUG - com.nimbusds: TRACE - ---- -spring: - error: - whitelabel: - enabled: false - -server: - error: - path: /error From 57cf1c65fb9704057da6f3a1a60195918e797023 Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:37:01 +0300 Subject: [PATCH 06/11] codehub icon --- .../src/main/resources/img/codehub.svg | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 save-frontend/src/main/resources/img/codehub.svg diff --git a/save-frontend/src/main/resources/img/codehub.svg b/save-frontend/src/main/resources/img/codehub.svg new file mode 100644 index 0000000000..6153995a75 --- /dev/null +++ b/save-frontend/src/main/resources/img/codehub.svg @@ -0,0 +1,37 @@ + + logo + + + + + + + + + + + + + + + + + + + + + + + + Layer 1 + + + \ No newline at end of file From a8231a35238ea06a9834a2f000fd28324c62b0e1 Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:39:31 +0300 Subject: [PATCH 07/11] codehub logo --- .../com/saveourtool/save/frontend/common/utils/LoginUtils.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt index 85222e1701..f8c7b5000f 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt @@ -110,5 +110,6 @@ fun mapKnownUploadedIcons(registrationId: String) = "gitee" -> "/img/gitee.svg" "github" -> "/img/github.svg" "google" -> "/img/google.svg" + "codehub" -> "/img/codehub.svg" else -> "" } From b8a194b70e205a400723e6502937f3233bfea749 Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Wed, 20 Dec 2023 17:42:06 +0300 Subject: [PATCH 08/11] deleted comments --- api-gateway/src/main/resources/application-internal.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml index ddc6f24411..77a01a5b41 100644 --- a/api-gateway/src/main/resources/application-internal.yml +++ b/api-gateway/src/main/resources/application-internal.yml @@ -15,8 +15,4 @@ spring: redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}' authorization-grant-type: authorization_code client-authentication-method: client_secret_post - # can be - # - openid (doesn't work due to invalid_nonce) - # - email (works but user allowed to not select to share an email) - # - profile scope: profile From 8d92f1ceb73004f4fc3d045c3ec4f9798fd500bb Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:09:49 +0300 Subject: [PATCH 09/11] Update LoginUtils.kt --- .../com/saveourtool/save/frontend/common/utils/LoginUtils.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt index f8c7b5000f..fed93a49e4 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt @@ -93,7 +93,6 @@ private fun ChildrenBuilder.oauthLoginForKnownAwesomeIcons( */ fun mapKnownFontAwesomeIcons(registrationId: String) = when (registrationId) { - "codehub" -> faCopyright else -> faSignInAlt } From ca937571c0e5987bbd016743b786fe097c0e3206 Mon Sep 17 00:00:00 2001 From: acies312 Date: Thu, 21 Dec 2023 13:30:15 +0300 Subject: [PATCH 10/11] deleted unnecessary lines --- .../main/resources/application-internal.yml | 32 +++++++++++++++++++ .../save/frontend/common/utils/LoginUtils.kt | 12 +------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml index 77a01a5b41..65a5fd583e 100644 --- a/api-gateway/src/main/resources/application-internal.yml +++ b/api-gateway/src/main/resources/application-internal.yml @@ -1,3 +1,15 @@ +gateway: + backend: + url: http://localhost:5800 + frontend: + # In the "dev" environment, the front-end uses TCP port 8080 when run using `webpack-dev-server` (i.e. `browserDevelopmentRun` or `run` Gradle task). + url: http://localhost:8080 + sandbox: + url: http://localhost:5400 + demo: + url: http://localhost:5421 + demo-cpg: + url: http://localhost:5500 spring: security: oauth2: @@ -15,4 +27,24 @@ spring: redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}' authorization-grant-type: authorization_code client-authentication-method: client_secret_post + # can be + # - openid (doesn't work due to invalid_nonce) + # - email (works but user allowed to not select to share an email) + # - profile scope: profile + +logging: + level: + org.springframework.web: DEBUG + org.springframework.security: DEBUG + com.nimbusds: TRACE + +--- +spring: + error: + whitelabel: + enabled: false + +server: + error: + path: /error diff --git a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt index fed93a49e4..058ed4c6bc 100644 --- a/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt +++ b/save-frontend-common/src/main/kotlin/com/saveourtool/save/frontend/common/utils/LoginUtils.kt @@ -6,8 +6,6 @@ package com.saveourtool.save.frontend.common.utils -import com.saveourtool.save.frontend.common.externals.fontawesome.* -import com.saveourtool.save.frontend.common.externals.fontawesome.faCopyright import com.saveourtool.save.frontend.common.externals.fontawesome.faSignInAlt import com.saveourtool.save.frontend.common.externals.fontawesome.fontAwesomeIcon import com.saveourtool.save.info.OauthProviderInfo @@ -43,7 +41,7 @@ fun ChildrenBuilder.processRegistrationId( ) = oauthLoginForKnownAwesomeIcons( oauthProvidersFeConfig, mapKnownUploadedIcons(oauthProvidersFeConfig.provider.registrationId), - mapKnownFontAwesomeIcons(oauthProvidersFeConfig.provider.registrationId) + faSignInAlt ) /** @@ -88,14 +86,6 @@ private fun ChildrenBuilder.oauthLoginForKnownAwesomeIcons( } } -/** - * @param registrationId oauth provider name (same as in spring security config) from api-gateway - */ -fun mapKnownFontAwesomeIcons(registrationId: String) = - when (registrationId) { - else -> faSignInAlt - } - /** * Mapping ONLY for those icons that are uploaded to SAVE. * Please note that companies like google strictly prohibits incorrect usage of sign-in buttons: From f6f473e754d63394d8b2e59f309f47468af6e2bb Mon Sep 17 00:00:00 2001 From: acies312 <47986068+acies312@users.noreply.github.com> Date: Thu, 21 Dec 2023 14:36:58 +0300 Subject: [PATCH 11/11] return to correct version of file --- .../main/resources/application-internal.yml | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/api-gateway/src/main/resources/application-internal.yml b/api-gateway/src/main/resources/application-internal.yml index 65a5fd583e..77a01a5b41 100644 --- a/api-gateway/src/main/resources/application-internal.yml +++ b/api-gateway/src/main/resources/application-internal.yml @@ -1,15 +1,3 @@ -gateway: - backend: - url: http://localhost:5800 - frontend: - # In the "dev" environment, the front-end uses TCP port 8080 when run using `webpack-dev-server` (i.e. `browserDevelopmentRun` or `run` Gradle task). - url: http://localhost:8080 - sandbox: - url: http://localhost:5400 - demo: - url: http://localhost:5421 - demo-cpg: - url: http://localhost:5500 spring: security: oauth2: @@ -27,24 +15,4 @@ spring: redirect-uri: '${gateway.frontend.url}/{action}/oauth2/code/{registrationId}' authorization-grant-type: authorization_code client-authentication-method: client_secret_post - # can be - # - openid (doesn't work due to invalid_nonce) - # - email (works but user allowed to not select to share an email) - # - profile scope: profile - -logging: - level: - org.springframework.web: DEBUG - org.springframework.security: DEBUG - com.nimbusds: TRACE - ---- -spring: - error: - whitelabel: - enabled: false - -server: - error: - path: /error