Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dwilkie committed Mar 27, 2024
1 parent a844b3e commit 0cbcfb1
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/switch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
[
{
"identifier": "switch-staging",
"branch": "develop",
"branch": "support_connect_verb",
"image_tag": "staging",
"ecs_service": "switch-staging",
"ecs_cluster": "somleng-switch-staging"
Expand Down
6 changes: 6 additions & 0 deletions infrastructure/modules/somleng_switch/switch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ resource "aws_cloudwatch_log_group" "freeswitch_event_logger" {
retention_in_days = 7
}

resource "aws_cloudwatch_log_group" "redis" {
name = "${var.switch_identifier}-redis"
retention_in_days = 7
}

# Security Group
resource "aws_security_group" "switch" {
name = var.switch_identifier
Expand Down Expand Up @@ -389,6 +394,7 @@ data "template_file" "switch" {
freeswitch_logs_group = aws_cloudwatch_log_group.freeswitch.name
freeswitch_event_logger_logs_group = aws_cloudwatch_log_group.freeswitch_event_logger.name
app_logs_group = aws_cloudwatch_log_group.switch_app.name
redis_logs_group = aws_cloudwatch_log_group.redis.name
logs_group_region = var.aws_region
app_environment = var.app_environment

Expand Down
44 changes: 43 additions & 1 deletion infrastructure/modules/somleng_switch/templates/switch.json.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
}
},
"startTimeout": 120,
"dependsOn": [
{
"containerName": "redis",
"condition": "HEALTHY"
}
],
"healthCheck": {
"command": [ "CMD-SHELL", "wget --server-response --spider --quiet http://localhost:3000/health_checks 2>&1 | grep '200 OK' > /dev/null" ],
"interval": 10,
Expand Down Expand Up @@ -85,6 +91,10 @@
{
"name": "SERVICES_FUNCTION_ARN",
"value": "${services_function_arn}"
},
{
"name": "REDIS_URL",
"value": "redis://localhost:6379/1"
}
]
},
Expand Down Expand Up @@ -216,6 +226,30 @@
}
]
},
{
"name": "redis",
"image": "public.ecr.aws/docker/library/redis:alpine",
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-group": "${redis_logs_group}",
"awslogs-region": "${logs_group_region}",
"awslogs-stream-prefix": "${app_environment}"
}
},
"essential": true,
"healthCheck": {
"command": [ "CMD-SHELL", "redis-cli", "--raw", "incr", "ping" ],
"interval": 10,
"retries": 10,
"timeout": 5
},
"portMappings": [
{
"containerPort": 6379
}
]
},
{
"name": "freeswitch-event-logger",
"image": "${freeswitch_event_logger_image}:latest",
Expand All @@ -228,7 +262,7 @@
}
},
"startTimeout": 120,
"essential": false,
"essential": true,
"secrets": [
{
"name": "EVENT_SOCKET_PASSWORD",
Expand All @@ -239,12 +273,20 @@
{
"containerName": "freeswitch",
"condition": "HEALTHY"
},
{
"containerName": "redis",
"condition": "HEALTHY"
}
],
"environment": [
{
"name": "EVENT_SOCKET_HOST",
"value": "localhost:${freeswitch_event_socket_port}"
},
{
"name": "REDIS_URL",
"value": "redis://localhost:6379/1"
}
]
}
Expand Down

0 comments on commit 0cbcfb1

Please sign in to comment.