downsize devnet rpc (#724)

Co-authored-by: Name <benjamin202410@gmail.com>
This commit is contained in:
benjamin202410 2024-10-31 22:43:07 -07:00 committed by GitHub
parent a3bd485bd6
commit 338fb86bcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 7 additions and 48 deletions

View file

@ -2,7 +2,6 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.13.1"
}
}
}

View file

@ -2,7 +2,6 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.13.1"
}
}
}

View file

@ -1,4 +1,3 @@
# Bucket need to be created first. If first time run terraform init, need to comment out the below section
terraform {
backend "s3" {
bucket = "tf-xinfin-bucket" // This name need to be updated to be the same as local.s3BucketName. We can't use variable here.

View file

@ -5,15 +5,6 @@ variable docker_tag {
}
locals {
/**
Load the nodes data from s3
Below is the the format the config needs to follow:
{{Name of the node, in a pattern of 'xdc'+ number. i.e xdc50}}: {
pk: {{Value of the node private key}},
... any other configuration we want to pass.
}
Note: No `n` is allowed in the node name
**/
predefinedNodesConfig = jsondecode(data.aws_s3_object.devnet_xdc_node_config.body)
envs = { for tuple in regexall("(.*)=(.*)", file(".env")) : tuple[0] => tuple[1] }
logLevel = local.envs["log_level"]
@ -37,12 +28,12 @@ locals {
]
keyNames = {
for r in local.regions :
for r in local.regions :
r.name => [for i in range(r.start, r.end+1) : "xdc${i}"]
}
devnetNodeKeys = {
for r in local.regions :
for r in local.regions :
r.name => { for i in local.keyNames[r.name]: i => local.predefinedNodesConfig[i] }
}
}

View file

@ -12,8 +12,6 @@ provider "aws" {
region = "us-east-1"
}
# WARNING: APSE-1 will only be used to host rpc node
# Workaround to avoid conflicts with existing ecs cluster in existing regions
provider "aws" {
alias = "ap-southeast-1"
region = "ap-southeast-1"
@ -25,9 +23,9 @@ module "devnet_rpc" {
vpc_id = local.vpc_id
aws_subnet_id = local.aws_subnet_id
ami_id = local.ami_id
instance_type = "t3.xlarge"
instance_type = "t3.large"
ssh_key_name = local.ssh_key_name
rpc_image = local.rpc_image
rpc_image = local.rpc_image
volume_size = 1500
providers = {
@ -43,7 +41,7 @@ module "testnet_rpc" {
ami_id = local.ami_id
instance_type = "t3.large"
ssh_key_name = local.ssh_key_name
rpc_image = local.rpc_image
rpc_image = local.rpc_image
volume_size = 1500
providers = {
@ -59,7 +57,7 @@ module "mainnet_rpc" {
ami_id = local.ami_id
instance_type = "t3.large"
ssh_key_name = local.ssh_key_name
rpc_image = local.rpc_image
rpc_image = local.rpc_image
volume_size = 3000
providers = {

View file

@ -1,41 +1,14 @@
locals {
/**
Load the nodes data from s3
Below is the the format the config needs to follow:
{{Name of the node, in a pattern of 'xdc'+ number. i.e xdc50}}: {
pk: {{Value of the node private key}},
... any other configuration we want to pass.
}
Note: No `n` is allowed in the node name
**/
predefinedNodesConfig = jsondecode(data.aws_s3_object.xdc_node_config.body)
envs = { for tuple in regexall("(.*)=(.*)", file(".env")) : tuple[0] => tuple[1] }
logLevel = local.envs["log_level"]
# regions = [
# {
# "name": "us-east-2", // Ohio
# "start": local.envs["us_east_2_start"],
# "end": local.envs["us_east_2_end"],
# }
# ]
# keyNames = {
# for r in local.regions :
# r.name => [for i in range(r.start, r.end+1) : "xdc${i}"]
# }
# nodeKeys = {
# for r in local.regions :
# r.name => { for i in local.keyNames[r.name]: i => local.predefinedNodesConfig[i] }
# }
rpcDevnetNodeKeys = { "devnet-rpc1": local.predefinedNodesConfig["devnet-rpc1"]} // we hardcode the rpc to a single node for now
rpcTestnetNodeKeys = { "testnet-rpc1": local.predefinedNodesConfig["testnet-rpc1"]} // we hardcode the rpc to a single node for now
rpcMainnetNodeKeys = { "mainnet-rpc1": local.predefinedNodesConfig["mainnet-rpc1"]} // we hardcode the rpc to a single node for now
}
locals { //ec2_rpc values
locals {
ami_id = "ami-097c4e1feeea169e5"
rpc_image = "xinfinorg/xdposchain:v2.2.0-beta1"
vpc_id = "vpc-20a06846"