Skip to content

Commit 5859253

Browse files
committed
bringing down the API
Signed-off-by: Irving Popovetsky <[email protected]>
1 parent 7219c84 commit 5859253

File tree

5 files changed

+66
-45
lines changed

5 files changed

+66
-45
lines changed

terraform/alb.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ resource "aws_security_group" "lb_security_group" {
3939
resource "aws_lb" "ecs" {
4040
name_prefix = "oc"
4141
security_groups = [aws_security_group.lb_security_group.id]
42+
access_logs {
43+
bucket = "oc-alb-logs"
44+
enabled = true
45+
prefix = "2025"
46+
}
4247

4348
load_balancer_type = "application"
4449
internal = false

terraform/apps.tf

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -19,58 +19,58 @@ resource "aws_iam_role_policy_attachment" "ecs_task_execution_role_attach" {
1919
################################################################################
2020

2121
# Backend Prod
22-
module "python_backend_prod" {
23-
source = "./python_backend"
22+
# module "python_backend_prod" {
23+
# source = "./python_backend"
2424

25-
env = "prod"
26-
vpc_id = data.aws_vpc.use2.id
27-
logs_group = aws_cloudwatch_log_group.ecslogs.name
28-
ecs_cluster_id = module.ecs.cluster_id
29-
task_execution_role = data.aws_iam_role.ecs_task_execution_role.arn
30-
image_tag = "master"
31-
}
25+
# env = "prod"
26+
# vpc_id = data.aws_vpc.use2.id
27+
# logs_group = aws_cloudwatch_log_group.ecslogs.name
28+
# ecs_cluster_id = module.ecs.cluster_id
29+
# task_execution_role = data.aws_iam_role.ecs_task_execution_role.arn
30+
# image_tag = "master"
31+
# }
3232

33-
resource "aws_lb_listener_rule" "python_backend_prod" {
34-
listener_arn = aws_lb_listener.default_https.arn
33+
# resource "aws_lb_listener_rule" "python_backend_prod" {
34+
# listener_arn = aws_lb_listener.default_https.arn
3535

36-
action {
37-
type = "forward"
38-
target_group_arn = module.python_backend_prod.lb_tg_arn
39-
}
36+
# action {
37+
# type = "forward"
38+
# target_group_arn = module.python_backend_prod.lb_tg_arn
39+
# }
4040

41-
condition {
42-
host_header {
43-
values = ["backend.operationcode.org", "api.operationcode.org"]
44-
}
45-
}
46-
}
41+
# condition {
42+
# host_header {
43+
# values = ["backend.operationcode.org", "api.operationcode.org"]
44+
# }
45+
# }
46+
# }
4747

4848
# Backend Staging
49-
module "python_backend_staging" {
50-
source = "./python_backend"
49+
# module "python_backend_staging" {
50+
# source = "./python_backend"
5151

52-
env = "staging"
53-
vpc_id = data.aws_vpc.use2.id
54-
logs_group = aws_cloudwatch_log_group.ecslogs.name
55-
ecs_cluster_id = module.ecs.cluster_id
56-
task_execution_role = data.aws_iam_role.ecs_task_execution_role.arn
57-
image_tag = "staging"
58-
}
52+
# env = "staging"
53+
# vpc_id = data.aws_vpc.use2.id
54+
# logs_group = aws_cloudwatch_log_group.ecslogs.name
55+
# ecs_cluster_id = module.ecs.cluster_id
56+
# task_execution_role = data.aws_iam_role.ecs_task_execution_role.arn
57+
# image_tag = "staging"
58+
# }
5959

60-
resource "aws_lb_listener_rule" "python_backend_staging" {
61-
listener_arn = aws_lb_listener.default_https.arn
60+
# resource "aws_lb_listener_rule" "python_backend_staging" {
61+
# listener_arn = aws_lb_listener.default_https.arn
6262

63-
action {
64-
type = "forward"
65-
target_group_arn = module.python_backend_staging.lb_tg_arn
66-
}
63+
# action {
64+
# type = "forward"
65+
# target_group_arn = module.python_backend_staging.lb_tg_arn
66+
# }
6767

68-
condition {
69-
host_header {
70-
values = ["backend-staging.operationcode.org", "api.staging.operationcode.org"]
71-
}
72-
}
73-
}
68+
# condition {
69+
# host_header {
70+
# values = ["backend-staging.operationcode.org", "api.staging.operationcode.org"]
71+
# }
72+
# }
73+
# }
7474

7575
# Redirector for shut down sites
7676
resource "aws_lb_listener_rule" "shutdown_sites_redirector" {
@@ -91,9 +91,10 @@ resource "aws_lb_listener_rule" "shutdown_sites_redirector" {
9191
host_header {
9292
values = [
9393
"resources.operationcode.org",
94-
"resources.staging.operationcode.org",
9594
"resources-staging.operationcode.org",
96-
"pybot.staging.operationcode.org",
95+
"api.operationcode.org",
96+
"backend-staging.operationcode.org",
97+
"api.staging.operationcode.org",
9798
]
9899
}
99100
}

terraform/asg.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module "autoscaling" {
3737
{
3838
delete_on_termination = true
3939
device_index = 0
40-
associate_public_ip_address = false
40+
associate_public_ip_address = true
4141
security_groups = [module.autoscaling_sg.security_group_id]
4242
}
4343
]

terraform/pybot/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ resource "aws_ecs_task_definition" "pybot" {
5252
}
5353
}
5454

55+
# healthCheck = {
56+
# command = ["CMD-SHELL", "wget -q http://localhost:5000/health || exit 1"]
57+
# interval = 30
58+
# timeout = 5
59+
# retries = 3
60+
# startPeriod = 60
61+
# }
62+
5563
secrets = local.secrets_env
5664

5765
mountPoints = []

terraform/python_backend/main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ resource "aws_ecs_task_definition" "python_backend" {
5353
}
5454
}
5555

56+
# healthCheck = {
57+
# command = ["CMD-SHELL", "wget -q http://localhost:8000/healthz || exit 1"]
58+
# interval = 30
59+
# timeout = 5
60+
# retries = 3
61+
# startPeriod = 60
62+
# }
5663

5764
environment = [
5865
{

0 commit comments

Comments
 (0)