From cdea32647226c3a5d4844bffaba9ce535a7fbb0e Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Tue, 23 Jul 2024 17:33:46 +0100 Subject: [PATCH 01/13] Added default key to rts deployments --- terraform/oss-redistimeseries-m5-spot-instances/common.tf | 1 + terraform/oss-standalone-redistimeseries-m5/common.tf | 1 + 2 files changed, 2 insertions(+) diff --git a/terraform/oss-redistimeseries-m5-spot-instances/common.tf b/terraform/oss-redistimeseries-m5-spot-instances/common.tf index 10568c1..44d54f3 100644 --- a/terraform/oss-redistimeseries-m5-spot-instances/common.tf +++ b/terraform/oss-redistimeseries-m5-spot-instances/common.tf @@ -6,6 +6,7 @@ terraform { backend "s3" { bucket = "performance-cto-group" region = "us-east-1" + key = "benchmarks/infrastructure/oss-redistimeseries-m5-spot-instances.tfstate" } } diff --git a/terraform/oss-standalone-redistimeseries-m5/common.tf b/terraform/oss-standalone-redistimeseries-m5/common.tf index 10568c1..3d87ff2 100644 --- a/terraform/oss-standalone-redistimeseries-m5/common.tf +++ b/terraform/oss-standalone-redistimeseries-m5/common.tf @@ -6,6 +6,7 @@ terraform { backend "s3" { bucket = "performance-cto-group" region = "us-east-1" + key = "benchmarks/infrastructure/oss-standalone-redistimeseries-m5.tfstate" } } From 93332d62bf636b7c180e166003a92f9b6c5eced2 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Tue, 23 Jul 2024 17:47:39 +0100 Subject: [PATCH 02/13] Added default key to rts deployments --- .../bench-client-resources.tf | 26 ------------------ .../common.tf | 1 - .../db-resources.tf | 27 ------------------- .../common.tf | 1 - 4 files changed, 55 deletions(-) diff --git a/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf b/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf index 0e00d49..b67ad88 100644 --- a/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf +++ b/terraform/oss-redistimeseries-m5-spot-instances/bench-client-resources.tf @@ -19,32 +19,6 @@ resource "aws_spot_instance_request" "client" { delete_on_termination = true } - volume_tags = { - Environment = "${var.environment}" - Project = "${var.environment}" - Name = "ebs_block_device-${var.setup_name}-CLIENT-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - - tags = { - Environment = "${var.environment}" - Project = "${var.environment}" - Name = "${var.setup_name}-CLIENT-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - ################################################################################ # This will ensure we wait here until the instance is ready to receive the ssh connection ################################################################################ diff --git a/terraform/oss-redistimeseries-m5-spot-instances/common.tf b/terraform/oss-redistimeseries-m5-spot-instances/common.tf index 44d54f3..10568c1 100644 --- a/terraform/oss-redistimeseries-m5-spot-instances/common.tf +++ b/terraform/oss-redistimeseries-m5-spot-instances/common.tf @@ -6,7 +6,6 @@ terraform { backend "s3" { bucket = "performance-cto-group" region = "us-east-1" - key = "benchmarks/infrastructure/oss-redistimeseries-m5-spot-instances.tfstate" } } diff --git a/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf b/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf index 5597052..ec7a7b9 100644 --- a/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf +++ b/terraform/oss-redistimeseries-m5-spot-instances/db-resources.tf @@ -19,33 +19,6 @@ resource "aws_spot_instance_request" "server" { delete_on_termination = true } - volume_tags = { - Environment = "${var.environment}" - Project = "${var.environment}" - Name = "ebs_block_device-${var.setup_name}-DB-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - - - tags = { - Environment = "${var.environment}" - Project = "${var.environment}" - Name = "${var.setup_name}-DB-${count.index + 1}" - setup = "${var.setup_name}" - triggering_env = "${var.triggering_env}" - github_actor = "${var.github_actor}" - github_org = "${var.github_org}" - github_repo = "${var.github_repo}" - github_sha = "${var.github_sha}" - timeout_secs = "${var.timeout_secs}" - } - ################################################################################ # This will ensure we wait here until the instance is ready to receive the ssh connection diff --git a/terraform/oss-standalone-redistimeseries-m5/common.tf b/terraform/oss-standalone-redistimeseries-m5/common.tf index 3d87ff2..10568c1 100644 --- a/terraform/oss-standalone-redistimeseries-m5/common.tf +++ b/terraform/oss-standalone-redistimeseries-m5/common.tf @@ -6,7 +6,6 @@ terraform { backend "s3" { bucket = "performance-cto-group" region = "us-east-1" - key = "benchmarks/infrastructure/oss-standalone-redistimeseries-m5.tfstate" } } From 55942badfd7df96a4158b8f35c11aca710460353 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Tue, 23 Jul 2024 18:44:05 +0100 Subject: [PATCH 03/13] Removed hcl spurious lock file --- .../.terraform.lock.hcl | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 terraform/oss-standalone-redistimeseries-m5/.terraform.lock.hcl diff --git a/terraform/oss-standalone-redistimeseries-m5/.terraform.lock.hcl b/terraform/oss-standalone-redistimeseries-m5/.terraform.lock.hcl deleted file mode 100644 index d5c0faf..0000000 --- a/terraform/oss-standalone-redistimeseries-m5/.terraform.lock.hcl +++ /dev/null @@ -1,20 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "3.34.0" - hashes = [ - "h1:IL5Gksx/gN7oIDoKmh/t4S2qIb7qT8w1qXCRIGXyxUc=", - "zh:003272229bd19bb63d6e77bc3d684268c417a151dfaee01c40b40e21cdd8bb0f", - "zh:103cacc1f3d97dfb7e9dd1e1905b075f92d9bd8aed434f811e8111788b648a57", - "zh:63a43c6e5fb2e5ad59ea068bede5c6bb54358affd32163d72785473a15440427", - "zh:6648af39a318c85eb336e2fb3ec1a01c5ffe8d75cc51686c37e892dd6f6a8974", - "zh:71ac8f6d5d61e5dee90099fd4fc1bb5bcd8ccb674eb6e7cd58d20757f7cecd12", - "zh:73baae4aa5bc0af12917e3bb17e1086050d25cdf7ba604f7fc422653c99f884c", - "zh:7d920ac05c45e77c59c49e0dd0cb010d64202c5a2fdfde6d9efe3dc61e396c97", - "zh:8a495e49f8fcbe276a74911f9ca48381533686ff71a9d4f7027bb9109769b639", - "zh:8ab9769581dfc1675c645e33e7ab8fea6ad1acc9e232eeda823070447e5ecaf1", - "zh:a170ecc560d49c251f4bebb6d6a82ff3637ae16a0f779a53489d4a64ddd1ee6a", - "zh:d9178201057b62666691ec206d1fbe09965bcfea532085b4e31f46073bf5898f", - ] -} From 4830631233b850cd016ff154a1db686884e785a2 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Tue, 23 Jul 2024 18:44:20 +0100 Subject: [PATCH 04/13] Removed hcl spurious lock file --- terraform/oss-standalone-redistimeseries-m5/common.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/terraform/oss-standalone-redistimeseries-m5/common.tf b/terraform/oss-standalone-redistimeseries-m5/common.tf index 3d87ff2..10568c1 100644 --- a/terraform/oss-standalone-redistimeseries-m5/common.tf +++ b/terraform/oss-standalone-redistimeseries-m5/common.tf @@ -6,7 +6,6 @@ terraform { backend "s3" { bucket = "performance-cto-group" region = "us-east-1" - key = "benchmarks/infrastructure/oss-standalone-redistimeseries-m5.tfstate" } } From e3c442cc10f4b9ec013b6b279ca4e633d137dc5b Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 8 Aug 2024 15:04:46 +0100 Subject: [PATCH 05/13] Added simple 2 nodes setup (1DB with HA enabled) --- .../common.tf | 12 ++ .../db-resources.tf | 76 +++++++++ .../install-re-7.4.sh | 22 +++ .../output.tf | 15 ++ .../prepare_ips.py | 25 +++ .../shared_resources.tf | 17 ++ .../variables.tf | 159 ++++++++++++++++++ 7 files changed, 326 insertions(+) create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/common.tf create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/db-resources.tf create mode 100755 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/install-re-7.4.sh create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/output.tf create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/prepare_ips.py create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/shared_resources.tf create mode 100644 terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/variables.tf diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/common.tf b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/common.tf new file mode 100644 index 0000000..8bf341e --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "testing-infrastructure/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge.tfstate" + } +} + diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/db-resources.tf b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/db-resources.tf new file mode 100644 index 0000000..367dff2 --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/db-resources.tf @@ -0,0 +1,76 @@ + +resource "aws_instance" "server" { + count = var.server_instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + iops = var.instance_volume_iops + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "ebs_block_device-${var.setup_name}-DB-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "${var.setup_name}-DB-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } + ################################################################################ + # Deployment related + ################################################################################ + + ################################################################################ + # Install RE + ################################################################################ + provisioner "remote-exec" { + script = "./install-re-7.4.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "10m" + agent = "false" + } + } +} diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/install-re-7.4.sh b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/install-re-7.4.sh new file mode 100755 index 0000000..d82adc3 --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/install-re-7.4.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# exit the script if any command fails. +set -e + +V=7.4.2 +FULL=$V-216 +FILENAME=/tmp/re.tar +OS="focal" + +wget -O $FILENAME https://s3.amazonaws.com/redis-enterprise-software-downloads/${V}/redislabs-${FULL}-${OS}-amd64.tar + +cd /tmp +tar vxf /tmp/re.tar +echo "DNSStubListener=no" | sudo tee -a /etc/systemd/resolved.conf +sudo mv /etc/resolv.conf /etc/resolv.conf.orig +sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf +sudo service systemd-resolved restart +sudo /tmp/install.sh -y + +# Cleanup +rm -f $FILENAME diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/output.tf b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/output.tf new file mode 100644 index 0000000..b01d7d0 --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/output.tf @@ -0,0 +1,15 @@ +output "server_public_ip" { + value = aws_instance.server[*].public_ip +} + +output "server_private_ip" { + value = aws_instance.server[*].private_ip +} + +output "server_instance_type" { + value = var.server_instance_type +} + +output "setup_name" { + value = var.setup_name +} diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/prepare_ips.py b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/prepare_ips.py new file mode 100644 index 0000000..321d984 --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/prepare_ips.py @@ -0,0 +1,25 @@ +import subprocess +import json + +# Run the "terraform output json" command +output = subprocess.run(["terraform", "output", "-json"], stdout=subprocess.PIPE) + +output_json = json.loads(output.stdout.decode()) +total_nodes = len(output_json["server_private_ip"]["value"]) + +print("#!/bin/bash\n") +print("TOTAL_NODES={}\n".format(total_nodes)) +suffix_len = len("perf-cto-RE-") +setup_name = output_json["setup_name"]["value"].replace(".", "_").replace("-", "_") +setup_name = setup_name[suffix_len:] +server_instance_type = output_json["server_instance_type"]["value"].replace(".", "_") + +print('CLUSTER_NAME="{}"\n'.format(setup_name)) +print("\n#internal IP addresses") +cleaned_json = {} +for keyn, v in enumerate(output_json["server_private_ip"]["value"], start=1): + print("B_M{}_I={}".format(keyn, v)) + +print("\n#external IP addresses") +for keyn, v in enumerate(output_json["server_public_ip"]["value"], start=1): + print("B_M{}_E={}".format(keyn, v)) diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/shared_resources.tf b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/variables.tf b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/variables.tf new file mode 100644 index 0000000..fb1b8ea --- /dev/null +++ b/terraform/re-2nodes-1dbs-25gb-7.4.0-r6id.2xlarge/variables.tf @@ -0,0 +1,159 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "perf-cto-RE-re-2nodes-1dbs-25gb-7.4.0-r6i.2xlarge" +} + +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "environment" { + description = " The cost tag." + default = "N/A" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "key_name" { + description = "key name" + default = "perf-cto-us-east-2" +} + +variable "region" { + default = "us-east-2" +} + +# (Ubuntu 20.04) +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04" + default = "ami-0119b1e7fe7303882" +} + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "1024" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "3000" +} + +variable "client_instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "client_instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu20.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +# r6id.2xlarge 8 VCPUs ; 64 GB Memory ; 1x474 NVMe SSD +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "r6i.2xlarge" +} + + +variable "server_instance_count" { + default = "2" +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 4 +} From 241403c9f099e544d425f83139ea16347bf42b35 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Wed, 18 Sep 2024 09:42:23 +0100 Subject: [PATCH 06/13] Updated base image from redis 7.1 to 7.4.0 --- .../oss-standalone-redisearch-m5/README.md | 53 ------------------- .../oss-standalone-redisearch-m5/variables.tf | 7 +-- 2 files changed, 4 insertions(+), 56 deletions(-) delete mode 100644 terraform/oss-standalone-redisearch-m5/README.md diff --git a/terraform/oss-standalone-redisearch-m5/README.md b/terraform/oss-standalone-redisearch-m5/README.md deleted file mode 100644 index 235482c..0000000 --- a/terraform/oss-standalone-redisearch-m5/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# oss-timescaledb-m5d - -Deploy Multi-VM benchmark scenario, including 1 client and 1 DB machine. -- Cloud provider: AWS -- OS: Ubuntu 20.04 -- Client machine: m5d.8xlarge -- Benchmark machine: m5d.8xlarge. - -------- - -#### Deployment - -##### Required env variables - -The terraform and ansible scripts expect the following env variables to be filled: -``` -export EC2_REGION={ ## INSERT REGION ## } -export EC2_ACCESS_KEY={ ## INSERT EC2 ACCESS KEY ## } -export EC2_SECRET_KEY={ ## INSERT EC2 SECRET KEY ## } -export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES -``` - -##### Required private key - -The terraform script expects the following private key to be present on: -``` -/tmp/benchmarks.redislabs.pem -``` - -##### Deployment steps -within project repo - -```bash -cd terraform/oss-timescale-m5d -terraform plan -terraform apply -ansible-playbook --private-key -u ubuntu -i , ../deps/automata/ansible/mongodb.yml -K -``` - -### Benchmark steps - -Within the benchmark machine - -#### Install tsbs -``` -sudo apt update -sudo apt install default-jdk maven -y - -git clone http://github.com/RediSearch/YCSB.git -cd YCSB -mvn -pl site.ycsb:mongodb-binding -am clean package - -``` diff --git a/terraform/oss-standalone-redisearch-m5/variables.tf b/terraform/oss-standalone-redisearch-m5/variables.tf index 9d86c3a..7e912e9 100644 --- a/terraform/oss-standalone-redisearch-m5/variables.tf +++ b/terraform/oss-standalone-redisearch-m5/variables.tf @@ -61,10 +61,11 @@ variable "region" { } # (Ubuntu 20.04) -# ubuntu-bionic-20.04-amd64-server +# ubuntu-bionic-20.04-amd64-server with redis 7.4.0 and memtier 2.1.1 +# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cfbc88a79665b192 variable "instance_ami" { - description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.1.241-tuned-latency" - default = "ami-0e64e0b751414b32e" + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.4.0-tuned-latency" + default = "ami-0cfbc88a79665b192" } variable "instance_device_name" { From 53a407ff06839c8bd1a23356b81726575a64fb21 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Wed, 18 Sep 2024 10:05:55 +0100 Subject: [PATCH 07/13] RediSearch spot instance should also use it --- terraform/oss-redisearch-m5-spot-instances/variables.tf | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/terraform/oss-redisearch-m5-spot-instances/variables.tf b/terraform/oss-redisearch-m5-spot-instances/variables.tf index abb9fcb..76ae8c2 100644 --- a/terraform/oss-redisearch-m5-spot-instances/variables.tf +++ b/terraform/oss-redisearch-m5-spot-instances/variables.tf @@ -66,10 +66,11 @@ variable "region" { } # (Ubuntu 20.04) -# ubuntu-bionic-20.04-amd64-server +# ubuntu-bionic-20.04-amd64-server with redis 7.4.0 and memtier 2.1.1 +# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cfbc88a79665b192 variable "instance_ami" { - description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.1.241" - default = "ami-078c8a93768628849" + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.4.0-tuned-latency" + default = "ami-0cfbc88a79665b192" } variable "instance_device_name" { From 09cd69da5c27d8a7efecb8288a452cb95e463604 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Wed, 18 Sep 2024 10:11:50 +0100 Subject: [PATCH 08/13] Increased volume size of spot instance --- terraform/oss-redisearch-m5-spot-instances/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/oss-redisearch-m5-spot-instances/variables.tf b/terraform/oss-redisearch-m5-spot-instances/variables.tf index 76ae8c2..5f73121 100644 --- a/terraform/oss-redisearch-m5-spot-instances/variables.tf +++ b/terraform/oss-redisearch-m5-spot-instances/variables.tf @@ -85,7 +85,7 @@ variable "redis_module" { variable "instance_volume_size" { description = "EC2 instance volume_size" - default = "256" + default = "1024" } variable "instance_volume_type" { From 88df6c35dc55f5ca0ebe313ba2d62b2dad5b09dc Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 6 Mar 2025 08:02:01 +0000 Subject: [PATCH 09/13] Added 4 and 8 m7a setups --- .../common.tf | 12 ++ .../db-resources_2a.tf | 58 +++++++ .../output.tf | 16 ++ .../prepare_ips.py | 26 +++ .../shared_resources.tf | 17 ++ .../variables.tf | 161 ++++++++++++++++++ .../common.tf | 12 ++ .../db-resources_2a.tf | 58 +++++++ .../output.tf | 16 ++ .../prepare_ips.py | 26 +++ .../shared_resources.tf | 17 ++ .../variables.tf | 161 ++++++++++++++++++ 12 files changed, 580 insertions(+) create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/common.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/db-resources_2a.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/output.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/prepare_ips.py create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/shared_resources.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/variables.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/common.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/db-resources_2a.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/output.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/prepare_ips.py create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/shared_resources.tf create mode 100644 terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/variables.tf diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/common.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/common.tf new file mode 100644 index 0000000..c58438e --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "benchmarks/infrastructure/jammy-22.04-amd64-server-20250305-m7a.2xlarge.tfstate" + } +} + diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/db-resources_2a.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/db-resources_2a.tf new file mode 100644 index 0000000..ba4f907 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/db-resources_2a.tf @@ -0,0 +1,58 @@ + +resource "aws_instance" "server_2a" { + count = var.instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + availability_zone = "us-east-2a" + placement_group = "perf-cto-pg" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "ebs_block_device-${var.setup_name}-DB-us-east-2a-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "${var.setup_name}-DB-us-east-2a-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/output.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/output.tf new file mode 100644 index 0000000..8408448 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/output.tf @@ -0,0 +1,16 @@ +output "server_public_ip" { + value = aws_instance.server_2a[*].public_ip +} + +output "server_private_ip" { + value = aws_instance.server_2a[*].private_ip +} + +output "server_instance_type" { + value = var.server_instance_type +} + + +output "pem" { + value = var.private_key +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/prepare_ips.py b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/prepare_ips.py new file mode 100644 index 0000000..3a05ebb --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/prepare_ips.py @@ -0,0 +1,26 @@ +import subprocess +import json + +# Run the "terraform output json" command +output = subprocess.run(["terraform", "output", "-json"], stdout=subprocess.PIPE) + +output_json = json.loads(output.stdout.decode()) +total_nodes = len(output_json["server_private_ip"]["value"]) +server_instance_type = output_json["server_instance_type"]["value"].replace(".", "-") +pem = output_json["pem"]["value"] + + +print("#!/bin/bash\n") +print("TOTAL_NODES={}\n".format(total_nodes)) +print("PEM={}\n".format(pem)) + +print(f'CLUSTER_NAME="{server_instance_type}-{total_nodes}nodes"\n') + +print("\n#internal IP addresses") +cleaned_json = {} +for keyn, v in enumerate(output_json["server_private_ip"]["value"], start=1): + print("B_M{}_I={}".format(keyn, v)) + +print("\n#external IP addresses") +for keyn, v in enumerate(output_json["server_public_ip"]["value"], start=1): + print("B_M{}_E={}".format(keyn, v)) diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/shared_resources.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/variables.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/variables.tf new file mode 100644 index 0000000..1f43ff8 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.2xlarge/variables.tf @@ -0,0 +1,161 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "jammy-22.04-amd64-server-20250305-m7a.2xlarge" +} + +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "environment" { + description = " The cost tag." + default = "small-instances" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "key_name" { + description = "key name" + default = "perf-cto-us-east-2" +} + +variable "region" { + default = "us-east-2" +} + +# Canonical, Ubuntu, 22.04 LTS, amd64 focal image build on 20250305 +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 - amd64" + default = "ami-0c3b809fcf2445b6a" +} + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "3000" +} + +variable "client_instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "client_instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + + +variable "instance_count" { + description = "" + default = 2 +} + + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu22.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +# m7i.large 2 VCPUs 8 GB MEM +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "m7a.2xlarge" +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 2 +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/common.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/common.tf new file mode 100644 index 0000000..5b3a184 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "benchmarks/infrastructure/jammy-22.04-amd64-server-20250305-m7a.xlarge.tfstate" + } +} + diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/db-resources_2a.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/db-resources_2a.tf new file mode 100644 index 0000000..ba4f907 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/db-resources_2a.tf @@ -0,0 +1,58 @@ + +resource "aws_instance" "server_2a" { + count = var.instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + availability_zone = "us-east-2a" + placement_group = "perf-cto-pg" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "ebs_block_device-${var.setup_name}-DB-us-east-2a-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "${var.setup_name}-DB-us-east-2a-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/output.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/output.tf new file mode 100644 index 0000000..8408448 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/output.tf @@ -0,0 +1,16 @@ +output "server_public_ip" { + value = aws_instance.server_2a[*].public_ip +} + +output "server_private_ip" { + value = aws_instance.server_2a[*].private_ip +} + +output "server_instance_type" { + value = var.server_instance_type +} + + +output "pem" { + value = var.private_key +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/prepare_ips.py b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/prepare_ips.py new file mode 100644 index 0000000..0355d9d --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/prepare_ips.py @@ -0,0 +1,26 @@ +import subprocess +import json + +# Run the "terraform output json" command +output = subprocess.run(["terraform", "output", "-json"], stdout=subprocess.PIPE) + +output_json = json.loads(output.stdout.decode()) +total_nodes = len(output_json["server_private_ip"]["value"]) +server_instance_type = output_json["server_instance_type"]["value"].replace(".", "_") +pem = output_json["pem"]["value"] + + +print("#!/bin/bash\n") +print("TOTAL_NODES={}\n".format(total_nodes)) +print("PEM={}\n".format(pem)) + +print(f'CLUSTER_NAME="{server_instance_type}_{total_nodes}nodes"\n') + +print("\n#internal IP addresses") +cleaned_json = {} +for keyn, v in enumerate(output_json["server_private_ip"]["value"], start=1): + print("B_M{}_I={}".format(keyn, v)) + +print("\n#external IP addresses") +for keyn, v in enumerate(output_json["server_public_ip"]["value"], start=1): + print("B_M{}_E={}".format(keyn, v)) diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/shared_resources.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/variables.tf b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/variables.tf new file mode 100644 index 0000000..80220fd --- /dev/null +++ b/terraform/jammy-22.04-amd64-server-20250305-m7a.xlarge/variables.tf @@ -0,0 +1,161 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "jammy-22.04-amd64-server-20250305-m7a.xlarge" +} + +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "environment" { + description = " The cost tag." + default = "small-instances" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "key_name" { + description = "key name" + default = "perf-cto-us-east-2" +} + +variable "region" { + default = "us-east-2" +} + +# Canonical, Ubuntu, 22.04 LTS, amd64 focal image build on 20250305 +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 - amd64" + default = "ami-0c3b809fcf2445b6a" +} + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "3000" +} + +variable "client_instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "client_instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + + +variable "instance_count" { + description = "" + default = 2 +} + + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu22.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +# m7i.large 2 VCPUs 8 GB MEM +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "m7a.xlarge" +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 2 +} From a7288d3927fd10d1d07f5d92ad02521158ebdf1f Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 6 Mar 2025 13:10:08 +0000 Subject: [PATCH 10/13] WIP on perf-base image AMI --- .../ec-1-primaries-v8-m7g.large-tls/common.tf | 12 ++ .../ec-1-primaries-v8-m7g.large-tls/ec.tf | 33 ++++ .../ec-1-primaries-v8-m7g.large-tls/output.tf | 5 + .../shared_resources.tf | 17 ++ .../variables.tf | 5 + .../ec-1-primaries-v8-m7g.large/common.tf | 12 ++ terraform/ec-1-primaries-v8-m7g.large/ec.tf | 30 ++++ .../ec-1-primaries-v8-m7g.large/output.tf | 5 + .../shared_resources.tf | 17 ++ .../ec-1-primaries-v8-m7g.large/variables.tf | 5 + .../common.tf | 12 ++ .../ec-1-primaries-v8-m7g.xlarge-tls/ec.tf | 31 ++++ .../output.tf | 5 + .../shared_resources.tf | 17 ++ .../variables.tf | 5 + .../ec-1-primaries-v8-m7g.xlarge/common.tf | 12 ++ terraform/ec-1-primaries-v8-m7g.xlarge/ec.tf | 30 ++++ .../ec-1-primaries-v8-m7g.xlarge/output.tf | 5 + .../shared_resources.tf | 17 ++ .../ec-1-primaries-v8-m7g.xlarge/variables.tf | 5 + .../common.tf | 13 ++ .../install_memtier.sh | 14 ++ .../install_redis.sh | 9 + .../output.tf | 16 ++ .../resources.tf | 102 +++++++++++ .../shared_resources.tf | 17 ++ .../variables.tf | 160 ++++++++++++++++++ 27 files changed, 611 insertions(+) create mode 100644 terraform/ec-1-primaries-v8-m7g.large-tls/common.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large-tls/ec.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large-tls/output.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large-tls/shared_resources.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large-tls/variables.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large/common.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large/ec.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large/output.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large/shared_resources.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.large/variables.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge-tls/common.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge-tls/ec.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge-tls/output.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge-tls/shared_resources.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge-tls/variables.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge/common.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge/ec.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge/output.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge/shared_resources.tf create mode 100644 terraform/ec-1-primaries-v8-m7g.xlarge/variables.tf create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/common.tf create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_memtier.sh create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_redis.sh create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/output.tf create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/resources.tf create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/shared_resources.tf create mode 100644 terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/variables.tf diff --git a/terraform/ec-1-primaries-v8-m7g.large-tls/common.tf b/terraform/ec-1-primaries-v8-m7g.large-tls/common.tf new file mode 100644 index 0000000..7f7e0c9 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large-tls/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "ec-1-primaries-v8-r7g.large-tls" + } +} + diff --git a/terraform/ec-1-primaries-v8-m7g.large-tls/ec.tf b/terraform/ec-1-primaries-v8-m7g.large-tls/ec.tf new file mode 100644 index 0000000..f78dd60 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large-tls/ec.tf @@ -0,0 +1,33 @@ +# resource "aws_elasticache_cluster" "ec" { +# cluster_id = "ec-1-primaries-v8-r7g-xlarge" +# node_type = "cache.m7g.xlarge" +# port = 6379 +# apply_immediately = true +# parameter_group_name = "default.valkey8" +# engine = "valkey" +# num_cache_nodes = 1 +# security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] +# subnet_group_name = "ec-subnet" +# availability_zone = "us-east-2a" +# } + +resource "aws_elasticache_replication_group" "ec" { + automatic_failover_enabled = false + preferred_cache_cluster_azs = ["us-east-2a"] + replication_group_id = "ec-1-primaries-v8-r7g-large-tls" + description = "xlarge cache" + node_type = "cache.m7g.large" + num_cache_clusters = 1 + parameter_group_name = "default.valkey8" + engine = "valkey" + port = 6379 + security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + subnet_group_name = "ec-subnet" + at_rest_encryption_enabled = false + data_tiering_enabled = false + transit_encryption_enabled = true + + + +} + diff --git a/terraform/ec-1-primaries-v8-m7g.large-tls/output.tf b/terraform/ec-1-primaries-v8-m7g.large-tls/output.tf new file mode 100644 index 0000000..ecaffce --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large-tls/output.tf @@ -0,0 +1,5 @@ + +output "ec_members" { + value = ["${aws_elasticache_replication_group.ec}"] +} + diff --git a/terraform/ec-1-primaries-v8-m7g.large-tls/shared_resources.tf b/terraform/ec-1-primaries-v8-m7g.large-tls/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large-tls/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/ec-1-primaries-v8-m7g.large-tls/variables.tf b/terraform/ec-1-primaries-v8-m7g.large-tls/variables.tf new file mode 100644 index 0000000..0a84a53 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large-tls/variables.tf @@ -0,0 +1,5 @@ + + +variable "region" { + default = "us-east-2" +} diff --git a/terraform/ec-1-primaries-v8-m7g.large/common.tf b/terraform/ec-1-primaries-v8-m7g.large/common.tf new file mode 100644 index 0000000..cf6f7ef --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "ec-1-primaries-v8-r7g.large" + } +} + diff --git a/terraform/ec-1-primaries-v8-m7g.large/ec.tf b/terraform/ec-1-primaries-v8-m7g.large/ec.tf new file mode 100644 index 0000000..67ff7a4 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large/ec.tf @@ -0,0 +1,30 @@ +# resource "aws_elasticache_cluster" "ec" { +# cluster_id = "ec-1-primaries-v8-r7g-xlarge" +# node_type = "cache.m7g.xlarge" +# port = 6379 +# apply_immediately = true +# parameter_group_name = "default.valkey8" +# engine = "valkey" +# num_cache_nodes = 1 +# security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] +# subnet_group_name = "ec-subnet" +# availability_zone = "us-east-2a" +# } + +resource "aws_elasticache_replication_group" "ec" { + automatic_failover_enabled = false + preferred_cache_cluster_azs = ["us-east-2a"] + replication_group_id = "ec-1-primaries-v8-r7g-large" + description = "xlarge cache" + node_type = "cache.m7g.large" + num_cache_clusters = 1 + parameter_group_name = "default.valkey8" + engine = "valkey" + port = 6379 + security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + subnet_group_name = "ec-subnet" + at_rest_encryption_enabled = false + data_tiering_enabled = false +} + + diff --git a/terraform/ec-1-primaries-v8-m7g.large/output.tf b/terraform/ec-1-primaries-v8-m7g.large/output.tf new file mode 100644 index 0000000..ecaffce --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large/output.tf @@ -0,0 +1,5 @@ + +output "ec_members" { + value = ["${aws_elasticache_replication_group.ec}"] +} + diff --git a/terraform/ec-1-primaries-v8-m7g.large/shared_resources.tf b/terraform/ec-1-primaries-v8-m7g.large/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/ec-1-primaries-v8-m7g.large/variables.tf b/terraform/ec-1-primaries-v8-m7g.large/variables.tf new file mode 100644 index 0000000..0a84a53 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.large/variables.tf @@ -0,0 +1,5 @@ + + +variable "region" { + default = "us-east-2" +} diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge-tls/common.tf b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/common.tf new file mode 100644 index 0000000..8919e37 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "ec-1-primaries-v8-r7g.xlarge-tls" + } +} + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge-tls/ec.tf b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/ec.tf new file mode 100644 index 0000000..74ef05e --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/ec.tf @@ -0,0 +1,31 @@ +# resource "aws_elasticache_cluster" "ec" { +# cluster_id = "ec-1-primaries-v8-r7g-xlarge" +# node_type = "cache.m7g.xlarge" +# port = 6379 +# apply_immediately = true +# parameter_group_name = "default.valkey8" +# engine = "valkey" +# num_cache_nodes = 1 +# security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] +# subnet_group_name = "ec-subnet" +# availability_zone = "us-east-2a" +# } + +resource "aws_elasticache_replication_group" "ec" { + automatic_failover_enabled = false + preferred_cache_cluster_azs = ["us-east-2a"] + replication_group_id = "ec-1-primaries-v8-r7g-xlarge-tls" + description = "xlarge cache" + node_type = "cache.m7g.xlarge" + num_cache_clusters = 1 + parameter_group_name = "default.valkey8" + engine = "valkey" + port = 6379 + security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + subnet_group_name = "ec-subnet" + at_rest_encryption_enabled = false + data_tiering_enabled = false + transit_encryption_enabled = true +} + + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge-tls/output.tf b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/output.tf new file mode 100644 index 0000000..ecaffce --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/output.tf @@ -0,0 +1,5 @@ + +output "ec_members" { + value = ["${aws_elasticache_replication_group.ec}"] +} + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge-tls/shared_resources.tf b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge-tls/variables.tf b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/variables.tf new file mode 100644 index 0000000..0a84a53 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge-tls/variables.tf @@ -0,0 +1,5 @@ + + +variable "region" { + default = "us-east-2" +} diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge/common.tf b/terraform/ec-1-primaries-v8-m7g.xlarge/common.tf new file mode 100644 index 0000000..b406466 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge/common.tf @@ -0,0 +1,12 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "ec-1-primaries-v8-r7g.xlarge" + } +} + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge/ec.tf b/terraform/ec-1-primaries-v8-m7g.xlarge/ec.tf new file mode 100644 index 0000000..2b160a3 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge/ec.tf @@ -0,0 +1,30 @@ +# resource "aws_elasticache_cluster" "ec" { +# cluster_id = "ec-1-primaries-v8-r7g-xlarge" +# node_type = "cache.m7g.xlarge" +# port = 6379 +# apply_immediately = true +# parameter_group_name = "default.valkey8" +# engine = "valkey" +# num_cache_nodes = 1 +# security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] +# subnet_group_name = "ec-subnet" +# availability_zone = "us-east-2a" +# } + +resource "aws_elasticache_replication_group" "ec" { + automatic_failover_enabled = false + preferred_cache_cluster_azs = ["us-east-2a"] + replication_group_id = "ec-1-primaries-v8-r7g-xlarge" + description = "xlarge cache" + node_type = "cache.m7g.xlarge" + num_cache_clusters = 1 + parameter_group_name = "default.valkey8" + engine = "valkey" + port = 6379 + security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + subnet_group_name = "ec-subnet" + at_rest_encryption_enabled = false + data_tiering_enabled = false +} + + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge/output.tf b/terraform/ec-1-primaries-v8-m7g.xlarge/output.tf new file mode 100644 index 0000000..ecaffce --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge/output.tf @@ -0,0 +1,5 @@ + +output "ec_members" { + value = ["${aws_elasticache_replication_group.ec}"] +} + diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge/shared_resources.tf b/terraform/ec-1-primaries-v8-m7g.xlarge/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/ec-1-primaries-v8-m7g.xlarge/variables.tf b/terraform/ec-1-primaries-v8-m7g.xlarge/variables.tf new file mode 100644 index 0000000..0a84a53 --- /dev/null +++ b/terraform/ec-1-primaries-v8-m7g.xlarge/variables.tf @@ -0,0 +1,5 @@ + + +variable "region" { + default = "us-east-2" +} diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/common.tf b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/common.tf new file mode 100644 index 0000000..1b9973e --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/common.tf @@ -0,0 +1,13 @@ + +################################################################################ +# This is the bucket holding this specific setup tfstate +################################################################################ +terraform { + backend "s3" { + bucket = "performance-cto-group" + region = "us-east-1" + key = "benchmarks/infrastructure/perf-base-image-ubuntu22.04-m6i.8xlarge.tfstate" + + } +} + diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_memtier.sh b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_memtier.sh new file mode 100644 index 0000000..d2ee41d --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_memtier.sh @@ -0,0 +1,14 @@ +#!/bin/bash +export DEBIAN_FRONTEND=noninteractive +sudo DEBIAN_FRONTEND=noninteractive apt update -y +sudo DEBIAN_FRONTEND=noninteractive apt install lsb-release curl gpg -y + +curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg + +echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list + +sudo apt-get update -y + +sudo apt-get install memtier-benchmark -y + + diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_redis.sh b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_redis.sh new file mode 100644 index 0000000..92b46bd --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/install_redis.sh @@ -0,0 +1,9 @@ +#!/bin/bash +export DEBIAN_FRONTEND=noninteractive +sudo DEBIAN_FRONTEND=noninteractive apt update -y +sudo DEBIAN_FRONTEND=noninteractive apt install zip git libssl-dev make gcc pkg-config python3-pip -y +sudo git clone https://github.com/redis/redis --depth 1 +sudo bash -c "cd redis && sudo make BUILD_TLS=yes -j && sudo make BUILD_TLS=yes install" +# check +echo "Printing redis-server info" +redis-server --version diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/output.tf b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/output.tf new file mode 100644 index 0000000..7602306 --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/output.tf @@ -0,0 +1,16 @@ +output "server_public_ip" { + value = aws_instance.server_2a[*].public_ip +} + +output "server_private_ip" { + value = aws_instance.server_2a[*].private_ip +} + +output "server_instance_type" { + value = var.server_instance_type +} + + +output "ami_id" { + value = aws_ami_from_instance.perf_ami.id +} diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/resources.tf b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/resources.tf new file mode 100644 index 0000000..6ee6af4 --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/resources.tf @@ -0,0 +1,102 @@ + +resource "aws_instance" "server_2a" { + count = var.server_instance_count + ami = var.instance_ami + instance_type = var.server_instance_type + subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id + vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"] + key_name = var.key_name + availability_zone = "us-east-2a" + + root_block_device { + volume_size = var.instance_volume_size + volume_type = var.instance_volume_type + encrypted = var.instance_volume_encrypted + delete_on_termination = true + } + + volume_tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "ebs_block_device-${var.setup_name}-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + tags = { + Environment = "${var.environment}" + Project = "${var.environment}" + Name = "${var.setup_name}-${count.index + 1}" + setup = "${var.setup_name}" + triggering_env = "${var.triggering_env}" + github_actor = "${var.github_actor}" + github_org = "${var.github_org}" + github_repo = "${var.github_repo}" + github_sha = "${var.github_sha}" + } + + ################################################################################ + # This will ensure we wait here until the instance is ready to receive the ssh connection + ################################################################################ + provisioner "remote-exec" { + script = "./../scripts/wait_for_instance.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } + + + ################################################################################ + # Deployment related + ################################################################################ + + ################################################################################ + # Install memtier + ################################################################################ + provisioner "remote-exec" { + script = "./install_redis.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } + + + ################################################################################ + # Install redis + ################################################################################ + provisioner "remote-exec" { + script = "./install_redis.sh" + connection { + host = self.public_ip # The `self` variable is like `this` in many programming languages + type = "ssh" # in this case, `self` is the resource (the server). + user = var.ssh_user + private_key = file(var.private_key) + #need to increase timeout to larger then 5m for metal instances + timeout = "5m" + agent = "false" + } + } + +} + + +resource "aws_ami_from_instance" "perf_ami" { + name = "${var.setup_name}-${formatdate("YYYYMMDD-HHmm", timestamp())}" + source_instance_id = aws_instance.server_2a[0].id +} \ No newline at end of file diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/shared_resources.tf b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/shared_resources.tf new file mode 100644 index 0000000..824e6b9 --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/shared_resources.tf @@ -0,0 +1,17 @@ +# provider +provider "aws" { + region = var.region +} + +################################################################################ +# This is the shared resources bucket key -- you will need it across environments like security rules,etc... +# !! do not change this !! +################################################################################ +data "terraform_remote_state" "shared_resources" { + backend = "s3" + config = { + bucket = "performance-cto-group" + key = "benchmarks/infrastructure/shared_resources.tfstate" + region = "us-east-1" + } +} diff --git a/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/variables.tf b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/variables.tf new file mode 100644 index 0000000..9e34d39 --- /dev/null +++ b/terraform/perf-base-image-ubuntu22.04-m6i.8xlarge/variables.tf @@ -0,0 +1,160 @@ +################################################################################ +# Variables used for deployment tag +################################################################################ + +variable "setup_name" { + description = "setup name" + default = "perf-base-image-ubuntu22.04-m6i.8xlarge" +} + +variable "github_actor" { + description = "The name of the person or app that initiated the deployment." + default = "N/A" +} + +variable "github_repo" { + description = " The owner and repository name. For example, testing-infrastructure." + default = "N/A" +} + +variable "triggering_env" { + description = " The triggering environment. For example circleci." + default = "N/A" +} + +variable "environment" { + description = " The cost tag." + default = "CI-BASE-IMAGE" +} + +variable "github_org" { + description = " The owner name. For example, RedisModules." + default = "N/A" +} + +variable "github_sha" { + description = "The commit SHA that triggered the deployment." + default = "N/A" +} + +variable "timeout_secs" { + description = "The maximum time to wait prior destroying the VM via the watchdog." + default = "3600" +} + + + +################################################################################ +# Access keys +################################################################################ +variable "private_key" { + description = "private key" + default = "/tmp/benchmarks.redislabs.pem" +} + +variable "key_name" { + description = "key name" + default = "perf-cto-us-east-2" +} + +variable "region" { + default = "us-east-2" +} + +# (Ubuntu 22.04) +# Jammy Jellyfish 22.04 LTS amd64 hvm:ebs-ssd 20250305 ami-0c3b809fcf2445b6a hvm +variable "instance_ami" { + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 LTS 20250305" + default = "ami-0c3b809fcf2445b6a" +} + + +variable "instance_device_name" { + description = "EC2 instance device name" + default = "/dev/sda1" +} + +variable "redis_module" { + description = "redis_module" + default = "N/A" +} + +variable "instance_volume_size" { + description = "EC2 instance volume_size" + default = "256" +} + +variable "instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_iops" { + description = "EC2 instance volume_iops" + default = "512" +} + +variable "client_instance_volume_size" { + description = "EC2 instance volume_size" + default = "128" +} + +variable "client_instance_volume_type" { + description = "EC2 instance volume_type" + default = "gp3" +} + + +variable "instance_volume_encrypted" { + description = "EC2 instance instance_volume_encrypted" + default = "false" +} + +variable "instance_root_block_device_encrypted" { + description = "EC2 instance instance_root_block_device_encrypted" + default = "false" +} + +variable "instance_cpu_threads_per_core" { + description = "CPU threads per core for aws EC2 instance" + default = 1 +} + +variable "instance_cpu_threads_per_core_hyperthreading" { + description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance" + default = 2 +} + +variable "instance_network_interface_plus_count" { + description = "number of additional network interfaces to add to aws EC2 instance" + default = 0 +} + +variable "os" { + description = "os" + default = "ubuntu22.04" +} + +variable "ssh_user" { + description = "ssh_user" + default = "ubuntu" +} + +################################################################################ +# Specific DB machine variables +################################################################################ +variable "server_instance_type" { + description = "type for aws EC2 instance" + default = "m6i.8xlarge" +} + +variable "server_instance_count" { + description = "count of aws EC2 instances" + default = 1 +} + +variable "server_instance_cpu_core_count" { + description = "CPU core count for aws EC2 instance" + default = 16 +} From 25a6a7703a74ea97561c7e3913d09990f2787c91 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 6 Mar 2025 17:38:18 +0000 Subject: [PATCH 11/13] Updated ami on search TF setups to ami-0cda50c2e20879afb (perf-base-image-ubuntu22.04-m6i.8xlarge-20250306-0220) --- .../variables.tf | 17 +++++++++++++---- .../oss-standalone-redisearch-m5/variables.tf | 17 ++++++++++++----- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf b/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf index 90c5820..9aafd65 100644 --- a/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf +++ b/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf @@ -60,13 +60,22 @@ variable "region" { default = "us-east-2" } -# (Ubuntu 20.04) -# ubuntu-bionic-20.04-amd64-server +# (Ubuntu 22.04, memtier 2.1.4 and redis unstable from March 6th 2025) +# ubuntu@ip-10-3-0-162:~$ memtier_benchmark --version +# memtier_benchmark 2.1.4 +# Copyright (C) 2011-2024 Redis Ltd. +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License . +# There is NO WARRANTY, to the extent permitted by law. +# ubuntu@ip-10-3-0-162:~$ redis-server --version +# Redis server v=255.255.255 sha=f364dcca:0 malloc=jemalloc-5.3.0 bits=64 build=502a999850b32fd8 +# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cda50c2e20879afb variable "instance_ami" { - description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.1.241-tuned-latency" - default = "ami-0e64e0b751414b32e" + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 - perf-base-image-ubuntu22.04-m6i.8xlarge-20250306-0220" + default = "ami-0cda50c2e20879afb" } + variable "instance_device_name" { description = "EC2 instance device name" default = "/dev/sda1" diff --git a/terraform/oss-standalone-redisearch-m5/variables.tf b/terraform/oss-standalone-redisearch-m5/variables.tf index 7e912e9..b46545c 100644 --- a/terraform/oss-standalone-redisearch-m5/variables.tf +++ b/terraform/oss-standalone-redisearch-m5/variables.tf @@ -60,12 +60,19 @@ variable "region" { default = "us-east-2" } -# (Ubuntu 20.04) -# ubuntu-bionic-20.04-amd64-server with redis 7.4.0 and memtier 2.1.1 -# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cfbc88a79665b192 +# (Ubuntu 22.04, memtier 2.1.4 and redis unstable from March 6th 2025) +# ubuntu@ip-10-3-0-162:~$ memtier_benchmark --version +# memtier_benchmark 2.1.4 +# Copyright (C) 2011-2024 Redis Ltd. +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License . +# There is NO WARRANTY, to the extent permitted by law. +# ubuntu@ip-10-3-0-162:~$ redis-server --version +# Redis server v=255.255.255 sha=f364dcca:0 malloc=jemalloc-5.3.0 bits=64 build=502a999850b32fd8 +# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cda50c2e20879afb variable "instance_ami" { - description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.4.0-tuned-latency" - default = "ami-0cfbc88a79665b192" + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 - perf-base-image-ubuntu22.04-m6i.8xlarge-20250306-0220" + default = "ami-0cda50c2e20879afb" } variable "instance_device_name" { From 19f5db680c6c29279e9a675089199d89e7e1efb5 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Thu, 6 Mar 2025 23:49:23 +0000 Subject: [PATCH 12/13] using proper key to auth on ec2 --- .../oss-standalone-redisearch-m5-spot-instances/variables.tf | 2 +- terraform/oss-standalone-redisearch-m5/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf b/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf index 9aafd65..506a4a4 100644 --- a/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf +++ b/terraform/oss-standalone-redisearch-m5-spot-instances/variables.tf @@ -53,7 +53,7 @@ variable "private_key" { variable "key_name" { description = "key name" - default = "perf-ci" + default = "perf-cto-us-east-2" } variable "region" { diff --git a/terraform/oss-standalone-redisearch-m5/variables.tf b/terraform/oss-standalone-redisearch-m5/variables.tf index b46545c..63d72e5 100644 --- a/terraform/oss-standalone-redisearch-m5/variables.tf +++ b/terraform/oss-standalone-redisearch-m5/variables.tf @@ -53,7 +53,7 @@ variable "private_key" { variable "key_name" { description = "key name" - default = "perf-ci" + default = "perf-cto-us-east-2" } variable "region" { From 062a18b3945897f77226094957652acdfcf70e5b Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Fri, 7 Mar 2025 00:16:57 +0000 Subject: [PATCH 13/13] using proper key to auth on ec2 --- .../variables.tf | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/terraform/oss-redisearch-m5-spot-instances/variables.tf b/terraform/oss-redisearch-m5-spot-instances/variables.tf index 5f73121..a8cfac4 100644 --- a/terraform/oss-redisearch-m5-spot-instances/variables.tf +++ b/terraform/oss-redisearch-m5-spot-instances/variables.tf @@ -56,23 +56,32 @@ variable "public_key" { default = "~/.ssh/perf-ci.pub" } + variable "key_name" { description = "key name" - default = "perf-ci" + default = "perf-cto-us-east-2" } variable "region" { default = "us-east-2" } -# (Ubuntu 20.04) -# ubuntu-bionic-20.04-amd64-server with redis 7.4.0 and memtier 2.1.1 -# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cfbc88a79665b192 +# (Ubuntu 22.04, memtier 2.1.4 and redis unstable from March 6th 2025) +# ubuntu@ip-10-3-0-162:~$ memtier_benchmark --version +# memtier_benchmark 2.1.4 +# Copyright (C) 2011-2024 Redis Ltd. +# This is free software. You may redistribute copies of it under the terms of +# the GNU General Public License . +# There is NO WARRANTY, to the extent permitted by law. +# ubuntu@ip-10-3-0-162:~$ redis-server --version +# Redis server v=255.255.255 sha=f364dcca:0 malloc=jemalloc-5.3.0 bits=64 build=502a999850b32fd8 +# https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#ImageDetails:imageId=ami-0cda50c2e20879afb variable "instance_ami" { - description = "AMI for aws EC2 instance - us-east-2 Ubuntu 20.04 - perf-cto-base-image-ubuntu20.04-redis-7.4.0-tuned-latency" - default = "ami-0cfbc88a79665b192" + description = "AMI for aws EC2 instance - us-east-2 Ubuntu 22.04 - perf-base-image-ubuntu22.04-m6i.8xlarge-20250306-0220" + default = "ami-0cda50c2e20879afb" } + variable "instance_device_name" { description = "EC2 instance device name" default = "/dev/sda1"