From bf3c57036ca29fdb4ce360b8616ed3345829227f Mon Sep 17 00:00:00 2001 From: Priom Chowdhury Date: Wed, 26 Oct 2022 10:33:48 -0400 Subject: [PATCH] feat: ECS task deployment config file added (#217) * new ci/cd setup; repo cleanup & refactor * refactor * license added * merged main; changed depandabot check to weekly * added ecs task config file * fix: release action cleanup --- .github/workflows/release.yml | 33 +------ infra/aws-ecs/nodewatch-prod-task-def.json | 102 +++++++++++++++++++++ 2 files changed, 103 insertions(+), 32 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1553882..11fc62b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,35 +15,4 @@ jobs: id: release with: release-type: go - - name: Checkout code - uses: actions/checkout@v3 - if: ${{ steps.release.outputs.release_created }} - - uses: kciter/aws-ecr-action@v4 - with: - access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} - secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - account_id: ${{ secrets.AWS_ACCOUNT_ID }} - region: ${{ secrets.PROD_AWS_REGION }} - repo: ${{ secrets.PROD_ECR_REPOSITORY }} - tags: ${{ steps.release.outputs.tag_name }} - create_repo: false - if: ${{ steps.release.outputs.release_created }} - - run: 'echo "$PROD_HELM_VALUES" > helm/values.yaml' - shell: bash - env: - PROD_HELM_VALUES: ${{secrets.PROD_HELM_VALUES}} - if: ${{ steps.release.outputs.release_created }} - - name: AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ secrets.PROD_AWS_REGION }} - if: ${{ steps.release.outputs.release_created }} - - name: helm deploy - uses: koslib/helm-eks-action@master - env: - KUBE_CONFIG_DATA: ${{ secrets.PROD_KUBE_CONFIG_DATA }} - with: - command: helm upgrade --install --create-namespace --namespace ${{ secrets.PROD_KUBE_NAMESPACE }} --set image.tag=${{ steps.release.outputs.tag_name }} -f helm/values.yaml crawler helm/crawler - if: ${{ steps.release.outputs.release_created }} \ No newline at end of file + diff --git a/infra/aws-ecs/nodewatch-prod-task-def.json b/infra/aws-ecs/nodewatch-prod-task-def.json index e69de29..c535c43 100644 --- a/infra/aws-ecs/nodewatch-prod-task-def.json +++ b/infra/aws-ecs/nodewatch-prod-task-def.json @@ -0,0 +1,102 @@ +{ + "taskDefinitionArn": "arn:aws:ecs:us-east-2:381177214925:task-definition/nodewatch-prod-task:4", + "containerDefinitions": [ + { + "name": "nodewatch-prod-container", + "image": "381177214925.dkr.ecr.us-east-2.amazonaws.com/nodewatch-prod-ecr:v1.3.1", + "cpu": 256, + "portMappings": [ + { + "containerPort": 8080, + "hostPort": 8080, + "protocol": "tcp" + } + ], + "essential": true, + "environment": [ + { + "name": "env", + "value": "prod" + } + ], + "mountPoints": [], + "volumesFrom": [], + "secrets": [ + { + "name": "MONGODB_URI", + "valueFrom": "arn:aws:secretsmanager:us-east-2:381177214925:secret:nodewatch-prod-8FCCGw:MONGODB_URI::" + }, + { + "name": "RESOLVER_API_KEY", + "valueFrom": "arn:aws:secretsmanager:us-east-2:381177214925:secret:nodewatch-prod-8FCCGw:RESOLVER_API_KEY::" + } + ], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-group": "nodewatch-prod-logs", + "awslogs-region": "us-east-2", + "awslogs-stream-prefix": "ecs" + } + } + } + ], + "family": "nodewatch-prod-task", + "executionRoleArn": "arn:aws:iam::381177214925:role/nodewatch-prod-role", + "networkMode": "awsvpc", + "revision": 4, + "volumes": [], + "status": "ACTIVE", + "requiresAttributes": [ + { + "name": "com.amazonaws.ecs.capability.logging-driver.awslogs" + }, + { + "name": "ecs.capability.execution-role-awslogs" + }, + { + "name": "com.amazonaws.ecs.capability.ecr-auth" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.19" + }, + { + "name": "ecs.capability.secrets.asm.environment-variables" + }, + { + "name": "ecs.capability.execution-role-ecr-pull" + }, + { + "name": "com.amazonaws.ecs.capability.docker-remote-api.1.18" + }, + { + "name": "ecs.capability.task-eni" + } + ], + "placementConstraints": [], + "compatibilities": [ + "EC2", + "FARGATE" + ], + "requiresCompatibilities": [ + "FARGATE" + ], + "cpu": "256", + "memory": "512", + "registeredAt": "2022-04-27T15:23:12.288Z", + "registeredBy": "arn:aws:sts::381177214925:assumed-role/AWSReservedSSO_AWSAdministratorAccess_8acb862b989cc854/faith@chainsafe.io", + "tags": [ + { + "key": "Terraform", + "value": "true" + }, + { + "key": "Env", + "value": "PROD" + }, + { + "key": "Project", + "value": "Nodewatch" + } + ] +} \ No newline at end of file