Skip to content

Commit

Permalink
chore(ci): create 2 task definitions (one for each env)
Browse files Browse the repository at this point in the history
  • Loading branch information
yossi-eynav committed Feb 10, 2024
1 parent 015dcfb commit 0677dfc
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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: |
Expand All @@ -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
Expand Down
47 changes: 47 additions & 0 deletions server/.aws/production-task-definition.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"family": "meirim-server",
"family": "staging-meirim-server",
"containerDefinitions": [
{
"name": "meirim",
Expand Down

0 comments on commit 0677dfc

Please sign in to comment.