Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
williamputraintan committed Feb 7, 2024
1 parent 2458410 commit b9ff51d
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 32 deletions.
31 changes: 15 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,27 @@ 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.

### Automation

_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 <StackName>
yarn cdk diff <StackName>
yarn cdk deploy <StackName>
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
Expand All @@ -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
Expand Down
Empty file modified bin/orcabus.ts
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion cdk.json
Original file line number Diff line number Diff line change
@@ -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": [
"**"
Expand Down
6 changes: 3 additions & 3 deletions config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -151,7 +151,7 @@ export const getEnvironmentConfig = (
...orcaBusStatefulConfig.databaseProps,
numberOfInstance: 1,
minACU: 0.5,
maxACU: 1,
maxACU: 16,
removalPolicy: RemovalPolicy.RETAIN,
},
securityGroupProps: {
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"type": "git"
},
"license": "MIT",
"bin": "bin/pipeline.js",
"scripts": {
"test": "tsc && jest",
"build": "cdk synth -q",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
46 changes: 37 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -1507,17 +1514,40 @@ __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:
fsevents:
optional: true
bin:
cdk: bin/cdk
checksum: 69ea8ca2d764a00c7b52889f55ad611655298a49c00cbdd3f976e94fd375c9d48c0e646b24c243555af5ac9e68437f078a9a3c08d3ffa96908d90e2a76845eb6
checksum: 93c82ccb949059ef07e88a2952df7fe025dc60a8d3e687c26497660de5ac2433bf719f0dbff415fa41eef2c1a64caf37a77110d3d2a4c6de9f122dcd1f293506
languageName: node
linkType: hard

Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit b9ff51d

Please sign in to comment.