... | @@ -25,6 +25,154 @@ Dentro do ECS, utilizaremos o AWS Fargate, que é um mecanismo de computação s |
... | @@ -25,6 +25,154 @@ Dentro do ECS, utilizaremos o AWS Fargate, que é um mecanismo de computação s |
|
|
|
|
|
![Product-Page-Diagram_Fargate_2x.a20fb2b15c2aebeda3a44dbbb0b10b82fb89aa6a](uploads/e1da4cadc5d2b092a5fa0c2e58eebe8a/Product-Page-Diagram_Fargate_2x.a20fb2b15c2aebeda3a44dbbb0b10b82fb89aa6a.png)
|
|
![Product-Page-Diagram_Fargate_2x.a20fb2b15c2aebeda3a44dbbb0b10b82fb89aa6a](uploads/e1da4cadc5d2b092a5fa0c2e58eebe8a/Product-Page-Diagram_Fargate_2x.a20fb2b15c2aebeda3a44dbbb0b10b82fb89aa6a.png)
|
|
|
|
|
|
|
|
Usamos a seguinte configuração para nossa aplicação:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"taskDefinitionArn": "arn:aws:ecs:us-east-2:<ACCOUNT_ID>:task-definition/connectpharmacy-task-db-backend-frontend:9",
|
|
|
|
"containerDefinitions": [
|
|
|
|
{
|
|
|
|
"name": "database",
|
|
|
|
"image": "<ACCOUNT_ID>.dkr.ecr.us-east-2.amazonaws.com/connectpharmacy:db",
|
|
|
|
"cpu": 0,
|
|
|
|
"portMappings": [
|
|
|
|
{
|
|
|
|
"name": "database-5432-tcp",
|
|
|
|
"containerPort": 5432,
|
|
|
|
"hostPort": 5432,
|
|
|
|
"protocol": "tcp",
|
|
|
|
"appProtocol": "http"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"essential": true,
|
|
|
|
"environment": [
|
|
|
|
{
|
|
|
|
"name": "POSTGRES_USER",
|
|
|
|
"value": "connectpharmacy"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "POSTGRES_PASSWORD",
|
|
|
|
"value": "senha_do_banco"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "POSTGRES_DB",
|
|
|
|
"value": "connectpharmacy"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"environmentFiles": [],
|
|
|
|
"mountPoints": [],
|
|
|
|
"volumesFrom": [],
|
|
|
|
"ulimits": []
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "backend",
|
|
|
|
"image": "<ACCOUNT_ID>.dkr.ecr.us-east-2.amazonaws.com/connectpharmacy:backend_V4",
|
|
|
|
"cpu": 0,
|
|
|
|
"portMappings": [
|
|
|
|
{
|
|
|
|
"name": "backend-3001-tcp",
|
|
|
|
"containerPort": 3001,
|
|
|
|
"hostPort": 3001,
|
|
|
|
"protocol": "tcp",
|
|
|
|
"appProtocol": "http"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"essential": false,
|
|
|
|
"environment": [
|
|
|
|
{
|
|
|
|
"name": "JWT_SECRET",
|
|
|
|
"value": "4ACB7CA3C7A9714555AB4A9F7114C"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "DATABASE_URL",
|
|
|
|
"value": "postgresql://connectpharmacy:senha_do_banco@localhost:5432/connectpharmacy"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"environmentFiles": [],
|
|
|
|
"mountPoints": [],
|
|
|
|
"volumesFrom": [],
|
|
|
|
"dependsOn": [
|
|
|
|
{
|
|
|
|
"containerName": "database",
|
|
|
|
"condition": "START"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "frontend",
|
|
|
|
"image": "<ACCOUNT_ID>.dkr.ecr.us-east-2.amazonaws.com/connectpharmacy:frontend_V4",
|
|
|
|
"cpu": 0,
|
|
|
|
"portMappings": [
|
|
|
|
{
|
|
|
|
"name": "frontend-80-tcp",
|
|
|
|
"containerPort": 80,
|
|
|
|
"hostPort": 80,
|
|
|
|
"protocol": "tcp",
|
|
|
|
"appProtocol": "http"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"essential": false,
|
|
|
|
"environment": [],
|
|
|
|
"environmentFiles": [],
|
|
|
|
"mountPoints": [],
|
|
|
|
"volumesFrom": []
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"family": "connectpharmacy-task-db-backend-frontend",
|
|
|
|
"taskRoleArn": "arn:aws:iam::<ACCOUNT_ID>:role/ecsTaskExecutionRole",
|
|
|
|
"executionRoleArn": "arn:aws:iam::<ACCOUNT_ID>:role/ecsTaskExecutionRole",
|
|
|
|
"networkMode": "awsvpc",
|
|
|
|
"revision": 9,
|
|
|
|
"volumes": [],
|
|
|
|
"status": "ACTIVE",
|
|
|
|
"requiresAttributes": [
|
|
|
|
{
|
|
|
|
"name": "com.amazonaws.ecs.capability.ecr-auth"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "com.amazonaws.ecs.capability.task-iam-role"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name": "ecs.capability.container-ordering"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"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",
|
|
|
|
"runtimePlatform": {
|
|
|
|
"cpuArchitecture": "X86_64",
|
|
|
|
"operatingSystemFamily": "LINUX"
|
|
|
|
},
|
|
|
|
"registeredAt": "2023-06-12T21:42:18.902Z",
|
|
|
|
"registeredBy": "arn:aws:iam::<ACCOUNT_ID>:user/connectpharmacy",
|
|
|
|
"tags": [
|
|
|
|
{
|
|
|
|
"key": "Project",
|
|
|
|
"value": "Connect Pharmacy"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"key": "Owner",
|
|
|
|
"value": "connectpharmacy"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
_Fonte: https://aws.amazon.com/pt/fargate/_
|
|
_Fonte: https://aws.amazon.com/pt/fargate/_
|
|
|
|
|
|
## Fluxo do Deploy
|
|
## Fluxo do Deploy
|
... | | ... | |