Skip to content

Commit 0124db8

Browse files
committed
Fix grafana health check point and port for ECS
1 parent be96777 commit 0124db8

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

ops/ecs/modules/cluster/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ resource "aws_autoscaling_group" "ecs_instance_asg" {
2929
launch_configuration = aws_launch_configuration.ecs_cfg.name
3030

3131
vpc_zone_identifier = var.vpc_public_subnets
32-
min_size = 1
33-
max_size = 1
34-
desired_capacity = 1
32+
min_size = 2
33+
max_size = 2
34+
desired_capacity = 2
3535

3636
tag {
3737
key = "AmazonECSManaged"

ops/ecs/modules/grafana/main.tf

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ resource "aws_ecs_task_definition" "task" {
1515
family = "grafana"
1616
network_mode = "awsvpc"
1717
requires_compatibilities = ["EC2"]
18-
cpu = 256
18+
cpu = 512
1919
memory = 512
2020
execution_role_arn = aws_iam_role.execution_role.arn
2121

2222
container_definitions = jsonencode([
2323
{
2424
name : "grafana",
2525
image : data.aws_ecr_repository.repository.repository_url,
26+
container_name: "grafana",
2627
essential : true,
27-
cpu : 256,
28+
cpu : 512,
2829
memory : 512,
2930
environment : [
3031
{
@@ -54,8 +55,8 @@ resource "aws_ecs_task_definition" "task" {
5455
},
5556
portMappings : [
5657
{
57-
containerPort : 8000,
58-
hostPort : 8000,
58+
containerPort : 3000,
59+
hostPort : 3000,
5960
},
6061
],
6162
},
@@ -94,7 +95,7 @@ resource "aws_ecs_service" "service" {
9495
load_balancer {
9596
target_group_arn = aws_lb_target_group.target_group.arn
9697
container_name = "grafana"
97-
container_port = 8000
98+
container_port = 3000
9899
}
99100

100101
service_registries {
@@ -145,13 +146,13 @@ resource "aws_lb_listener" "https" {
145146

146147
resource "aws_lb_target_group" "target_group" {
147148
name = "alb-tg"
148-
port = 8000
149+
port = 3000
149150
protocol = "HTTP"
150151
vpc_id = var.vpc_id
151152
target_type = "ip"
152153

153154
health_check {
154-
path = "/"
155+
path = "/api/health"
155156
protocol = "HTTP"
156157
port = "traffic-port"
157158
healthy_threshold = 2

ops/ecs/modules/postgres/main.tf

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,26 @@ resource "aws_ecs_task_definition" "task" {
1515
family = "postgres"
1616
network_mode = "awsvpc"
1717
requires_compatibilities = ["EC2"]
18-
cpu = 256
19-
memory = 512
18+
cpu = 512
19+
memory = 1024
2020
execution_role_arn = aws_iam_role.execution_role.arn
2121

2222
container_definitions = jsonencode([
2323
{
2424
name : "postgres",
2525
image : data.aws_ecr_repository.repository.repository_url,
26+
container_name: "postgres",
27+
container_port: 5432,
2628
essential : true,
27-
cpu : 256,
28-
memory : 512,
29+
cpu : 512,
30+
memory : 1024,
31+
portMappings : [
32+
{
33+
containerPort : 5432,
34+
hostPort : 5432,
35+
protocol : "tcp"
36+
}
37+
],
2938
logConfiguration : {
3039
logDriver : "awslogs",
3140
options : {

ops/ecs/modules/vpc/vpc.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ resource "aws_security_group" "sg" {
3232
cidr_blocks = ["0.0.0.0/0"]
3333
}
3434

35-
ingress {
36-
from_port = 2049
37-
to_port = 2049
38-
protocol = "tcp"
39-
cidr_blocks = ["0.0.0.0/0"]
40-
}
41-
4235
ingress {
4336
description = "Allow HTTP traffic"
4437
from_port = 80
@@ -57,8 +50,8 @@ resource "aws_security_group" "sg" {
5750

5851
ingress {
5952
description = "Allow HTTP traffic"
60-
from_port = 8000
61-
to_port = 8000
53+
from_port = 3000
54+
to_port = 3000
6255
protocol = "tcp"
6356
cidr_blocks = ["0.0.0.0/0"]
6457
}

0 commit comments

Comments
 (0)