Stateful resources are defined with Terraform, so in order to create/change the resources follow the steps below.
REQUIREMENTS:
-
In order to fully create the infrastructure in AWS it's required to setup this project within an Organization in GitHub, as Terraform has a limitation to setup a WebHook in a personal project, see more here
-
It's required to create a Personal Access Token in GitHub in order to use the environment variable
repositoryAccessToken
in Terraform configurations. See more here
- Create
terraform.tfvars
file and update it based on your needs:
$ cd infrastructure && \
cp terraform.tfvars.dist terraform.tfvars
- Create resources:
$ terraform validate && \
terraform init && \
terraform apply
-
Stateful resources created:
- AWS Code Pipeline (with a GitHub WebHook)
- AWS Code Build
- AWS Dynamo DB
- AWS Kinesis Data Stream
- AWS SNS
After running the Terraform command above, the CI/CD will be ready.
With the CI/CD in place, all pushes to master
will be
automatically deployed.
- Installing dependencies:
$ npm i
- Copy
.env.dist
file and edit them based on your needs:
$ cp .env.dist .env
- Running seeders:
Obs.: The stateful resources must be created BEFORE running this seed command
Obs.1: This command must be executed only once
$ npm run seed
-
Download
workspace.xml
file in theide-configs
directory -
Copy and paste it to
{{PROJECT_ROOT}}/.idea
(or update your.idea/workspace.xml
file) -
Restart IDE
-
Check debugger configurations
- Check style:
$ npm run checkStyle
- Fix style:
$ npm run fixStyle
- Run tests:
$ npm test
- Run tests with Debugger (port 9300):
$ npm run testDebugger
- Deploying:
** Unnecessary, unless willing to deploy without pushing the code to master
$ chmod +x ./build.sh && \
./build.sh deploy dev
- Run a function locally:
$ FUNCTION_NAME=get-categories npm run invokeFunction
- After having a Web APP for the application, setup AWS Cognito
- Change Cloudwatch logs to ELK
- Add X-Ray
- Check functions permissions