diff --git a/RzGold/README.md b/RzGold/README.md index dcbf677..059f717 100644 --- a/RzGold/README.md +++ b/RzGold/README.md @@ -6,6 +6,25 @@ * Visual Studio Code + * ```json + "configurations": [ + { + "type": "node", + "name": "Launch via NPM", + "request": "launch", + "protocol": "inspector", + "cwd": "${workspaceRoot}", + "runtimeExecutable": "npm", + "runtimeArgs": [ + "run-script", "start" + ], + "outputCapture": "std", + "port": 5858 //inspector default port use to server side debug + }] + ``` + + * + * NodeJS * FortiClient VPN access to connec to dev server @@ -65,4 +84,3 @@ }, ``` - \ No newline at end of file diff --git a/aws/ecs.md b/aws/ecs.md index dbd4780..a4ab494 100644 --- a/aws/ecs.md +++ b/aws/ecs.md @@ -9,4 +9,51 @@ ## Security * AWS WAF -* AWS Shield \ No newline at end of file +* AWS Shield + +## Setup + +1. Create `ECR` to store docker image + * `903306222264.dkr.ecr.ap-southeast-1.amazonaws.com/gold-web-api:develop_v5` + * ![](./images/ecr-images.PNG) +2. Create Jenkins + * To build container image and push to `ECR` + * To generate `taskdefinition.json` from `config/taskdef-develop.json` + * ![](./images/jenkins-ecr-script.PNG) + * ![](./images/jenkins-build.PNG) + * ![](./images/jenkins-deploy.PNG) + * *Note* : After delete the ecs instance, seems like script still execute the `aws ecs update-service ...` instead of `aws ecs create-service ...` +3. Create `Target Group` + * `zgd-tg-ecs-gold-web-api` + * To map host port to container port (443) + * Health Check interval `30s` + * Host port is auto assigned when ECS instance started. Eg. `44212` + * ![](./images/target-group.PNG) +4. Create `CloudWatch` log group + * log group `ZGD-gold-web-api` for ECS instance to log + * *Note* : If log group not created, container will not be able to start. Fail code `500` +5. Create ECS + * Cluster : `zdg-ecs-cluster` + * Spin-Up instance : `gold-web-api` + * Goto `Services` -> `gold-web-api` ->` Tasks`, and select the task to view below + * ![](./images/ECS-running.PNG) +6. Setup ALB (Application Load Balancer) + * `zgd-alb-wan-ecs` + * Add Listener Rules for `HTTPS:443` + * ![](./images/alb-rule.PNG) +7. Setup Route 53 + * Add `webapi.zgold-dev.com` domain name + * ONLY `Daryl Chew` have rights to do this for QA & Dev + * Production need SRE team + +## Troubleshoot + +1. Route 53 : Hostname Creation `webapi.zgold-dev.com` + +2. ALB (Load Balancer) : `zgd-alb-wan-ecs` + +3. Target Group : `zgd-tg-ecs-gold-web-api` + +4. ECS : `gold-web-api` + +5. Cloudwatch : `ZGD-gold-web-api`. \ No newline at end of file diff --git a/aws/images/ECS-running.PNG b/aws/images/ECS-running.PNG new file mode 100644 index 0000000..92e6750 Binary files /dev/null and b/aws/images/ECS-running.PNG differ diff --git a/aws/images/alb-rule.PNG b/aws/images/alb-rule.PNG new file mode 100644 index 0000000..80ca041 Binary files /dev/null and b/aws/images/alb-rule.PNG differ diff --git a/aws/images/ecr-images.PNG b/aws/images/ecr-images.PNG new file mode 100644 index 0000000..b434aa7 Binary files /dev/null and b/aws/images/ecr-images.PNG differ diff --git a/aws/images/jenkins-build.PNG b/aws/images/jenkins-build.PNG new file mode 100644 index 0000000..46ccb56 Binary files /dev/null and b/aws/images/jenkins-build.PNG differ diff --git a/aws/images/jenkins-deploy.PNG b/aws/images/jenkins-deploy.PNG new file mode 100644 index 0000000..c983d77 Binary files /dev/null and b/aws/images/jenkins-deploy.PNG differ diff --git a/aws/images/jenkins-ecr-script.PNG b/aws/images/jenkins-ecr-script.PNG new file mode 100644 index 0000000..3a86b00 Binary files /dev/null and b/aws/images/jenkins-ecr-script.PNG differ diff --git a/aws/images/target-group.PNG b/aws/images/target-group.PNG new file mode 100644 index 0000000..fd3faa3 Binary files /dev/null and b/aws/images/target-group.PNG differ