Skip to content

Commit

Permalink
Loadtesting updates (#554)
Browse files Browse the repository at this point in the history
* Parameterized app_count, updated TEST cpu and memory usage
  • Loading branch information
vivid-cpreston authored Jan 18, 2023
1 parent d07a986 commit 5f038b8
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ jobs:
SERVER_MEMORY: 2048
DB_INSTANCE_TYPE: 'db.t3.micro'

INSTANCE_COUNT: 2

LOGGING_LEVEL: INFO

TARGET_ENV: dev
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ jobs:
APISIX_IMAGE: nr-bcws-wfnews-apisix

#1024 CPU units = 1 vCPU
CLIENT_CPU_UNITS: 1024
CLIENT_MEMORY: 2048
SERVER_CPU_UNITS: 1024
SERVER_MEMORY: 2048
CLIENT_CPU_UNITS: 2048
CLIENT_MEMORY: 4096
SERVER_CPU_UNITS: 2048
SERVER_MEMORY: 4096
DB_INSTANCE_TYPE: 'db.t3.micro'
INSTANCE_COUNT: 2

LOGGING_LEVEL: INFO

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/terragrunt-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ on:
DB_INSTANCE_TYPE:
required: true
type: string
INSTANCE_COUNT:
required: false
type: number
default: 1
LOGGING_LEVEL:
required: false
type: string
Expand Down Expand Up @@ -208,7 +212,8 @@ jobs:
SERVER_MEMORY: ${{inputs.SERVER_MEMORY}}
DB_INSTANCE_TYPE: ${{inputs.DB_INSTANCE_TYPE}}
LOGGING_LEVEL: ${{inputs.LOGGING_LEVEL}}

INSTANCE_COUNT: ${{inputs.INSTANCE_COUNT}}

API_KEY: ${{ secrets.API_KEY }}
TFC_PROJECT: ${{ secrets.LICENSE_PLATE }}
DB_PASS: ${{ secrets.DB_PASS }}
Expand Down
6 changes: 3 additions & 3 deletions terraform/autoscaling.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ resource "aws_appautoscaling_target" "wfnews_target" {
service_namespace = "ecs"
resource_id = "service/${aws_ecs_cluster.wfnews_main.name}/${aws_ecs_service.wfnews_main[count.index].name}"
scalable_dimension = "ecs:service:DesiredCount"
min_capacity = 1
min_capacity = var.app_count
max_capacity = 6
}

Expand All @@ -14,7 +14,7 @@ resource "aws_appautoscaling_target" "wfnews_apisix_target" {
service_namespace = "ecs"
resource_id = "service/${aws_ecs_cluster.wfnews_main.name}/${aws_ecs_service.apisix[count.index].name}"
scalable_dimension = "ecs:service:DesiredCount"
min_capacity = 1
min_capacity = var.app_count
max_capacity = 6
}

Expand Down Expand Up @@ -195,7 +195,7 @@ resource "aws_appautoscaling_target" "wfnews_client_target" {
service_namespace = "ecs"
resource_id = "service/${aws_ecs_cluster.wfnews_main.name}/${aws_ecs_service.client[count.index].name}"
scalable_dimension = "ecs:service:DesiredCount"
min_capacity = 1
min_capacity = var.app_count
max_capacity = 6
}

Expand Down
2 changes: 2 additions & 0 deletions terraform/dev/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ locals {
server_cpu_units = get_env("SERVER_CPU_UNITS")
server_memory = get_env("SERVER_MEMORY")
db_instance_type = get_env("DB_INSTANCE_TYPE")
app_count = get_env("INSTANCE_COUNT")

logging_level = get_env("LOGGING_LEVEL")

Expand Down Expand Up @@ -86,6 +87,7 @@ generate "dev_tfvars" {
server_memory = "${local.server_memory}"
db_instance_type = "${local.db_instance_type}"
logging_level = "${local.logging_level}"
app_count = "${local.app_count}"
api_key = "${local.api_key}"
db_pass = "${local.db_pass}"
alb_name = "${local.alb_name}"
Expand Down
2 changes: 2 additions & 0 deletions terraform/test/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ locals {
db_instance_type = get_env("DB_INSTANCE_TYPE")

logging_level = get_env("LOGGING_LEVEL")
app_count = get_env("INSTANCE_COUNT")

api_key = get_env("API_KEY")
target_env = get_env("TARGET_ENV")
Expand Down Expand Up @@ -87,6 +88,7 @@ generate "test_tfvars" {
server_cpu_units = "${local.server_cpu_units}"
server_memory = "${local.server_memory}"
db_instance_type = "${local.db_instance_type}"
app_count = "${local.app_count}"
logging_level = "${local.logging_level}"
api_key = "${local.api_key}"
db_pass = "${local.db_pass}"
Expand Down

0 comments on commit 5f038b8

Please sign in to comment.