diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 844b6624..c5fcf5b9 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -2,7 +2,6 @@ name: Server CI env: AWS_REGION: il-central-1 - ECS_TASK_DEFINITION: server/.aws/task-definition.json ECR_REPOSITORY: 072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server on: push: @@ -105,7 +104,7 @@ jobs: id: task-def uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc with: - task-definition: ${{ env.ECS_TASK_DEFINITION }} + task-definition: server/.aws/staging-task-definition.json container-name: ${{ vars.CONTAINER_NAME }} image: "072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server:${{github.sha}}" environment-variables: | @@ -130,7 +129,7 @@ jobs: - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a with: - task-definition: ${{ steps.task-def.outputs.task-definition }} + task-definition: server/.aws/production-task-definition.json service: ${{ vars.ECS_SERVICE }} cluster: ${{ vars.ECS_CLUSTER }} wait-for-service-stability: true diff --git a/server/.aws/production-task-definition.json b/server/.aws/production-task-definition.json new file mode 100644 index 00000000..1f04a493 --- /dev/null +++ b/server/.aws/production-task-definition.json @@ -0,0 +1,47 @@ +{ + "family": "staging-meirim-server", + "containerDefinitions": [ + { + "name": "meirim", + "image": "072085314121.dkr.ecr.il-central-1.amazonaws.com/meirim-server:latest", + "healthCheck": { + "command": ["curl" ,"-f" ,"http://localhost:80/health"] + }, + "cpu": 0, + "portMappings": [ + { + "containerPort": 80, + "hostPort": 80, + "protocol": "tcp" + } + ], + "essential": true, + "environment": [], + "environmentFiles": [], + "mountPoints": [], + "volumesFrom": [], + "ulimits": [], + "logConfiguration": { + "logDriver": "awslogs", + "options": { + "awslogs-create-group": "true", + "awslogs-group": "/ecs/meirim-server", + "awslogs-region": "il-central-1", + "awslogs-stream-prefix": "ecs" + }, + "secretOptions": [] + } + } + ], + "executionRoleArn": "arn:aws:iam::072085314121:role/ecsTaskExecutionRole", + "networkMode": "awsvpc", + "requiresCompatibilities": [ + "FARGATE" + ], + "cpu": "1024", + "memory": "1024", + "runtimePlatform": { + "cpuArchitecture": "X86_64", + "operatingSystemFamily": "LINUX" + } +} \ No newline at end of file diff --git a/server/.aws/task-definition.json b/server/.aws/staging-task-definition.json similarity index 97% rename from server/.aws/task-definition.json rename to server/.aws/staging-task-definition.json index caf9dfd4..9a04c579 100644 --- a/server/.aws/task-definition.json +++ b/server/.aws/staging-task-definition.json @@ -1,5 +1,5 @@ { - "family": "meirim-server", + "family": "staging-meirim-server", "containerDefinitions": [ { "name": "meirim",