Resource constraints
This commit is contained in:
parent
8e22da08af
commit
701dc6b7ab
|
@ -107,6 +107,9 @@ void session(char *uuid, char *lang, char *imageHash)
|
||||||
"--user", "root",
|
"--user", "root",
|
||||||
"--hostname", lang,
|
"--hostname", lang,
|
||||||
"--name", container,
|
"--name", container,
|
||||||
|
"--cpus", "0.25",
|
||||||
|
"--memory", "100m",
|
||||||
|
"--memory-swap", "900m",
|
||||||
image, "bash", "-c",
|
image, "bash", "-c",
|
||||||
"cat /var/run/riju/sentinel/fifo | while read -t2; do :; done",
|
"cat /var/run/riju/sentinel/fifo | while read -t2; do :; done",
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -39,7 +39,7 @@ resource "aws_launch_template" "server" {
|
||||||
|
|
||||||
name = "riju-server"
|
name = "riju-server"
|
||||||
image_id = data.aws_ami.server[count.index].id
|
image_id = data.aws_ami.server[count.index].id
|
||||||
instance_type = "t3.small"
|
instance_type = "t3.medium"
|
||||||
|
|
||||||
security_group_names = [aws_security_group.server.name]
|
security_group_names = [aws_security_group.server.name]
|
||||||
iam_instance_profile {
|
iam_instance_profile {
|
||||||
|
|
|
@ -3,13 +3,13 @@ resource "aws_cloudwatch_metric_alarm" "server_cpu" {
|
||||||
|
|
||||||
alarm_name = "riju-server-cpu-high"
|
alarm_name = "riju-server-cpu-high"
|
||||||
comparison_operator = "GreaterThanOrEqualToThreshold"
|
comparison_operator = "GreaterThanOrEqualToThreshold"
|
||||||
evaluation_periods = "5"
|
evaluation_periods = "30"
|
||||||
metric_name = "CPUUtilization"
|
metric_name = "CPUUtilization"
|
||||||
namespace = "AWS/EC2"
|
namespace = "AWS/EC2"
|
||||||
period = "60"
|
period = "60"
|
||||||
statistic = "Maximum"
|
statistic = "Maximum"
|
||||||
threshold = "80"
|
threshold = "90"
|
||||||
alarm_description = "CPU usage on Riju server is above 80%"
|
alarm_description = "CPU usage on Riju server is above 90% for 30 minutes"
|
||||||
ok_actions = [aws_sns_topic.riju.arn]
|
ok_actions = [aws_sns_topic.riju.arn]
|
||||||
alarm_actions = [aws_sns_topic.riju.arn]
|
alarm_actions = [aws_sns_topic.riju.arn]
|
||||||
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
||||||
|
@ -23,13 +23,13 @@ resource "aws_cloudwatch_metric_alarm" "server_memory" {
|
||||||
|
|
||||||
alarm_name = "riju-server-memory-high"
|
alarm_name = "riju-server-memory-high"
|
||||||
comparison_operator = "GreaterThanOrEqualToThreshold"
|
comparison_operator = "GreaterThanOrEqualToThreshold"
|
||||||
evaluation_periods = "5"
|
evaluation_periods = "30"
|
||||||
metric_name = "mem_used_percent"
|
metric_name = "mem_used_percent"
|
||||||
namespace = "CWAgent"
|
namespace = "CWAgent"
|
||||||
period = "60"
|
period = "60"
|
||||||
statistic = "Maximum"
|
statistic = "Maximum"
|
||||||
threshold = "80"
|
threshold = "80"
|
||||||
alarm_description = "Memory usage on Riju server is above 80%"
|
alarm_description = "Memory usage on Riju server is above 80% for 30 minutes"
|
||||||
ok_actions = [aws_sns_topic.riju.arn]
|
ok_actions = [aws_sns_topic.riju.arn]
|
||||||
alarm_actions = [aws_sns_topic.riju.arn]
|
alarm_actions = [aws_sns_topic.riju.arn]
|
||||||
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
||||||
|
@ -43,13 +43,13 @@ resource "aws_cloudwatch_metric_alarm" "server_data_volume_disk_space" {
|
||||||
|
|
||||||
alarm_name = "riju-server-data-volume-disk-usage-high"
|
alarm_name = "riju-server-data-volume-disk-usage-high"
|
||||||
comparison_operator = "GreaterThanOrEqualToThreshold"
|
comparison_operator = "GreaterThanOrEqualToThreshold"
|
||||||
evaluation_periods = "5"
|
evaluation_periods = "30"
|
||||||
metric_name = "disk_used_percent"
|
metric_name = "disk_used_percent"
|
||||||
namespace = "CWAgent"
|
namespace = "CWAgent"
|
||||||
period = "60"
|
period = "60"
|
||||||
statistic = "Minimum"
|
statistic = "Maximum"
|
||||||
threshold = "80"
|
threshold = "90"
|
||||||
alarm_description = "Disk space usage for data volume on Riju server is above 80%"
|
alarm_description = "Disk space usage for data volume on Riju server is above 90% for 30 minutes"
|
||||||
ok_actions = [aws_sns_topic.riju.arn]
|
ok_actions = [aws_sns_topic.riju.arn]
|
||||||
alarm_actions = [aws_sns_topic.riju.arn]
|
alarm_actions = [aws_sns_topic.riju.arn]
|
||||||
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
||||||
|
@ -64,13 +64,13 @@ resource "aws_cloudwatch_metric_alarm" "server_root_volume_disk_space" {
|
||||||
|
|
||||||
alarm_name = "riju-server-root-volume-disk-usage-high"
|
alarm_name = "riju-server-root-volume-disk-usage-high"
|
||||||
comparison_operator = "GreaterThanOrEqualToThreshold"
|
comparison_operator = "GreaterThanOrEqualToThreshold"
|
||||||
evaluation_periods = "5"
|
evaluation_periods = "60"
|
||||||
metric_name = "disk_used_percent"
|
metric_name = "disk_used_percent"
|
||||||
namespace = "CWAgent"
|
namespace = "CWAgent"
|
||||||
period = "60"
|
period = "60"
|
||||||
statistic = "Minimum"
|
statistic = "Maximum"
|
||||||
threshold = "80"
|
threshold = "90"
|
||||||
alarm_description = "Disk space usage for root volume on Riju server is above 80%"
|
alarm_description = "Disk space usage for root volume on Riju server is above 90% for 30 minutes"
|
||||||
ok_actions = [aws_sns_topic.riju.arn]
|
ok_actions = [aws_sns_topic.riju.arn]
|
||||||
alarm_actions = [aws_sns_topic.riju.arn]
|
alarm_actions = [aws_sns_topic.riju.arn]
|
||||||
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
insufficient_data_actions = [aws_sns_topic.riju.arn]
|
||||||
|
|
Loading…
Reference in New Issue