-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDK server prod #4243
Merged
Merged
SDK server prod #4243
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2387b51
feat: prod
carlomazzaferro f727f85
feat: pass full images
carlomazzaferro bd91b3c
Merge branch 'main' of https://github.com/connext/nxtp into feat/sdd-…
carlomazzaferro 4ae5f71
feat: enable alarms in testnet staging
carlomazzaferro 39f2dde
feat: testnet prod alarms
carlomazzaferro a8bb4c7
Merge branch 'main' of https://github.com/connext/nxtp into feat/sdd-…
carlomazzaferro b4503c3
fix: typos
just-a-node 673a49d
chore: update docker build command for mac
just-a-node e47fbd1
chore: update docker settings for mac
just-a-node 1c4ab61
fix: use the correct server package
just-a-node 595d17b
Merge branch 'main' of https://github.com/connext/nxtp into feat/sdd-…
carlomazzaferro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
locals { | ||
thresholds = { | ||
CPUUtilizationThreshold = var.cpu_utilization_threshold | ||
FreeStorageSpaceThreshold = var.free_storage_space_threshold | ||
} | ||
|
||
alarm_names = toset([ | ||
"cpu_utilization_too_high", | ||
"free_storage_space_threshold", | ||
]) | ||
} | ||
|
||
|
||
resource "aws_sns_topic_subscription" "target" { | ||
count = var.enable_cpu_utilization_alarm || var.enable_free_storage_space_too_low_alarm ? length(var.sns_topic_subscription_emails) : 0 | ||
topic_arn = aws_sns_topic.topic[0].arn | ||
protocol = "email" | ||
endpoint = var.sns_topic_subscription_emails[count.index] | ||
} | ||
|
||
resource "aws_sns_topic" "topic" { | ||
count = var.enable_cpu_utilization_alarm || var.enable_free_storage_space_too_low_alarm ? 1 : 0 | ||
name = "${var.environment}-${var.stage}-${var.is_replica ? "replica-" : ""}db-sns-topic" | ||
} | ||
|
||
|
||
resource "aws_cloudwatch_metric_alarm" "cpu_utilization_too_high" { | ||
count = var.enable_cpu_utilization_alarm ? 1 : 0 | ||
alarm_name = "${var.db_instance_name}-cpu-utilization-too-high" | ||
comparison_operator = "GreaterThanThreshold" | ||
evaluation_periods = "1" | ||
metric_name = "CPUUtilization" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
statistic = "Average" | ||
threshold = local.thresholds["CPUUtilizationThreshold"] | ||
alarm_description = "Average database CPU utilization over last 10 minutes too high" | ||
alarm_actions = aws_sns_topic.topic.*.arn | ||
ok_actions = aws_sns_topic.topic.*.arn | ||
|
||
dimensions = { | ||
DBInstanceIdentifier = var.db_instance_id | ||
} | ||
} | ||
|
||
|
||
resource "aws_cloudwatch_metric_alarm" "free_storage_space_too_low" { | ||
count = var.enable_free_storage_space_too_low_alarm ? 1 : 0 | ||
alarm_name = "${var.db_instance_name}-free-storage-space-too-low" | ||
comparison_operator = "LessThanThreshold" | ||
evaluation_periods = "1" | ||
metric_name = "FreeStorageSpace" | ||
namespace = "AWS/RDS" | ||
period = "600" | ||
statistic = "Average" | ||
threshold = local.thresholds["FreeStorageSpaceThreshold"] | ||
alarm_description = "Average database free storage space over last 10 minutes too low" | ||
alarm_actions = aws_sns_topic.topic.*.arn | ||
ok_actions = aws_sns_topic.topic.*.arn | ||
|
||
dimensions = { | ||
DBInstanceIdentifier = var.db_instance_id | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "free_storage_space_threshold_alarm_id" { | ||
value = aws_cloudwatch_metric_alarm.free_storage_space_too_low[0].alarm_name | ||
} | ||
|
||
output "cpu_utilization_threshold_id" { | ||
value = aws_cloudwatch_metric_alarm.free_storage_space_too_low[0].alarm_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
variable "db_instance_name" { | ||
type = string | ||
description = "The name of the database instance" | ||
} | ||
|
||
variable "db_instance_id" { | ||
type = string | ||
description = "The id of the database instance" | ||
} | ||
|
||
variable "is_replica" { | ||
type = bool | ||
description = "Whether the database instance is a replica" | ||
} | ||
|
||
variable "enable_cpu_utilization_alarm" { | ||
type = bool | ||
description = "Whether to enable the CPU utilization alarm" | ||
} | ||
|
||
variable "enable_free_storage_space_too_low_alarm" { | ||
type = bool | ||
description = "Whether to enable the free storage space too low alarm" | ||
} | ||
|
||
variable "environment" { | ||
type = string | ||
description = "The environment of the database instance" | ||
} | ||
|
||
variable "stage" { | ||
type = string | ||
description = "The stage of the database instance" | ||
} | ||
|
||
variable "sns_topic_subscription_emails" { | ||
type = list(string) | ||
description = "The emails to subscribe to the SNS topic" | ||
} | ||
|
||
variable "free_storage_space_threshold" { | ||
type = number | ||
description = "The free storage space threshold" | ||
default = 5 | ||
} | ||
|
||
|
||
variable "cpu_utilization_threshold" { | ||
type = number | ||
description = "The free storage space threshold" | ||
default = 90 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: Is this tier enough for SDK Server in prod ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question, I am not sure. Will defer to @rhlsthrm