Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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 = "re-3nodes-r7i.16xlarge-rockylinux8-redislabs-6.4.2-81.tfstate"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

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}"
}

################################################################################
# Deployment related
################################################################################
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
}

output "ssh_user" {
value = var.ssh_user
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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(".", "-")
ssh_user = output_json["ssh_user"]["value"]


print('USER="{}"\n'.format(ssh_user))
print("PEM=/tmp/benchmarks.redislabs.pem\n")
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))
Original file line number Diff line number Diff line change
@@ -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"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
################################################################################
# Variables used for deployment tag
################################################################################

variable "setup_name" {
description = "setup name"
default = "perf-cto-RE-3nodes-r7i.16xlarge-rockylinux8-RS-6.4.2-81"
}

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 = "RED-158033"
}

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"
}

# Rocky Linux 8 (Official)Rocky Linux 8 (Official)
# https://aws.amazon.com/marketplace/server/configuration?productId=d6577ceb-8ea8-4e0e-84c6-f098fc302e82&ref_=psb_cfg_continue
# Ami Id: ami-02391db2758465a87
variable "instance_ami" {
description = "AMI for aws EC2 instance - us-east-2 Rocky Linux 8"
default = "ami-02391db2758465a87"
}

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 "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 = "rockylinux8"
}

variable "ssh_user" {
description = "ssh_user"
default = "rocky"
}

################################################################################
# Specific DB machine variables
################################################################################
# r7i.16xlarge 64 VCPUs 512 GB
variable "server_instance_type" {
description = "type for aws EC2 instance"
default = "r7i.16xlarge"
}


variable "server_instance_count" {
default = "3"
}

variable "server_instance_cpu_core_count" {
description = "CPU core count for aws EC2 instance"
default = 32
}
Original file line number Diff line number Diff line change
@@ -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 = "re-3nodes-r7i.16xlarge-rockylinux8-redislabs-7.8.6-36.tfstate"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

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}"
}

################################################################################
# Deployment related
################################################################################
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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
}

output "ssh_user" {
value = var.ssh_user
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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(".", "-")
ssh_user = output_json["ssh_user"]["value"]


print('USER="{}"\n'.format(ssh_user))
print("PEM=/tmp/benchmarks.redislabs.pem\n")
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))
Loading