Skip to content

Commit 776604a

Browse files
committed
fix: Update container images to use GitHub Container Registry and enhance ALB listener rules
1 parent 1e15726 commit 776604a

5 files changed

Lines changed: 21 additions & 14 deletions

File tree

terraform/envs/dev/us-east-1/dev.us-east-1.tfvars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ db_name = "fshdb"
3131
db_username = "fshadmin"
3232
db_password = "password123!" # Note: In production, use a more secure method for managing secrets.
3333

34-
api_container_image = "821175633958.dkr.ecr.us-east-1.amazonaws.com/fsh-playground-api"
34+
api_container_image = "ghcr.io/fullstackhero/fsh-playground-api:1e15726a02d9d12cd95679e5aa3fd7fda1f0620f"
3535
api_container_port = 8080
3636
api_cpu = "256"
3737
api_memory = "512"
3838
api_desired_count = 1
3939

40-
blazor_container_image = "821175633958.dkr.ecr.us-east-1.amazonaws.com/fsh-playground-blazor"
40+
blazor_container_image = "ghcr.io/fullstackhero/fsh-playground-blazor:1e15726a02d9d12cd95679e5aa3fd7fda1f0620f"
4141
blazor_container_port = 8080
4242
blazor_cpu = "256"
4343
blazor_memory = "512"

terraform/modules/app_stack/main.tf

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ locals {
1414
Environment = var.environment
1515
Project = "dotnet-starter-kit"
1616
}
17+
aspnetcore_environment = var.environment == "dev" ? "Development" : "Production"
1718
}
1819

1920
module "network" {
@@ -122,15 +123,16 @@ module "api_service" {
122123
subnet_ids = module.network.private_subnet_ids
123124
assign_public_ip = false
124125

125-
listener_arn = module.alb.listener_arn
126-
path_patterns = ["/api/*"]
126+
listener_arn = module.alb.listener_arn
127+
listener_rule_priority = 10
128+
path_patterns = ["/api/*", "/scalar*", "/health*", "/swagger*", "/openapi*"]
127129

128-
health_check_path = "/api/health"
130+
health_check_path = "/health/live"
129131

130132
environment_variables = {
131-
ASPNETCORE_ENVIRONMENT = var.environment
133+
ASPNETCORE_ENVIRONMENT = local.aspnetcore_environment
132134
DatabaseOptions__ConnectionString = local.db_connection_string
133-
CachingOptions__Redis = module.redis.primary_endpoint_address
135+
CachingOptions__Redis = "${module.redis.primary_endpoint_address}:6379,ssl=True,abortConnect=False"
134136
}
135137

136138
tags = local.common_tags
@@ -153,14 +155,15 @@ module "blazor_service" {
153155
subnet_ids = module.network.private_subnet_ids
154156
assign_public_ip = false
155157

156-
listener_arn = module.alb.listener_arn
157-
path_patterns = ["/*"]
158+
listener_arn = module.alb.listener_arn
159+
listener_rule_priority = 20
160+
path_patterns = ["/*"]
158161

159-
health_check_path = "/"
162+
health_check_path = "/health/live"
160163

161164
environment_variables = {
162-
ASPNETCORE_ENVIRONMENT = var.environment
163-
Api__BaseUrl = "http://${module.alb.dns_name}/api"
165+
ASPNETCORE_ENVIRONMENT = local.aspnetcore_environment
166+
Api__BaseUrl = "http://${module.alb.dns_name}"
164167
}
165168

166169
tags = local.common_tags

terraform/modules/ecs_service/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ resource "aws_lb_target_group" "this" {
5858

5959
resource "aws_lb_listener_rule" "this" {
6060
listener_arn = var.listener_arn
61+
priority = var.listener_rule_priority
6162

6263
action {
6364
type = "forward"

terraform/modules/ecs_service/variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ variable "listener_arn" {
6565
description = "ALB listener ARN."
6666
}
6767

68+
variable "listener_rule_priority" {
69+
type = number
70+
description = "Priority for the ALB listener rule."
71+
}
72+
6873
variable "path_patterns" {
6974
type = list(string)
7075
description = "Path patterns for ALB listener rule."
@@ -94,4 +99,3 @@ variable "tags" {
9499
description = "Tags to apply to resources."
95100
default = {}
96101
}
97-

terraform/modules/elasticache_redis/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ resource "aws_elasticache_replication_group" "this" {
4444
engine = "redis"
4545
engine_version = var.engine_version
4646
node_type = var.node_type
47-
num_cache_clusters = var.number_cache_clusters
4847
automatic_failover_enabled = var.automatic_failover_enabled
4948
multi_az_enabled = var.multi_az_enabled
5049
port = 6379

0 commit comments

Comments
 (0)