Skip to content

Commit ae15f90

Browse files
committed
update for qdrant deployment
1 parent 7269b43 commit ae15f90

8 files changed

+146
-101
lines changed

bootstrap-cluster.sh

+20-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
KEY="$HOME/.ssh/simplyblock-ohio.pem"
3+
KEY="~/.ssh/simplyblock-qdrant.pem"
44

55
print_help() {
66
echo "Usage: $0 [options]"
@@ -35,7 +35,6 @@ SPDK_IMAGE=""
3535
CONTACT_POINT=""
3636
SPDK_DEBUG="false"
3737

38-
3938
while [[ $# -gt 0 ]]; do
4039
arg="$1"
4140
case $arg in
@@ -101,31 +100,31 @@ while [[ $# -gt 0 ]]; do
101100
shift
102101
done
103102

104-
SECRET_VALUE=$(terraform output -raw secret_value)
103+
# SECRET_VALUE=$(terraform output -raw secret_value)
105104
KEY_NAME=$(terraform output -raw key_name)
106105
BASTION_IP=$(terraform output -raw bastion_public_ip)
107106
GRAFANA_ENDPOINT=$(terraform output -raw grafana_invoke_url)
108107

109108
ssh_dir="$HOME/.ssh"
110109

111-
if [ ! -d "$ssh_dir" ]; then
112-
mkdir -p "$ssh_dir"
113-
echo "Directory $ssh_dir created."
114-
else
115-
echo "Directory $ssh_dir already exists."
116-
fi
117-
118-
if [[ -n "$SECRET_VALUE" ]]; then
119-
KEY="$HOME/.ssh/$KEY_NAME"
120-
if [ -f "$HOME/.ssh/$KEY_NAME" ]; then
121-
echo "the ssh key: ${KEY} already exits on local"
122-
else
123-
echo "$SECRET_VALUE" >"$KEY"
124-
chmod 400 "$KEY"
125-
fi
126-
else
127-
echo "Failed to retrieve secret value. Falling back to default key."
128-
fi
110+
# if [ ! -d "$ssh_dir" ]; then
111+
# mkdir -p "$ssh_dir"
112+
# echo "Directory $ssh_dir created."
113+
# else
114+
# echo "Directory $ssh_dir already exists."
115+
# fi
116+
117+
# if [[ -n "$SECRET_VALUE" ]]; then
118+
# KEY="$HOME/.ssh/$KEY_NAME"
119+
# if [ -f "$HOME/.ssh/$KEY_NAME" ]; then
120+
# echo "the ssh key: ${KEY} already exits on local"
121+
# else
122+
# echo "$SECRET_VALUE" >"$KEY"
123+
# chmod 400 "$KEY"
124+
# fi
125+
# else
126+
# echo "Failed to retrieve secret value. Falling back to default key."
127+
# fi
129128

130129
mnodes=$(terraform output -raw mgmt_private_ips)
131130
echo "mgmt_private_ips: ${mnodes}"
@@ -236,7 +235,6 @@ if [ "$SPDK_DEBUG" == "true" ]; then
236235
command+=" --spdk-debug"
237236
fi
238237

239-
240238
ssh -i "$KEY" -o StrictHostKeyChecking=no \
241239
-o ProxyCommand="ssh -o StrictHostKeyChecking=no -i \"$KEY\" -W %h:%p ec2-user@${BASTION_IP}" \
242240
ec2-user@${mnodes[0]} "

bootstrap-k3s.sh

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
#!/bin/bash
22

3-
KEY="$HOME/.ssh/simplyblock-ohio.pem"
4-
5-
SECRET_VALUE=$(terraform output -raw secret_value)
6-
KEY_NAME=$(terraform output -raw key_name)
7-
8-
ssh_dir="$HOME/.ssh"
9-
10-
if [ ! -d "$ssh_dir" ]; then
11-
mkdir -p "$ssh_dir"
12-
echo "Directory $ssh_dir created."
13-
else
14-
echo "Directory $ssh_dir already exists."
15-
fi
16-
17-
if [[ -n "$SECRET_VALUE" ]]; then
18-
KEY="$HOME/.ssh/$KEY_NAME"
19-
if [ -f "$HOME/.ssh/$KEY_NAME" ]; then
20-
echo "the ssh key: ${KEY} already exits on local"
21-
else
22-
echo "$SECRET_VALUE" >"$KEY"
23-
chmod 400 "$KEY"
24-
fi
25-
else
26-
echo "Failed to retrieve secret value. Falling back to default key."
27-
fi
3+
# KEY="$HOME/.ssh/simplyblock-ohio.pem"
4+
5+
# SECRET_VALUE=$(terraform output -raw secret_value)
6+
KEY="~/.ssh/simplyblock-qdrant.pem"
7+
8+
# ssh_dir="$HOME/.ssh"
9+
10+
# if [ ! -d "$ssh_dir" ]; then
11+
# mkdir -p "$ssh_dir"
12+
# echo "Directory $ssh_dir created."
13+
# else
14+
# echo "Directory $ssh_dir already exists."
15+
# fi
16+
17+
# if [[ -n "$SECRET_VALUE" ]]; then
18+
# KEY="$HOME/.ssh/$KEY_NAME"
19+
# if [ -f "$HOME/.ssh/$KEY_NAME" ]; then
20+
# echo "the ssh key: ${KEY} already exits on local"
21+
# else
22+
# echo "$SECRET_VALUE" >"$KEY"
23+
# chmod 400 "$KEY"
24+
# fi
25+
# else
26+
# echo "Failed to retrieve secret value. Falling back to default key."
27+
# fi
2828

2929
mnodes=($(terraform output -raw extra_nodes_public_ips))
3030

data.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ data "aws_availability_zones" "available" {
22
state = "available"
33
}
44

5-
data "aws_secretsmanager_secret_version" "simply" {
6-
secret_id = local.selected_key_name
7-
}
5+
# data "aws_secretsmanager_secret_version" "simply" {
6+
# secret_id = local.selected_key_name
7+
# }

locals.tf

+21-18
Original file line numberDiff line numberDiff line change
@@ -11,32 +11,35 @@ locals {
1111
} }
1212

1313
key_name = {
14-
"us-east-1" = "simplyblock-us-east-1.pem"
15-
"us-east-2" = "simplyblock-us-east-2.pem"
16-
"eu-north-1" = "simplyblock-eu-north-1.pem"
17-
"eu-west-1" = "simplyblock-eu-west-1.pem"
14+
"us-east-1" = "simplyblock-us-east-1.pem"
15+
"us-east-2" = "simplyblock-us-east-2.pem"
16+
"eu-north-1" = "simplyblock-eu-north-1.pem"
17+
"eu-west-1" = "simplyblock-eu-west-1.pem"
18+
"eu-central-1" = "simplyblock-qdrant"
1819
}
1920

2021
selected_key_name = try(local.key_name[var.region], "simplyblock-us-east-2.pem")
2122

22-
# Images are generated from this image builder:
23-
# https://us-east-2.console.aws.amazon.com/imagebuilder/home?region=us-east-2#/pipelines/arn:aws:imagebuilder:us-east-2:565979732541:image-pipeline/tst
24-
#
25-
# it is basically rhel9 + the following lines:
26-
# $sudo yum update -y
27-
# $sudo yum install -y yum-utils xorg-x11-xauth nvme-cli fio
23+
# Images are generated from this image builder:
24+
# https://us-east-2.console.aws.amazon.com/imagebuilder/home?region=us-east-2#/pipelines/arn:aws:imagebuilder:us-east-2:565979732541:image-pipeline/tst
25+
#
26+
# it is basically rhel9 + the following lines:
27+
# $sudo yum update -y
28+
# $sudo yum install -y yum-utils xorg-x11-xauth nvme-cli fio
2829
region_ami_map = {
29-
"us-east-1" = "ami-0d647905a963bb139"
30-
"us-east-2" = "ami-00ff94d69b3ced2aa"
31-
"eu-north-1" = "ami-0f8c92340db698d74"
32-
"eu-west-1" = "ami-02a1fc058c85a41dd"
30+
"us-east-1" = "ami-0d647905a963bb139"
31+
"us-east-2" = "ami-00ff94d69b3ced2aa"
32+
"eu-north-1" = "ami-0f8c92340db698d74"
33+
"eu-west-1" = "ami-02a1fc058c85a41dd"
34+
"eu-central-1" = "ami-0134dde2b68fe1b07"
3335
}
3436

3537
region_ami_map_arm = {
36-
"us-east-1" = "ami-07472131ec292b5da"
37-
"us-east-2" = "ami-08f9f3bb075432791"
38-
"eu-north-1" = "ami-096f8d910bbf871bc"
39-
"eu-west-1" = "ami-02b8573b23fde21aa"
38+
"us-east-1" = "ami-07472131ec292b5da"
39+
"us-east-2" = "ami-08f9f3bb075432791"
40+
"eu-north-1" = "ami-096f8d910bbf871bc"
41+
"eu-west-1" = "ami-02b8573b23fde21aa"
42+
"eu-central-1" = "ami-02212921a6e889ed6"
4043
}
4144

4245
ami_map = {

main.tf

+47-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module "vpc" {
33
source = "terraform-aws-modules/vpc/aws"
44

55
name = "${terraform.workspace}-storage-vpc-sb"
6-
cidr = "10.0.0.0/16"
6+
cidr = "10.245.16.0/21"
77

88
azs = [data.aws_availability_zones.available.names[0], data.aws_availability_zones.available.names[1], ]
9-
private_subnets = ["10.0.1.0/24", "10.0.3.0/24"]
10-
public_subnets = ["10.0.2.0/24", "10.0.4.0/24"]
9+
private_subnets = ["10.245.16.0/23", "10.245.18.0/23"]
10+
public_subnets = ["10.245.20.0/25", "10.245.20.128/25"]
1111
map_public_ip_on_launch = true
1212

1313
enable_nat_gateway = true
@@ -29,6 +29,34 @@ module "vpc" {
2929
}
3030
}
3131

32+
resource "aws_route" "route_account_a_to_b0" {
33+
destination_cidr_block = "10.0.0.0/16"
34+
vpc_peering_connection_id = "pcx-016667cb611b23b1f"
35+
for_each = toset(module.vpc.private_route_table_ids)
36+
route_table_id = each.key
37+
}
38+
39+
resource "aws_route" "route_account_a_to_b1" {
40+
destination_cidr_block = "10.1.0.0/16"
41+
vpc_peering_connection_id = "pcx-016667cb611b23b1f"
42+
for_each = toset(module.vpc.private_route_table_ids)
43+
route_table_id = each.key
44+
}
45+
46+
resource "aws_route" "route_account_a_to_b2" {
47+
destination_cidr_block = "10.10.0.0/16"
48+
vpc_peering_connection_id = "pcx-016667cb611b23b1f"
49+
for_each = toset(module.vpc.private_route_table_ids)
50+
route_table_id = each.key
51+
}
52+
53+
resource "aws_route" "route_account_a_to_b3" {
54+
destination_cidr_block = "10.11.0.0/16"
55+
vpc_peering_connection_id = "pcx-016667cb611b23b1f"
56+
for_each = toset(module.vpc.private_route_table_ids)
57+
route_table_id = each.key
58+
}
59+
3260
module "apigatewayendpoint" {
3361
count = var.enable_apigateway == 1 && var.mgmt_nodes > 0 ? 1 : 0
3462
source = "./modules/apigateway"
@@ -296,6 +324,15 @@ resource "aws_security_group" "storage_nodes_sg" {
296324
description = "allow ICMP Echo"
297325
}
298326

327+
328+
ingress {
329+
protocol = "icmp"
330+
from_port = -1
331+
to_port = -1 # allow all types
332+
cidr_blocks = ["0.0.0.0/0"]
333+
description = "allow all ICMP from all"
334+
}
335+
299336
ingress {
300337
from_port = 9100
301338
to_port = 9100
@@ -631,6 +668,7 @@ resource "aws_instance" "storage_nodes" {
631668
vpc_security_group_ids = [aws_security_group.storage_nodes_sg.id]
632669
subnet_id = module.vpc.private_subnets[local.az_index]
633670
iam_instance_profile = aws_iam_instance_profile.inst_profile.name
671+
disable_api_stop = true
634672
root_block_device {
635673
volume_size = 45
636674
}
@@ -719,3 +757,9 @@ sudo sysctl -w vm.nr_hugepages=${var.nr_hugepages}
719757
cat /proc/meminfo | grep -i hug
720758
EOF
721759
}
760+
761+
762+
# creating variant in shopify: creating variant user errors in query: ,Location does not exist.: inventoryQuantities,0
763+
764+
# location doesn't exist
765+

outputs.tf

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ output "key_name" {
1818
value = local.selected_key_name
1919
}
2020

21-
output "secret_value" {
22-
sensitive = true
23-
value = data.aws_secretsmanager_secret_version.simply.secret_string
24-
}
21+
# output "secret_value" {
22+
# sensitive = true
23+
# value = data.aws_secretsmanager_secret_version.simply.secret_string
24+
# }
2525

2626
output "mgmt_node_details" {
2727
value = { for i, instance in aws_instance.mgmt_nodes :

tfengine.tf

+23-23
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ data "aws_ami" "this" {
1515
}
1616
}
1717

18-
resource "aws_autoscaling_group" "tfengine_asg" {
19-
min_size = 1
20-
max_size = 1
21-
desired_capacity = 1
22-
vpc_zone_identifier = [module.vpc.private_subnets[0]]
23-
tag {
24-
key = "Name"
25-
value = "tfengine"
26-
propagate_at_launch = true
27-
}
28-
lifecycle {
29-
create_before_destroy = true
30-
}
31-
launch_template {
32-
id = aws_launch_template.tfengine_lc.id
33-
version = "$Latest"
34-
}
35-
}
18+
# resource "aws_autoscaling_group" "tfengine_asg" {
19+
# min_size = 1
20+
# max_size = 1
21+
# desired_capacity = 1
22+
# vpc_zone_identifier = [module.vpc.private_subnets[0]]
23+
# tag {
24+
# key = "Name"
25+
# value = "tfengine"
26+
# propagate_at_launch = true
27+
# }
28+
# lifecycle {
29+
# create_before_destroy = true
30+
# }
31+
# launch_template {
32+
# id = aws_launch_template.tfengine_lc.id
33+
# version = "$Latest"
34+
# }
35+
# }
3636

3737
resource "aws_launch_template" "tfengine_lc" {
3838
name_prefix = "tfengine"
@@ -202,11 +202,11 @@ resource "aws_iam_role_policy_attachment" "AmazonSSMManagedInstanceCore" {
202202
role = aws_iam_role.tfengine.name
203203
}
204204

205-
# NOTE: Terraform uses the same role that we use to deploy the cluster to the customer's account
206-
resource "aws_iam_role_policy_attachment" "sbdeployPolicy" {
207-
policy_arn = "arn:aws:iam::${local.account_id}:policy/sbdeployPolicy"
208-
role = aws_iam_role.tfengine.name
209-
}
205+
# # NOTE: Terraform uses the same role that we use to deploy the cluster to the customer's account
206+
# resource "aws_iam_role_policy_attachment" "sbdeployPolicy" {
207+
# policy_arn = "arn:aws:iam::${local.account_id}:policy/sbdeployPolicy"
208+
# role = aws_iam_role.tfengine.name
209+
# }
210210

211211
# attach policy
212212
resource "aws_iam_role_policy_attachment" "s3policy" {

variables.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variable "region" {
2-
default = "us-east-2"
2+
default = "eu-central-1"
33
description = "region to provision"
44
type = string
55
validation {
@@ -11,11 +11,11 @@ variable "region" {
1111
variable "az" {
1212
description = "availability zone to provision"
1313
type = string
14-
default = "us-east-2b"
14+
default = "eu-central-1a"
1515
}
1616

1717
variable "env" {
18-
default = "dev"
18+
default = "staging"
1919
type = string
2020
}
2121

0 commit comments

Comments
 (0)