From b9ff51d9c85f508853657391f361db7cc7c27e4c Mon Sep 17 00:00:00 2001 From: William Putra Intan <61998484+williamputraintan@users.noreply.github.com> Date: Wed, 7 Feb 2024 15:53:49 +1100 Subject: [PATCH] feedback --- README.md | 31 +++++++++++++++--------------- bin/orcabus.ts | 0 cdk.json | 2 +- config/constants.ts | 6 +++--- package.json | 5 ++--- yarn.lock | 46 ++++++++++++++++++++++++++++++++++++--------- 6 files changed, 58 insertions(+), 32 deletions(-) mode change 100644 => 100755 bin/orcabus.ts diff --git a/README.md b/README.md index 8bfc9dfe5..01cf9182b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Please note; this is the _INVERSE_ of some typical standalone project setup such In this repo, we flip this view such that the Git repo root is the TypeScript CDK project; that wraps our applications into `./lib/` directory. You may [sparse checkout](https://git-scm.com/docs/git-sparse-checkout) or directly open subdirectory to set up the application project alone if you wish; e.g. `webstorm lib/workload/stateless/metadata_manager` or `code lib/workload/stateless/metadata_manager` or `pycharm lib/workload/stateless/sequence_run_manager` or `rustrover lib/workload/stateless/filemanager`. However, `code .` is a CDK TypeScript project. -This root level CDK app contains 3 major stacks: `pipeline`, `stateful` and `stateless`. Pipeline stack is the CI/CD automation with CodePipeline setup. The `stateful` stack holds and manages some long-running AWS infrastructure resources. The `stateless` stack manages self-mutating CodePipeline reusable CDK Constructs for the [MicroService Applications](docs/developer/MICROSERVICE.md). In terms of CDK deployment point-of-view, the microservice application will be "stateless" application such that it will be changing/mutating over time; whereas "the data" its holds like PostgreSQL server infrastructure won't be changing that frequent. When updating "stateful" resources, there involves additional cares, steps and ops-procedures such as backing up database, downtime planning and so on; hence stateful. We use [configuration constants](./config) to decouple the reference between `stateful` and `stateless` AWS resources. +This root level CDK app contains 4 major stacks: `stateful-pipeline`,`stateless-pipeline` , `stateful` and `stateless`. Pipeline stack is the CI/CD automation with CodePipeline setup. The `stateful` stack holds and manages some long-running AWS infrastructure resources. The `stateless` stack manages self-mutating CodePipeline reusable CDK Constructs for the [MicroService Applications](docs/developer/MICROSERVICE.md). In terms of CDK deployment point-of-view, the microservice application will be "stateless" application such that it will be changing/mutating over time; whereas "the data" its holds like PostgreSQL server infrastructure won't be changing that frequent. When updating "stateful" resources, there involves additional cares, steps and ops-procedures such as backing up database, downtime planning and so on; hence stateful. We use [configuration constants](./config) to decouple the reference between `stateful` and `stateless` AWS resources. In most cases, we deploy with automation across operational target environments or AWS accounts: `beta`, `gamma`, `prod`. For some particular purpose (such as onboarding procedure, isolated experimentation), we can spin up the whole infrastructure into some unique isolated AWS account. These key CDK entrypoints are documented in the following sections: Automation and Manual. @@ -18,20 +18,19 @@ In most cases, we deploy with automation across operational target environments _CI/CD through CodePipeline automation from AWS toolchain account_ +There are 2 pipeline stacks in this project, one for the stateful and one for the stateless stack deployment. There is a +script to access the `cdk` command for each pipeline: +-`cdk-stateless-pipeline` - for stateless pipeline +-`cdk-stateful-pipeline` - for stateful pipeline + ``` make install make check make test -yarn cdk list - -yarn cdk synth -yarn cdk diff -yarn cdk deploy - -yarn cdk synth -yarn cdk diff -yarn cdk deploy --all +yarn cdk-stateless-pipeline synth +yarn cdk-stateless-pipeline diff +yarn cdk-stateless-pipeline deploy ``` ### Manual @@ -47,12 +46,12 @@ make test yarn orcabus --help -yarn orcabus list -yarn orcabus synth OrcaBusStatefulStack -yarn orcabus diff OrcaBusStatefulStack -yarn orcabus deploy OrcaBusStatefulStack -yarn orcabus deploy --all -yarn orcabus destroy --all +yarn cdk-orcabus list +yarn cdk-orcabus synth OrcaBusStatefulStack +yarn cdk-orcabus diff OrcaBusStatefulStack +yarn cdk-orcabus deploy OrcaBusStatefulStack +yarn cdk-orcabus deploy --all +yarn cdk-orcabus destroy --all ``` ## Development diff --git a/bin/orcabus.ts b/bin/orcabus.ts old mode 100644 new mode 100755 diff --git a/cdk.json b/cdk.json index faf5362ca..d38614e06 100644 --- a/cdk.json +++ b/cdk.json @@ -1,5 +1,5 @@ { - "app": "yarn run ts-node --prefer-ts-exts bin/orcabus.ts", + "app": "yarn run -B ts-node --prefer-ts-exts bin/orcabus.ts", "watch": { "include": [ "**" diff --git a/config/constants.ts b/config/constants.ts index 294254d2d..b1dd3398c 100644 --- a/config/constants.ts +++ b/config/constants.ts @@ -91,7 +91,7 @@ export const getEnvironmentConfig = ( ...orcaBusStatefulConfig.databaseProps, numberOfInstance: 1, minACU: 0.5, - maxACU: 1, + maxACU: 16, enhancedMonitoringInterval: Duration.seconds(60), enablePerformanceInsights: true, removalPolicy: RemovalPolicy.DESTROY, @@ -121,7 +121,7 @@ export const getEnvironmentConfig = ( ...orcaBusStatefulConfig.databaseProps, numberOfInstance: 1, minACU: 0.5, - maxACU: 1, + maxACU: 16, enhancedMonitoringInterval: Duration.seconds(60), enablePerformanceInsights: true, removalPolicy: RemovalPolicy.DESTROY, @@ -151,7 +151,7 @@ export const getEnvironmentConfig = ( ...orcaBusStatefulConfig.databaseProps, numberOfInstance: 1, minACU: 0.5, - maxACU: 1, + maxACU: 16, removalPolicy: RemovalPolicy.RETAIN, }, securityGroupProps: { diff --git a/package.json b/package.json index 2eccfb29e..644197e23 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "type": "git" }, "license": "MIT", - "bin": "bin/pipeline.js", "scripts": { "test": "tsc && jest", "build": "cdk synth -q", @@ -29,7 +28,7 @@ "@aws-cdk/aws-apigatewayv2-authorizers-alpha": "^2.110.0-alpha.0", "@aws-cdk/aws-apigatewayv2-integrations-alpha": "^2.110.0-alpha.0", "@aws-cdk/aws-lambda-python-alpha": "2.110.0-alpha.0", - "aws-cdk-lib": "^2.110.0", + "aws-cdk-lib": "^2.126.0", "cdk-nag": "^2.28.27", "constructs": "^10.2.69", "dotenv": "^16.3.1", @@ -41,7 +40,7 @@ "@types/node": "^20.4.0", "@typescript-eslint/eslint-plugin": "^6.19.1", "@typescript-eslint/parser": "^6.19.1", - "aws-cdk": "2.110.0", + "aws-cdk": "^2.126.0", "eslint": "^8.44.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-prettier": "^5.1.3", diff --git a/yarn.lock b/yarn.lock index 35f2a707f..d4757c4b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29,6 +29,13 @@ __metadata: languageName: node linkType: hard +"@aws-cdk/asset-awscli-v1@npm:^2.2.202": + version: 2.2.202 + resolution: "@aws-cdk/asset-awscli-v1@npm:2.2.202" + checksum: 40a536008f1de5587ab0b1d7018942c048888c43b145ac10b030e841ab017839a02ad102daac3a29ae4b2242007b2dea499195b4807dc90944973b107427108b + languageName: node + linkType: hard + "@aws-cdk/asset-kubectl-v20@npm:^2.1.2": version: 2.1.2 resolution: "@aws-cdk/asset-kubectl-v20@npm:2.1.2" @@ -1484,7 +1491,7 @@ __metadata: languageName: node linkType: hard -"aws-cdk-lib@npm:^2.*, aws-cdk-lib@npm:^2.110.0": +"aws-cdk-lib@npm:^2.*": version: 2.115.0 resolution: "aws-cdk-lib@npm:2.115.0" dependencies: @@ -1507,9 +1514,32 @@ __metadata: languageName: node linkType: hard -"aws-cdk@npm:2.110.0": - version: 2.110.0 - resolution: "aws-cdk@npm:2.110.0" +"aws-cdk-lib@npm:^2.126.0": + version: 2.126.0 + resolution: "aws-cdk-lib@npm:2.126.0" + dependencies: + "@aws-cdk/asset-awscli-v1": ^2.2.202 + "@aws-cdk/asset-kubectl-v20": ^2.1.2 + "@aws-cdk/asset-node-proxy-agent-v6": ^2.0.1 + "@balena/dockerignore": ^1.0.2 + case: 1.6.3 + fs-extra: ^11.2.0 + ignore: ^5.3.0 + jsonschema: ^1.4.1 + minimatch: ^3.1.2 + punycode: ^2.3.1 + semver: ^7.5.4 + table: ^6.8.1 + yaml: 1.10.2 + peerDependencies: + constructs: ^10.0.0 + checksum: 62d46d108fba4ef2c76e7c46767bddfe7019b2f96ad1bfb1b8ae348eeefb889dc6314b56fa5da16c299477ebc1463354de93df45a0ca72cc4d6faee5a0eb9656 + languageName: node + linkType: hard + +"aws-cdk@npm:^2.126.0": + version: 2.126.0 + resolution: "aws-cdk@npm:2.126.0" dependencies: fsevents: 2.3.2 dependenciesMeta: @@ -1517,7 +1547,7 @@ __metadata: optional: true bin: cdk: bin/cdk - checksum: 69ea8ca2d764a00c7b52889f55ad611655298a49c00cbdd3f976e94fd375c9d48c0e646b24c243555af5ac9e68437f078a9a3c08d3ffa96908d90e2a76845eb6 + checksum: 93c82ccb949059ef07e88a2952df7fe025dc60a8d3e687c26497660de5ac2433bf719f0dbff415fa41eef2c1a64caf37a77110d3d2a4c6de9f122dcd1f293506 languageName: node linkType: hard @@ -3977,8 +4007,8 @@ __metadata: "@types/node": ^20.4.0 "@typescript-eslint/eslint-plugin": ^6.19.1 "@typescript-eslint/parser": ^6.19.1 - aws-cdk: 2.110.0 - aws-cdk-lib: ^2.110.0 + aws-cdk: ^2.126.0 + aws-cdk-lib: ^2.126.0 cdk-nag: ^2.28.27 constructs: ^10.2.69 dotenv: ^16.3.1 @@ -3993,8 +4023,6 @@ __metadata: ts-jest: ^29.1.1 ts-node: ^10.9.1 typescript: ^5.1.6 - bin: - orcabus: bin/pipeline.js languageName: unknown linkType: soft