From 48ce3aa53362be34cf3aaa367b2f7102e3ee3009 Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 19:34:40 +0100 Subject: [PATCH 1/6] Chores: added ECS redeployment trigger --- terraform/ecs.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terraform/ecs.tf b/terraform/ecs.tf index 608f081..70cd71d 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -50,6 +50,10 @@ resource "aws_ecs_service" "fastapi-service" { launch_type = "EC2" force_new_deployment = true + triggers = { + redeployment = timestamp() + } + load_balancer { target_group_arn = aws_lb_target_group.target_group.arn container_name = "${var.env}_FastAPI_image" From e967179be0ebe734122ee9198267d1799c5a8415 Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 19:35:54 +0100 Subject: [PATCH 2/6] Chores: added ECS redeployment trigger --- terraform/ecs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ecs.tf b/terraform/ecs.tf index 70cd71d..be994c8 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -40,7 +40,7 @@ TASK_DEFINITION } -# ------ ECS Service -------- ** +# ------ ECS Service --------- ** resource "aws_ecs_service" "fastapi-service" { name = var.ecs_service_name From 3da289ba680970ce93c5e82e59f5d46f39f4c749 Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 19:47:40 +0100 Subject: [PATCH 3/6] Fix: Removing revision to always get image latest --- terraform/ecs.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terraform/ecs.tf b/terraform/ecs.tf index be994c8..d1c8550 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -45,9 +45,10 @@ TASK_DEFINITION resource "aws_ecs_service" "fastapi-service" { name = var.ecs_service_name cluster = aws_ecs_cluster.fastapi-cluster.id - task_definition = aws_ecs_task_definition.task_definition.arn + task_definition = aws_ecs_task_definition.task_definition.arn_without_revision desired_count = 1 launch_type = "EC2" + force_new_deployment = true triggers = { From 47c3a3b1b68b09d6aad58940fbd421c6b1606ea3 Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 19:50:12 +0100 Subject: [PATCH 4/6] Fix: Removing revision to always get image latest --- terraform/ecs.tf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/terraform/ecs.tf b/terraform/ecs.tf index d1c8550..ffde1b0 100644 --- a/terraform/ecs.tf +++ b/terraform/ecs.tf @@ -51,10 +51,6 @@ resource "aws_ecs_service" "fastapi-service" { force_new_deployment = true - triggers = { - redeployment = timestamp() - } - load_balancer { target_group_arn = aws_lb_target_group.target_group.arn container_name = "${var.env}_FastAPI_image" From 37c1cd6b1b60e45c86855666b49e569f816510fa Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 20:59:52 +0100 Subject: [PATCH 5/6] modified docker image --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 814982e..8edb16c 100644 --- a/main.py +++ b/main.py @@ -13,7 +13,7 @@ class Item(BaseModel): @app.get("/") def read_root(): - return {"Message": "Hello world! Merry Christmas and a happy new year to everyone!!!"} + return {"Message": "Hello world! Welcome to FastAPI!!!"} @app.get("/items/{item_id}") From a39288b816590c2ccb9243946f4d268813b3d4b7 Mon Sep 17 00:00:00 2001 From: IrezD Date: Sun, 7 Jan 2024 23:59:16 +0100 Subject: [PATCH 6/6] modified task definition memory size --- terraform/asg.tf | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/terraform/asg.tf b/terraform/asg.tf index 4810987..20e3dbf 100644 --- a/terraform/asg.tf +++ b/terraform/asg.tf @@ -36,6 +36,13 @@ resource "aws_autoscaling_group" "ASG_config" { propagate_at_launch = true } + tag { + key = "Name" + value = "${title(var.env)}_Enivronment" + propagate_at_launch = true + } + + timeouts { delete = "15m" }