Skip to content

Commit 25f7047

Browse files
committed
add client
1 parent 39b244d commit 25f7047

5 files changed

Lines changed: 100 additions & 6 deletions

File tree

deployments/aws/client.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ resource "aws_instance" "client" {
1919
key_name = var.key_pair_name
2020
iam_instance_profile = aws_iam_instance_profile.ssm_instance_profile.name
2121
associate_public_ip_address = var.enable_public_ip
22-
22+
user_data = local.user_startup_script_client
23+
depends_on = [time_sleep.wait_for_nonrealm_nodes]
2324
lifecycle {
2425
create_before_destroy = false
2526
ignore_changes = [
@@ -43,6 +44,7 @@ resource "aws_instance" "client" {
4344
tags = {
4445
Name = "${var.infinia_deployment_name}-cn-${format("%02d", count.index)}"
4546
Deployment = var.infinia_deployment_name
47+
Role = "client"
4648
}
4749
}
4850

deployments/aws/locals.tf

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,89 @@ if [ ! -f $LOG_COMPLETE ] ; then
130130
fi
131131
EOT
132132
}
133+
134+
locals {
135+
base_url = "https://storage.googleapis.com/ddn-redsetup-public/releases/ubuntu/24.04"
136+
qatest_url = "${local.base_url}/qatest"
137+
arch = "amd64"
138+
139+
user_startup_script_client = <<-EOF
140+
#!/usr/bin/env bash
141+
set -euo pipefail
142+
exec > /var/log/red-client-bootstrap.log 2>&1
143+
export DEBIAN_FRONTEND=noninteractive
144+
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
145+
146+
apt-get update -y
147+
apt-get install -y wget curl golang-go ca-certificates unzip
148+
install -d -m 0755 /usr/local/bin
149+
150+
TMP=/tmp/red-client-install
151+
mkdir -p "$TMP"
152+
153+
RED_VERSION="${var.infinia_version}"
154+
ARCH="${local.arch}"
155+
BASE_URL="${local.base_url}"
156+
QATEST_URL="${local.qatest_url}"
157+
158+
# --- Install the .deb packages (with retry) ---
159+
for pkg in red-client-common red-client-tools redcli; do
160+
URL="$BASE_URL/$${pkg}_$${RED_VERSION}_$${ARCH}.deb"
161+
DEST="$TMP/$${pkg}_$${RED_VERSION}_$${ARCH}.deb"
162+
ok_pkg=0
163+
for i in $(seq 1 3); do
164+
if curl -fL "$URL" -o "$DEST"; then ok_pkg=1; break; fi
165+
echo "Retry $i fetching $URL ..." >&2
166+
sleep 5
167+
done
168+
[ "$ok_pkg" -eq 1 ] || { echo "Failed to download $pkg" >&2; exit 1; }
169+
apt-get install -y "$DEST" || apt-get -f install -y
170+
done
171+
172+
# --- Install go-s3-tests (binary) (with retry) ---
173+
ok_gos3=0
174+
for i in $(seq 1 3); do
175+
if curl -fL "$QATEST_URL/go-s3-tests" -o /usr/local/bin/go-s3-tests; then
176+
chmod 0755 /usr/local/bin/go-s3-tests
177+
ok_gos3=1
178+
break
179+
fi
180+
echo "Retry $i fetching go-s3-tests ..." >&2
181+
sleep 5
182+
done
183+
[ "$ok_gos3" -eq 1 ] || { echo "Failed to install go-s3-tests" >&2; exit 1; }
184+
185+
# --- Install AWS CLI v2 (arch-aware) ---
186+
AWS_TMP=/tmp/awscli
187+
mkdir -p "$AWS_TMP"
188+
case "$(dpkg --print-architecture)" in
189+
amd64) AWSCLI_ZIP="awscli-exe-linux-x86_64.zip" ;;
190+
arm64) AWSCLI_ZIP="awscli-exe-linux-aarch64.zip" ;;
191+
*) AWSCLI_ZIP="awscli-exe-linux-x86_64.zip" ;;
192+
esac
193+
ok_aws=0
194+
for i in $(seq 1 3); do
195+
if curl -fL "https://awscli.amazonaws.com/$AWSCLI_ZIP" -o "$AWS_TMP/awscliv2.zip"; then
196+
ok_aws=1
197+
break
198+
fi
199+
echo "Retry $i fetching AWS CLI ..." >&2
200+
sleep 5
201+
done
202+
[ "$ok_aws" -eq 1 ] || { echo "Failed to download AWS CLI" >&2; exit 1; }
203+
unzip -o "$AWS_TMP/awscliv2.zip" -d "$AWS_TMP"
204+
"$AWS_TMP/aws/install" --update
205+
command -v aws >/dev/null || { echo "AWS CLI not found after install" >&2; exit 1; }
206+
207+
# --- Final verification ---
208+
for b in redcli warp-ddn go-s3-tests aws; do
209+
if ! command -v "$b" >/dev/null; then
210+
echo "ERROR: $b not installed or not on PATH" >&2
211+
exit 1
212+
fi
213+
done
214+
215+
rm -rf "$TMP" "$AWS_TMP"
216+
EOF
217+
}
218+

deployments/aws/main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ resource "aws_instance" "infinia_realm" {
5353

5454

5555
resource "time_sleep" "wait_for_realm_node" {
56-
create_duration = "10m"
56+
depends_on = [aws_instance.infinia_realm]
57+
create_duration = "5m"
5758
}
5859

5960

@@ -108,3 +109,7 @@ resource "aws_instance" "infinia_none_realm" {
108109
}
109110
}
110111

112+
resource "time_sleep" "wait_for_nonrealm_nodes" {
113+
depends_on = [aws_instance.infinia_none_realm]
114+
create_duration = "5m"
115+
}

deployments/aws/providers.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ provider "aws" {
44

55
terraform {
66
backend "s3" {
7-
bucket = "terraform-dev-raid"
7+
bucket = "infinia-terraform-state-471441381769"
88
key = "infinia/state.tfstate"
99
region = "us-east-1"
1010
}

deployments/aws/terraform.tfvars

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ vpc_id = "vpc-0643ea52b06790437"
33
security_group_id = "sg-0514508ec0ae982b9"
44
key_pair_name = "dev-keys"
55
infinia_ami_id = "ami-0051b37276c1aec55"
6+
client_ami_id = "ami-0360c520857e3138f"
67
subnet_ids = ["subnet-06c1a6ccde3dec102"]
78
infinia_version = "2.2.60"
89
enable_public_ip = "false"
910
root_device_size = 256
1011
num_infinia_instances = "6"
12+
num_client_instances = 1
13+
instance_type_client = "m7a.2xlarge"
1114
instance_type_infinia = "m7a.2xlarge"
1215
ebs_volume_size = 128
13-
infinia_deployment_name = "raidr"
16+
infinia_deployment_name = "infinia"
1417
bucket_name = "terraform-dev-raid"
1518
ebs_volumes_per_vm = 4
1619
use_ebs_volumes = true
1720

18-
19-

0 commit comments

Comments
 (0)