Commit e371afe5 by Sathish A

Add ECS task definitions for backend and frontend, and update .gitlab-ci.yml

parent 8ec5fc1f
Pipeline #61318 passed with stages
in 1 minute 25 seconds
...@@ -10,6 +10,8 @@ variables: ...@@ -10,6 +10,8 @@ variables:
registry_pass: $CI_BUILD_TOKEN registry_pass: $CI_BUILD_TOKEN
registry_user: gitlab-ci-token registry_user: gitlab-ci-token
registry: $CI_REGISTRY registry: $CI_REGISTRY
ecs_task_definition_backend: config/ecs-task-definition-backend.json
ecs_task_definition_frontend: config/ecs-task-definition-frontend.json
# Docker build for backend - staging # Docker build for backend - staging
docker_build_backend_staging: docker_build_backend_staging:
...@@ -57,10 +59,16 @@ deploy_backend_staging: ...@@ -57,10 +59,16 @@ deploy_backend_staging:
tags: tags:
- deploy - deploy
stage: deploy stage: deploy
dependencies:
- docker_build_backend_staging
variables: variables:
app_env: staging app_env: staging
app_url: https://spin-wheel-backend-staging.kacdn.net app_url: https://spin-wheel-backend-staging.kacdn.net
app_image_tag: $CI_REGISTRY_IMAGE/backend:staging
database_url: ${DATABASE_URL} database_url: ${DATABASE_URL}
allowed_origins: ${ALLOWED_ORIGINS:-https://spin-wheel-frontend-staging.kacdn.net}
ecs_task_definition: ${ecs_task_definition_backend}
service_name: spin-the-wheel-backend-staging
script: script:
- deploy-ecs staging - deploy-ecs staging
only: only:
...@@ -72,9 +80,15 @@ deploy_frontend_staging: ...@@ -72,9 +80,15 @@ deploy_frontend_staging:
tags: tags:
- deploy - deploy
stage: deploy stage: deploy
dependencies:
- docker_build_frontend_staging
variables: variables:
app_env: staging app_env: staging
app_url: https://spin-wheel-frontend-staging.kacdn.net app_url: https://spin-wheel-frontend-staging.kacdn.net
app_image_tag: $CI_REGISTRY_IMAGE/frontend:staging
backend_url: https://spin-wheel-backend-staging.kacdn.net
ecs_task_definition: ${ecs_task_definition_frontend}
service_name: spin-the-wheel-frontend-staging
script: script:
- deploy-ecs staging - deploy-ecs staging
only: only:
......
{
"family": "spin-the-wheel-backend",
"taskRoleArn": "arn:aws:iam::080757694071:role/EcsTaskRole",
"networkMode": "bridge",
"containerDefinitions": [
{
"name": "app",
"image": "{{app_image_tag}}",
"cpu": 256,
"memoryReservation": 512,
"essential": true,
"readonlyRootFilesystem": false,
"portMappings": [
{
"containerPort": 5000,
"hostPort": 0,
"protocol": "tcp"
}
],
"environment": [
{ "name": "NODE_ENV", "value": "production" },
{ "name": "PORT", "value": "5000" },
{ "name": "APP_ENV", "value": "{{app_env}}" },
{ "name": "APP_URL", "value": "{{app_url}}" },
{ "name": "DATABASE_URL", "value": "{{database_url}}" },
{ "name": "ALLOWED_ORIGINS", "value": "{{allowed_origins}}" }
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/spin-the-wheel-backend",
"awslogs-region": "ap-south-1",
"awslogs-stream-prefix": "ecs"
}
},
"healthCheck": {
"command": [
"CMD-SHELL",
"wget --quiet --tries=1 --spider http://localhost:5000/api/health || exit 1"
],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 40
}
}
]
}
{
"family": "spin-the-wheel-frontend",
"taskRoleArn": "arn:aws:iam::080757694071:role/EcsTaskRole",
"networkMode": "bridge",
"containerDefinitions": [
{
"name": "app",
"image": "{{app_image_tag}}",
"cpu": 256,
"memoryReservation": 256,
"essential": true,
"readonlyRootFilesystem": false,
"portMappings": [
{
"containerPort": 80,
"hostPort": 0,
"protocol": "tcp"
}
],
"environment": [
{ "name": "NODE_ENV", "value": "production" },
{ "name": "APP_ENV", "value": "{{app_env}}" },
{ "name": "APP_URL", "value": "{{app_url}}" },
{ "name": "BACKEND_URL", "value": "{{backend_url}}" }
],
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "/ecs/spin-the-wheel-frontend",
"awslogs-region": "ap-south-1",
"awslogs-stream-prefix": "ecs"
}
},
"healthCheck": {
"command": [
"CMD-SHELL",
"wget --quiet --tries=1 --spider http://localhost:80 || exit 1"
],
"interval": 30,
"timeout": 5,
"retries": 3,
"startPeriod": 10
}
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment