Skip to content

Commit 4cdca72

Browse files
Added 24.04 arm64 base image (#126)
1 parent 269ebd1 commit 4cdca72

File tree

7 files changed

+332
-0
lines changed

7 files changed

+332
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
################################################################################
3+
# This is the bucket holding this specific setup tfstate
4+
################################################################################
5+
terraform {
6+
backend "s3" {
7+
bucket = "performance-cto-group"
8+
region = "us-east-1"
9+
key = "benchmarks/infrastructure/perf-base-image-ubuntu24.04-aarch64-m7g.8xlarge.tfstate"
10+
11+
}
12+
}
13+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
export DEBIAN_FRONTEND=noninteractive
3+
sudo DEBIAN_FRONTEND=noninteractive apt update -y
4+
sudo DEBIAN_FRONTEND=noninteractive apt install lsb-release curl gpg -y
5+
6+
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
7+
8+
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
9+
10+
sudo apt-get update -y
11+
12+
sudo apt-get install memtier-benchmark -y
13+
14+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
export DEBIAN_FRONTEND=noninteractive
3+
sudo DEBIAN_FRONTEND=noninteractive apt update -y
4+
sudo DEBIAN_FRONTEND=noninteractive apt install zip git libssl-dev make gcc pkg-config python3-pip -y
5+
# install libssl1 due to search
6+
sudo git clone https://github.com/redis/redis --depth 1
7+
sudo bash -c "cd redis && sudo make BUILD_TLS=yes -j && sudo make BUILD_TLS=yes install"
8+
# check
9+
echo "Printing redis-server info"
10+
redis-server --version
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
output "server_public_ip" {
2+
value = aws_instance.server_2a[*].public_ip
3+
}
4+
5+
output "server_private_ip" {
6+
value = aws_instance.server_2a[*].private_ip
7+
}
8+
9+
output "server_instance_type" {
10+
value = var.server_instance_type
11+
}
12+
13+
14+
output "ami_id" {
15+
value = aws_ami_from_instance.perf_ami.id
16+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
2+
resource "aws_instance" "server_2a" {
3+
count = var.server_instance_count
4+
ami = var.instance_ami
5+
instance_type = var.server_instance_type
6+
subnet_id = data.terraform_remote_state.shared_resources.outputs.subnet_public_id
7+
vpc_security_group_ids = ["${data.terraform_remote_state.shared_resources.outputs.performance_cto_sg_id}"]
8+
key_name = var.key_name
9+
availability_zone = "us-east-2a"
10+
11+
root_block_device {
12+
volume_size = var.instance_volume_size
13+
volume_type = var.instance_volume_type
14+
encrypted = var.instance_volume_encrypted
15+
delete_on_termination = true
16+
}
17+
18+
volume_tags = {
19+
Environment = "${var.environment}"
20+
Project = "${var.environment}"
21+
Name = "ebs_block_device-${var.setup_name}-${count.index + 1}"
22+
setup = "${var.setup_name}"
23+
triggering_env = "${var.triggering_env}"
24+
github_actor = "${var.github_actor}"
25+
github_org = "${var.github_org}"
26+
github_repo = "${var.github_repo}"
27+
github_sha = "${var.github_sha}"
28+
}
29+
30+
tags = {
31+
Environment = "${var.environment}"
32+
Project = "${var.environment}"
33+
Name = "${var.setup_name}-${count.index + 1}"
34+
setup = "${var.setup_name}"
35+
triggering_env = "${var.triggering_env}"
36+
github_actor = "${var.github_actor}"
37+
github_org = "${var.github_org}"
38+
github_repo = "${var.github_repo}"
39+
github_sha = "${var.github_sha}"
40+
}
41+
42+
################################################################################
43+
# This will ensure we wait here until the instance is ready to receive the ssh connection
44+
################################################################################
45+
provisioner "remote-exec" {
46+
script = "./../scripts/wait_for_instance.sh"
47+
connection {
48+
host = self.public_ip # The `self` variable is like `this` in many programming languages
49+
type = "ssh" # in this case, `self` is the resource (the server).
50+
user = var.ssh_user
51+
private_key = file(var.private_key)
52+
#need to increase timeout to larger then 5m for metal instances
53+
timeout = "5m"
54+
agent = "false"
55+
}
56+
}
57+
58+
59+
################################################################################
60+
# Deployment related
61+
################################################################################
62+
63+
################################################################################
64+
# Install memtier
65+
################################################################################
66+
provisioner "remote-exec" {
67+
script = "./install_memtier.sh"
68+
connection {
69+
host = self.public_ip # The `self` variable is like `this` in many programming languages
70+
type = "ssh" # in this case, `self` is the resource (the server).
71+
user = var.ssh_user
72+
private_key = file(var.private_key)
73+
#need to increase timeout to larger then 5m for metal instances
74+
timeout = "5m"
75+
agent = "false"
76+
}
77+
}
78+
79+
80+
################################################################################
81+
# Install redis
82+
################################################################################
83+
provisioner "remote-exec" {
84+
script = "./install_redis.sh"
85+
connection {
86+
host = self.public_ip # The `self` variable is like `this` in many programming languages
87+
type = "ssh" # in this case, `self` is the resource (the server).
88+
user = var.ssh_user
89+
private_key = file(var.private_key)
90+
#need to increase timeout to larger then 5m for metal instances
91+
timeout = "5m"
92+
agent = "false"
93+
}
94+
}
95+
96+
}
97+
98+
99+
resource "aws_ami_from_instance" "perf_ami" {
100+
name = "${var.setup_name}-${formatdate("YYYYMMDD-HHmm", timestamp())}"
101+
source_instance_id = aws_instance.server_2a[0].id
102+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# provider
2+
provider "aws" {
3+
region = var.region
4+
}
5+
6+
################################################################################
7+
# This is the shared resources bucket key -- you will need it across environments like security rules,etc...
8+
# !! do not change this !!
9+
################################################################################
10+
data "terraform_remote_state" "shared_resources" {
11+
backend = "s3"
12+
config = {
13+
bucket = "performance-cto-group"
14+
key = "benchmarks/infrastructure/shared_resources.tfstate"
15+
region = "us-east-1"
16+
}
17+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
################################################################################
2+
# Variables used for deployment tag
3+
################################################################################
4+
5+
variable "setup_name" {
6+
description = "setup name"
7+
default = "perf-base-image-ubuntu24.04-aarch64-m7g.8xlarge"
8+
}
9+
10+
variable "github_actor" {
11+
description = "The name of the person or app that initiated the deployment."
12+
default = "N/A"
13+
}
14+
15+
variable "github_repo" {
16+
description = " The owner and repository name. For example, testing-infrastructure."
17+
default = "N/A"
18+
}
19+
20+
variable "triggering_env" {
21+
description = " The triggering environment. For example circleci."
22+
default = "N/A"
23+
}
24+
25+
variable "environment" {
26+
description = " The cost tag."
27+
default = "CI-BASE-IMAGE"
28+
}
29+
30+
variable "github_org" {
31+
description = " The owner name. For example, RedisModules."
32+
default = "N/A"
33+
}
34+
35+
variable "github_sha" {
36+
description = "The commit SHA that triggered the deployment."
37+
default = "N/A"
38+
}
39+
40+
variable "timeout_secs" {
41+
description = "The maximum time to wait prior destroying the VM via the watchdog."
42+
default = "3600"
43+
}
44+
45+
46+
47+
################################################################################
48+
# Access keys
49+
################################################################################
50+
variable "private_key" {
51+
description = "private key"
52+
default = "/tmp/benchmarks.redislabs.pem"
53+
}
54+
55+
variable "key_name" {
56+
description = "key name"
57+
default = "perf-cto-us-east-2"
58+
}
59+
60+
variable "region" {
61+
default = "us-east-2"
62+
}
63+
64+
# (Ubuntu 24.04)
65+
# Jammy Jellyfish 24.04 LTS arm64 hvm:ebs-ssd 20250305 ami-0ae6f07ad3a8ef182 hvm
66+
variable "instance_ami" {
67+
description = "AMI for aws EC2 instance - us-east-2 Ubuntu 24.04 LTS 20250305"
68+
default = "ami-0ae6f07ad3a8ef182"
69+
}
70+
71+
72+
variable "instance_device_name" {
73+
description = "EC2 instance device name"
74+
default = "/dev/sda1"
75+
}
76+
77+
variable "redis_module" {
78+
description = "redis_module"
79+
default = "N/A"
80+
}
81+
82+
variable "instance_volume_size" {
83+
description = "EC2 instance volume_size"
84+
default = "256"
85+
}
86+
87+
variable "instance_volume_type" {
88+
description = "EC2 instance volume_type"
89+
default = "gp3"
90+
}
91+
92+
93+
variable "instance_volume_iops" {
94+
description = "EC2 instance volume_iops"
95+
default = "512"
96+
}
97+
98+
variable "client_instance_volume_size" {
99+
description = "EC2 instance volume_size"
100+
default = "128"
101+
}
102+
103+
variable "client_instance_volume_type" {
104+
description = "EC2 instance volume_type"
105+
default = "gp3"
106+
}
107+
108+
109+
variable "instance_volume_encrypted" {
110+
description = "EC2 instance instance_volume_encrypted"
111+
default = "false"
112+
}
113+
114+
variable "instance_root_block_device_encrypted" {
115+
description = "EC2 instance instance_root_block_device_encrypted"
116+
default = "false"
117+
}
118+
119+
variable "instance_cpu_threads_per_core" {
120+
description = "CPU threads per core for aws EC2 instance"
121+
default = 1
122+
}
123+
124+
variable "instance_cpu_threads_per_core_hyperthreading" {
125+
description = "CPU threads per core when hyperthreading is enabled for aws EC2 instance"
126+
default = 2
127+
}
128+
129+
variable "instance_network_interface_plus_count" {
130+
description = "number of additional network interfaces to add to aws EC2 instance"
131+
default = 0
132+
}
133+
134+
variable "os" {
135+
description = "os"
136+
default = "ubuntu24.04"
137+
}
138+
139+
variable "ssh_user" {
140+
description = "ssh_user"
141+
default = "ubuntu"
142+
}
143+
144+
################################################################################
145+
# Specific DB machine variables
146+
################################################################################
147+
variable "server_instance_type" {
148+
description = "type for aws EC2 instance"
149+
default = "m7g.8xlarge"
150+
}
151+
152+
variable "server_instance_count" {
153+
description = "count of aws EC2 instances"
154+
default = 1
155+
}
156+
157+
variable "server_instance_cpu_core_count" {
158+
description = "CPU core count for aws EC2 instance"
159+
default = 16
160+
}

0 commit comments

Comments
 (0)