Skip to content

Commit

Permalink
add dedicated consensus RPC and Nova RPC for squids (#326)
Browse files Browse the repository at this point in the history
* add rpc and nova squids infra terraform

* change prefix

* remove relayer ids
  • Loading branch information
DaMandal0rian authored Jul 30, 2024
1 parent 4eaab1e commit 0c87d88
Show file tree
Hide file tree
Showing 16 changed files with 415 additions and 208 deletions.
6 changes: 3 additions & 3 deletions resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Clone the repository and navigate to the testing framework directory **resources
│ ├── dns.tf
│ ├── domain_node_provisioner.tf
│ ├── farmer_node_provisioner.tf
│ ├── full_node_provisioner.tf
│ ├── rpc-squid_node_provisioner.tf
│ ├── instances.tf
│ ├── network.tf
│ ├── outputs.tf
Expand All @@ -64,7 +64,7 @@ Clone the repository and navigate to the testing framework directory **resources
│ │ ├── create_bootstrap_node_evm_compose_file.sh
│ │ ├── create_domain_node_compose_file.sh
│ │ ├── create_farmer_node_compose_file.sh
│ │ ├── create_full_node_compose_file.sh
│ │ ├── create_rpc-squid_node_compose_file.sh
│ │ ├── create_rpc_node_compose_file.sh
│ │ ├── installer.sh
│ │ └── prune_docker_system.sh
Expand Down Expand Up @@ -97,7 +97,7 @@ Each network will need it's own keys, which you can gather from bitwarden, and e
├── domain_node_keys.txt
├── dsn_bootstrap_node_keys.txt
├── farmer_node_keys.txt
├── full_node_keys.txt
├── rpc-squid_node_keys.txt
├── keystore
├── relayer_ids.txt
└── rpc_node_keys.txt
Expand Down
25 changes: 22 additions & 3 deletions resources/gemini-3h/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,39 @@ module "gemini-3h" {
disk-volume-type = var.disk_volume_type
}

full-node-config = {
instance-type = var.instance_type["full"]
rpc-squid-node-config = {
instance-type = var.instance_type["rpc-squid"]
deployment-version = 0
regions = var.aws_region
instance-count = var.instance_count["full"]
instance-count = var.instance_count["rpc-squid"]
docker-org = "subspace"
docker-tag = "gemini-3h-2024-jul-16"
domain-prefix = "rpc-squid"
reserved-only = false
prune = false
node-dsn-port = 30433
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
}

nova-squid-node-config = {
instance-type = var.instance_type["nova-squid"]
deployment-version = 0
regions = var.aws_region
instance-count = var.instance_count["nova-squid"]
docker-org = "subspace"
docker-tag = "gemini-3h-2024-jul-16"
domain-prefix = "nova-squid"
reserved-only = false
prune = false
node-dsn-port = 30433
enable-domains = true
domain-id = var.domain_id
domain-labels = var.domain_labels
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
}

rpc-node-config = {
instance-type = var.instance_type["rpc"]
deployment-version = 0
Expand Down
11 changes: 8 additions & 3 deletions resources/gemini-3h/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
//output
output "full-node-ipv4-addresses" {
value = module.gemini-3h.full_node_public_ip
description = "Full node IPv4 Addresses"
output "rpc-squid-node-ipv4-addresses" {
value = module.gemini-3h.rpc-squid_node_public_ip
description = "RPC squid node IPv4 Addresses"
}

output "nova-squid-node-ipv4-addresses" {
value = module.gemini-3h.nova-squid_node_public_ip
description = "Nova Squid node IPv4 Addresses"
}

output "farmer-node-ipv4-addresses" {
Expand Down
6 changes: 4 additions & 2 deletions resources/gemini-3h/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ variable "instance_type" {
bootstrap = "c7a.4xlarge"
rpc = "m6a.xlarge"
domain = "m6a.xlarge"
full = "c7a.2xlarge"
rpc-squid = "c7a.2xlarge"
nova-squid = "c7a.2xlarge"
farmer = "c7a.2xlarge"
evm_bootstrap = "c7a.xlarge"
}
Expand All @@ -56,7 +57,8 @@ variable "instance_count" {
bootstrap = 2
rpc = 2
domain = 2
full = 1
rpc-squid = 1
nova-squid = 1
farmer = 0
evm_bootstrap = 1
}
Expand Down
2 changes: 1 addition & 1 deletion templates/scripts/create_domain_node_compose_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
NRIA_LICENSE_KEY: "\${NR_API_KEY}"
NRIA_DISPLAY_NAME: "\${NETWORK_NAME}-domain-node-\${NODE_ID}"
NRIA_DISPLAY_NAME: "\${NETWORK_NAME}-\${DOMAIN_PREFIX}-node-\${NODE_ID}"
restart: unless-stopped
# traefik reverse proxy with automatic tls management using let encrypt
Expand Down
106 changes: 0 additions & 106 deletions templates/scripts/create_full_node_compose_file.sh

This file was deleted.

2 changes: 1 addition & 1 deletion templates/scripts/create_rpc_node_compose_file.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ services:
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
NRIA_LICENSE_KEY: "\${NR_API_KEY}"
NRIA_DISPLAY_NAME: "\${NETWORK_NAME}-rpc-node-\${NODE_ID}"
NRIA_DISPLAY_NAME: "\${NETWORK_NAME}-\${DOMAIN_PREFIX}-node-\${NODE_ID}"
restart: unless-stopped
# traefik reverse proxy with automatic tls management using let encrypt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,6 @@ resource "null_resource" "start-bootstrap-nodes-evm" {
destination = "/home/${var.ssh_user}/subspace/dsn_bootstrap_node_keys.txt"
}

# copy relayer ids
provisioner "file" {
source = "./relayer_ids.txt"
destination = "/home/${var.ssh_user}/subspace/relayer_ids.txt"
}

# copy compose file creation script
provisioner "file" {
source = "${var.path_to_scripts}/create_bootstrap_node_evm_compose_file.sh"
Expand All @@ -155,8 +149,6 @@ resource "null_resource" "start-bootstrap-nodes-evm" {
"echo NODE_KEY=$(sed -nr 's/NODE_${count.index}_KEY=//p' /home/${var.ssh_user}/subspace/node_keys.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_LABEL=${var.domain-node-config.domain-labels[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_ID=${var.domain-node-config.domain-id[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo RELAYER_SYSTEM_ID=$(sed -nr 's/NODE_${count.index}_RELAYER_SYSTEM_ID=//p' /home/${var.ssh_user}/subspace/relayer_ids.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo RELAYER_DOMAIN_ID=$(sed -nr 's/NODE_${count.index}_RELAYER_DOMAIN_ID=//p' /home/${var.ssh_user}/subspace/relayer_ids.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo NR_API_KEY=${var.nr_api_key} >> /home/${var.ssh_user}/subspace/.env",
"echo PIECE_CACHE_SIZE=${var.piece_cache_size} >> /home/${var.ssh_user}/subspace/.env",
"echo DSN_NODE_ID=${count.index} >> /home/${var.ssh_user}/subspace/.env",
Expand Down
27 changes: 9 additions & 18 deletions templates/terraform/network-primitives/dns.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,20 @@ resource "cloudflare_record" "rpc" {
type = "A"
}

# Remove system domain
# resource "cloudflare_record" "system-domain" {
# count = length(local.domain_node_ip_v4)
# zone_id = data.cloudflare_zone.cloudflare_zone.id
# name = "${var.domain-node-config.domain-prefix}-${count.index}.system.${var.network_name}"
# value = local.domain_node_ip_v4[count.index]
# type = "A"
# }

resource "cloudflare_record" "core-domain" {
count = length(local.domain_nodes_ip_v4)
resource "cloudflare_record" "rpc-squid" {
count = length(local.rpc_squid_nodes_ip_v4)
zone_id = data.cloudflare_zone.cloudflare_zone.id
name = "${var.domain-node-config.domain-prefix}.${var.network_name}"
value = local.domain_nodes_ip_v4[count.index]
name = "${var.rpc-squid-node-config.domain-prefix}-${count.index}.${var.network_name}"
value = local.rpc_squid_nodes_ip_v4[count.index]
type = "A"
}

resource "cloudflare_record" "core-domain_ipv6" {
count = length(local.domain_nodes_ip_v4)
resource "cloudflare_record" "nova-squid-rpc" {
count = length(local.nova_squid_nodes_ip_v4)
zone_id = data.cloudflare_zone.cloudflare_zone.id
name = "${var.domain-node-config.domain-prefix}.${var.network_name}"
value = local.domain_nodes_ip_v6[count.index]
type = "AAAA"
name = "${var.nova-squid-node-config.domain-prefix}-${count.index}.${var.network_name}"
value = local.nova_squid_nodes_ip_v4[count.index]
type = "A"
}

resource "cloudflare_record" "nova" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,6 @@ resource "null_resource" "start-domain-nodes" {
destination = "/home/${var.ssh_user}/subspace/keystore/"
}

# copy relayer ids
provisioner "file" {
source = "./relayer_ids.txt"
destination = "/home/${var.ssh_user}/subspace/relayer_ids.txt"
}

# copy compose file creation script
provisioner "file" {
source = "${var.path_to_scripts}/create_domain_node_compose_file.sh"
Expand All @@ -176,8 +170,6 @@ resource "null_resource" "start-domain-nodes" {
"echo DOMAIN_ID=${var.domain-node-config.domain-id[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo NODE_ID=${count.index} >> /home/${var.ssh_user}/subspace/.env",
"echo NODE_KEY=$(sed -nr 's/NODE_${count.index}_KEY=//p' /home/${var.ssh_user}/subspace/node_keys.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo RELAYER_SYSTEM_ID=$(sed -nr 's/NODE_${count.index}_RELAYER_SYSTEM_ID=//p' /home/${var.ssh_user}/subspace/relayer_ids.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo RELAYER_DOMAIN_ID=$(sed -nr 's/NODE_${count.index}_RELAYER_DOMAIN_ID=//p' /home/${var.ssh_user}/subspace/relayer_ids.txt) >> /home/${var.ssh_user}/subspace/.env",
"echo NR_API_KEY=${var.nr_api_key} >> /home/${var.ssh_user}/subspace/.env",
"echo PIECE_CACHE_SIZE=${var.piece_cache_size} >> /home/${var.ssh_user}/subspace/.env",
"echo NODE_DSN_PORT=${var.domain-node-config.node-dsn-port} >> /home/${var.ssh_user}/subspace/.env",
Expand Down
Loading

0 comments on commit 0c87d88

Please sign in to comment.