This is microservices boilerplate for monorepo with CDK and Rush.
- CDK is used for producing CloudFormation output and microservice deployments
- Rush.js is used for managing dependencies and compiling multiple business service repos
$git clone https://github.com/hanhdt/ts-microservices-rush-boilerplate.git
- see PREPARE.md
First of all, AWS Account and IAM User is required. IAM user's credential keys also are required.
To execute this template codes, the following modules must be installed.
-
AWS CLI: aws --version
-
Node.js: node --version
-
AWS CDK: cdk --version
-
Rush: rush --version
Because we need to ensure that a single source code is maintained, all configurations are managed in config/app-config-[your-suffix].json. And several files are made according to the environment you want to deploy to, and you have to choose one of them when deploying.
For example, if you want to deploy to dev environment, you have to create config/app-config-dev.json
- reference to config/app-config-sample.json
Execute the following command:
$./script/initial_setup.sh config/app-config-dev.json
To create new service repository, do the following step:
-
Change
App
to your newservice-folder
name inconfig/app-config-[environment].json
-
Execute the following command:
$./script/create_new_service.sh config/app-config-dev.json <service-folder>
-
Rename
@hanhdt/sample-service
inpackage.json
to your newservice-name
To deploy stacks, run the following commands:
$./script/deploy_stacks.sh config/app-config-dev.json
Read more details about adding Rush configuration at script/README.md
- see source/package/services/sample-service/README.md
$cd source/packages/services/<appName>
$cdk deploy --no-previous-parameters -c config=dev
The .env
file will be placed at the service folder.
And it is scoped to the service.
You can put .env
file in the source/packages/services/<ServiceName>/config
folder.
$cd source/packages/services/<ServiceName>/config
$touch .env