From de2c83cb81a453d61bf4333281ab35cfac3b0bc5 Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Tue, 5 Nov 2024 20:16:59 +0300 Subject: [PATCH 1/6] fix: failing "suite generate > repo" --- .suite-cli/cli/scripts/scripts.module.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.suite-cli/cli/scripts/scripts.module.js b/.suite-cli/cli/scripts/scripts.module.js index 9a8ccf2..19c9a4c 100644 --- a/.suite-cli/cli/scripts/scripts.module.js +++ b/.suite-cli/cli/scripts/scripts.module.js @@ -1027,13 +1027,8 @@ const addMicroservice = ({ project_root, answers }) => { writeFile(join(current_dir, 'appollo-server.js'), assets.apolloServerContent({ answers })); break; case `k8s/${answers.service_name}`: - // TODO: move k8s into a function - writeFile(join(current_dir, 'client-node-port.yaml'), assets.k8sClientNodeContent()); - writeFile(join(current_dir, 'client-pod.yaml'), assets.k8sClientPodContent()); - writeFile(join(current_dir, 'cluster-deployment.yml'), assets.k8sClusterDeploymentContent()); + // TODO: move k8s into a function writeFile(join(current_dir, 'README.md'), assets.k8sReadmeContent({ answers })); - writeFile(join(current_dir, 'cluster-ip-service.yml'), assets.k8sClusterIpServiceContent()); - writeFile(join(current_dir, 'ingress-service.yml'), assets.k8sIngressServiceContent()); break; } }); @@ -1076,6 +1071,7 @@ const scaffoldNewRepo = async ({ answers }) => { addProjectConfigs({ project_root: join(cwd(), answers.repo_name), answers }) addMicroservice({ project_root: join(cwd(), answers.repo_name), answers }) addPackageJson({ project_root: join(cwd(), answers.repo_name), answers }) + return } else { From 437df6d1ac462e5395144f3141bb0511e914f5e5 Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Tue, 5 Nov 2024 20:17:48 +0300 Subject: [PATCH 2/6] fix: failing "suite generate > repo" --- .suite-cli/cli/scripts/assets/fileStructureContent.asset.js | 2 +- .suite-cli/cli/scripts/scripts.module.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.suite-cli/cli/scripts/assets/fileStructureContent.asset.js b/.suite-cli/cli/scripts/assets/fileStructureContent.asset.js index 827fe8b..87bfe13 100644 --- a/.suite-cli/cli/scripts/assets/fileStructureContent.asset.js +++ b/.suite-cli/cli/scripts/assets/fileStructureContent.asset.js @@ -10,7 +10,7 @@ module.exports = ({ answers }) => ( `tests/${answers.service_name}/unit`, `tests/${answers.service_name}/snapshot`, `microservices`, - `k8s/${answers.service_name}`, + `k8s`, `docker/apps`, ...(answers.apis.map((api) => `${api}/app1`)), ] diff --git a/.suite-cli/cli/scripts/scripts.module.js b/.suite-cli/cli/scripts/scripts.module.js index 19c9a4c..c6c0308 100644 --- a/.suite-cli/cli/scripts/scripts.module.js +++ b/.suite-cli/cli/scripts/scripts.module.js @@ -1026,7 +1026,7 @@ const addMicroservice = ({ project_root, answers }) => { case `GraphQL/app1`: writeFile(join(current_dir, 'appollo-server.js'), assets.apolloServerContent({ answers })); break; - case `k8s/${answers.service_name}`: + case `k8s`: // TODO: move k8s into a function writeFile(join(current_dir, 'README.md'), assets.k8sReadmeContent({ answers })); break; From 787a88f6f05d5825e0c76fc417bd9f27e8efca8f Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Tue, 5 Nov 2024 20:18:21 +0300 Subject: [PATCH 3/6] Revert "fix: failing "suite generate > repo"" This reverts commit de2c83cb81a453d61bf4333281ab35cfac3b0bc5. --- .suite-cli/cli/scripts/scripts.module.js | 1 - 1 file changed, 1 deletion(-) diff --git a/.suite-cli/cli/scripts/scripts.module.js b/.suite-cli/cli/scripts/scripts.module.js index c6c0308..4c45e12 100644 --- a/.suite-cli/cli/scripts/scripts.module.js +++ b/.suite-cli/cli/scripts/scripts.module.js @@ -1071,7 +1071,6 @@ const scaffoldNewRepo = async ({ answers }) => { addProjectConfigs({ project_root: join(cwd(), answers.repo_name), answers }) addMicroservice({ project_root: join(cwd(), answers.repo_name), answers }) addPackageJson({ project_root: join(cwd(), answers.repo_name), answers }) - return } else { From bf7ef6ecaf846f05c57d3d212bf9f3698134e26e Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Tue, 5 Nov 2024 20:21:27 +0300 Subject: [PATCH 4/6] Revert "Revert "fix: failing "suite generate > repo""" This reverts commit 787a88f6f05d5825e0c76fc417bd9f27e8efca8f. --- .suite-cli/cli/scripts/scripts.module.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.suite-cli/cli/scripts/scripts.module.js b/.suite-cli/cli/scripts/scripts.module.js index 4c45e12..c6c0308 100644 --- a/.suite-cli/cli/scripts/scripts.module.js +++ b/.suite-cli/cli/scripts/scripts.module.js @@ -1071,6 +1071,7 @@ const scaffoldNewRepo = async ({ answers }) => { addProjectConfigs({ project_root: join(cwd(), answers.repo_name), answers }) addMicroservice({ project_root: join(cwd(), answers.repo_name), answers }) addPackageJson({ project_root: join(cwd(), answers.repo_name), answers }) + return } else { From cbb490af7c2f8a3d9066b0a97b601c9bb4fea9c6 Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Tue, 5 Nov 2024 22:17:01 +0300 Subject: [PATCH 5/6] chore: release v3.1.1 --- .suite-cli/cli/package.json | 2 +- istio/virtual-service.yaml | 24 +++++++++++++++ mysq.yaml | 60 +++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 istio/virtual-service.yaml create mode 100644 mysq.yaml diff --git a/.suite-cli/cli/package.json b/.suite-cli/cli/package.json index d24050a..a559e7c 100644 --- a/.suite-cli/cli/package.json +++ b/.suite-cli/cli/package.json @@ -1,6 +1,6 @@ { "name": "@microservices-suite/cli", - "version": "3.1.0", + "version": "3.1.1", "description": "This is the CLI tool for running the microservices-suite monorepo. It contains functionalities and tools required for automation and managing the repo across supported platforms. Works on Windows,MacOS and Linux as well as support to some extend other variants like SunOS, IBM AIX, FreeBSD, OpenBSD and more", "main": "cli.js", "repository": "https://github.com/microservices-suite/node-microservices-suite.git", diff --git a/istio/virtual-service.yaml b/istio/virtual-service.yaml new file mode 100644 index 0000000..844c209 --- /dev/null +++ b/istio/virtual-service.yaml @@ -0,0 +1,24 @@ +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: api-vs +spec: + hosts: + - api.cloudacademy.35.88.67.205.nip.io + gateways: + - api-gateway + http: + - route: + - destination: + host: api.default.svc.cluster.local + subset: v1 + port: + number: 80 + weight: 25 + - destination: + host: api.default.svc.cluster.local + subset: v2 + port: + number: 80 + weight: 75 + diff --git a/mysq.yaml b/mysq.yaml new file mode 100644 index 0000000..8e3eedc --- /dev/null +++ b/mysq.yaml @@ -0,0 +1,60 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: mysql-config + labels: + app: mysql +data: + MYSQL_ROOT_PASSWORD: "CloudAcademy!" + MYSQL_PASSWORD: "CloudAcademy!" + MYSQL_USER: "api_user" + MYSQL_DATABASE: "orders" +--- +apiVersion: v1 +kind: Service +metadata: + name: mysql + labels: + app: mysql +spec: + ports: + - port: 3306 + name: mysql + clusterIP: None + selector: + app: mysql +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: mysql +spec: + selector: + matchLabels: + app: mysql + serviceName: "mysql" + replicas: 1 + template: + metadata: + labels: + app: mysql + spec: + terminationGracePeriodSeconds: 10 + containers: + - name: mysql + image: public.ecr.aws/cloudacademy-labs/cloudacademy/labs/k8s-assessment/mysql:8 + ports: + - containerPort: 3306 + name: mysql + volumeMounts: + - name: mysql + mountPath: /var/lib/mysql + envFrom: + - configMapRef: + name: mysql-config + volumes: + - name: mysql + hostPath: + path: /tmp/mysql/ + type: Directory From 720c64750b65e133e99b4618f77277b33dc1a098 Mon Sep 17 00:00:00 2001 From: Gilbert Andanje Date: Thu, 7 Nov 2024 00:08:07 +0300 Subject: [PATCH 6/6] fix: utility version not found --- .../cli/scripts/assets/genericPackageJsonContent.asset.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.suite-cli/cli/scripts/assets/genericPackageJsonContent.asset.js b/.suite-cli/cli/scripts/assets/genericPackageJsonContent.asset.js index 6cd76ee..3833e0a 100644 --- a/.suite-cli/cli/scripts/assets/genericPackageJsonContent.asset.js +++ b/.suite-cli/cli/scripts/assets/genericPackageJsonContent.asset.js @@ -9,7 +9,7 @@ module.exports = ({ answers, suffix, isMicroservice, description, os, addDeps }) dependencies: { [`${answers.project_base}/config`]: "1.0.0", [`${answers.project_base}/errors`]: "1.0.0", - [`${answers.project_base}/utilities`]: "1.0.7", + [`${answers.project_base}/utilities`]: "1.0.0", [`${answers.project_base}/broker`]: "1.0.0", dotenv: "^16.4.5", express: "^4.18.3",