diff --git a/.github/workflows/deploy-api.yml b/.github/workflows/deploy-api.yml index d3027c34..337f0645 100644 --- a/.github/workflows/deploy-api.yml +++ b/.github/workflows/deploy-api.yml @@ -13,14 +13,7 @@ on: permissions: id-token: write contents: read -env: - ECR_REPOSITORY: development-identity - AWS_ROLE_ARN: arn:aws:iam::665230337498:role/development-identity-github-actions - AWS_REGION: us-west-2 - ECS_SERVICE: development-identity-service - ECS_CLUSTER: development-identity-cluster - ENVIRONMENT: development - + jobs: deploy: runs-on: ubuntu-latest @@ -31,15 +24,15 @@ jobs: - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v4 with: - role-to-assume: ${{ env.AWS_ROLE_ARN }} - aws-region: ${{ env.AWS_REGION }} + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + aws-region: ${{ vars.AWS_REGION }} - name: Log in to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v2 - name: Build, tag, and push image to Amazon ECR id: build-image env: - IMAGE_TAG: ${{ steps.login-ecr.outputs.registry }}/${{ env.ECR_REPOSITORY }}:${{ github.sha }} + IMAGE_TAG: ${{ steps.login-ecr.outputs.registry }}/${{ vars.ECR_REPOSITORY }}:${{ github.sha }} run: | docker build -t $IMAGE_TAG -f ./apps/api/Dockerfile . docker push $IMAGE_TAG @@ -48,15 +41,17 @@ jobs: id: task-def uses: aws-actions/amazon-ecs-render-task-definition@v1 with: - task-definition: ./apps/api/.aws/task-definition-${{ env.ENVIRONMENT }}.json + task-definition: ./apps/api/.aws/task-definition-${{ vars.ENVIRONMENT }}.json container-name: development-identity image: ${{ steps.build-image.outputs.image }} environment-variables: | - AWS_REGION=${{ env.AWS_REGION }} + AWS_REGION=${{ vars.AWS_REGION }} + API_ENV_SECRET_NAME=${{ vars.API_ENV_SECRET_NAME }} + DATABASE_SECRET_NAME=${{ vars.DATABASE_SECRET_NAME }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@v1 with: task-definition: ${{ steps.task-def.outputs.task-definition }} - service: ${{ env.ECS_SERVICE }} - cluster: ${{ env.ECS_CLUSTER }} - wait-for-service-stability: true + service: ${{ vars.ECS_SERVICE }} + cluster: ${{ vars.ECS_CLUSTER }} + wait-for-service-stability: true \ No newline at end of file diff --git a/apps/api/.aws/task-definition-development.json b/apps/api/.aws/task-definition-development.json index b266c9ec..fe85d497 100644 --- a/apps/api/.aws/task-definition-development.json +++ b/apps/api/.aws/task-definition-development.json @@ -15,20 +15,7 @@ } ], "essential": true, - "environment": [ - { - "name": "AWS_REGION", - "value": "us-west-2" - }, - { - "name": "API_ENV_SECRET_NAME", - "value": "tdkApiEnv" - }, - { - "name": "DATABASE_SECRET_NAME", - "value": "development-identity-db" - } - ], + "environment": [], "mountPoints": [], "volumesFrom": [], "linuxParameters": { @@ -63,12 +50,7 @@ "executionRoleArn": "arn:aws:iam::665230337498:role/development-identity-service-20240515023426696600000003", "networkMode": "awsvpc", "volumes": [], - "status": "ACTIVE", "placementConstraints": [], - "compatibilities": [ - "EC2", - "FARGATE" - ], "runtimePlatform": { "cpuArchitecture": "X86_64", "operatingSystemFamily": "LINUX" diff --git a/apps/api/.aws/task-definition-development.json~ b/apps/api/.aws/task-definition-development.json~ deleted file mode 100644 index 0d9ab44e..00000000 --- a/apps/api/.aws/task-definition-development.json~ +++ /dev/null @@ -1,51 +0,0 @@ -{ - "containerDefinitions": [ - { - "name": "development-identity", - "image": "", - "cpu": 0, - "links": [], - "portMappings": [ - { - "containerPort": 8080, - "hostPort": 8080, - "protocol": "tcp" - } - ], - "essential": true, - "entryPoint": [], - "command": [], - "environment": [], - "environmentFiles": [], - "mountPoints": [], - "volumesFrom": [], - "secrets": [], - "dnsServers": [], - "dnsSearchDomains": [], - "extraHosts": [], - "dockerSecurityOptions": [], - "dockerLabels": {}, - "ulimits": [], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-group": "noumena-dev-tdk-api-app-noumenadevtdkapiappalbfargateTaskDefwebLogGroup3CC09CBD-4zhnGNgxGkHR", - "awslogs-region": "us-west-2", - "awslogs-stream-prefix": "noumena-dev-tdk-api-app-alb-fargate" - }, - "secretOptions": [] - }, - "systemControls": [] - } - ], - "family": "noumenadevtdkapiappnoumenadevtdkapiappalbfargateTaskDef464DDCB3", - "taskRoleArn": "arn:aws:iam::665230337498:role/noumena-dev-tdk-api-app-noumenadevtdkapiappecstaskA-V7mWratZrTpj", - "executionRoleArn": "arn:aws:iam::665230337498:role/noumena-dev-tdk-api-app-noumenadevtdkapiappalbfarga-Z2BwGG5MYmpp", - "networkMode": "awsvpc", - "volumes": [], - "placementConstraints": [], - "requiresCompatibilities": ["FARGATE"], - "cpu": "512", - "memory": "2048", - "tags": [] -}