Skip to content

Commit

Permalink
extend auto domain testing framework AWS
Browse files Browse the repository at this point in the history
  • Loading branch information
DaMandal0rian committed May 7, 2024
1 parent 9d5caae commit f37f545
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 17 deletions.
8 changes: 4 additions & 4 deletions testing-framework/ec2/base/bootstrap_node_evm_provisioner.tf
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ resource "null_resource" "start-bootstrap-nodes-evm" {
"echo NETWORK_NAME=${var.network_name} >> /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 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 DOMAIN_LABEL_EVM=${var.domain-node-config.domain-labels[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_ID_EVM=${var.domain-node-config.domain-id[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_LABEL_AUTO=${var.domain-node-config.domain-labels[1]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_ID_AUTO=${var.domain-node-config.domain-id[1]} >> /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",
"echo DSN_NODE_KEY=$(sed -nr 's/NODE_${count.index}_DSN_KEY=//p' /home/${var.ssh_user}/subspace/node_keys.txt) >> /home/${var.ssh_user}/subspace/.env",
Expand Down
12 changes: 6 additions & 6 deletions testing-framework/ec2/base/domain_node_provisioner.tf
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ resource "null_resource" "start-domain-nodes" {
"echo REPO_ORG=${var.domain-node-config.repo-org} > /home/${var.ssh_user}/subspace/.env",
"echo DOCKER_TAG=${var.domain-node-config.docker-tag} >> /home/${var.ssh_user}/subspace/.env",
"echo NETWORK_NAME=${var.network_name} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_PREFIX=${var.domain-node-config.domain-prefix} >> /home/${var.ssh_user}/subspace/.env",
# //todo use a map for domain id and labels
"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 DOMAIN_PREFIX_EVM=${var.domain-node-config.domain-prefix[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_PREFIX_AUTO=${var.domain-node-config.domain-prefix[1]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_LABEL_EVM=${var.domain-node-config.domain-labels[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_ID_EVM=${var.domain-node-config.domain-id[0]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_LABEL_AUTO=${var.domain-node-config.domain-labels[1]} >> /home/${var.ssh_user}/subspace/.env",
"echo DOMAIN_ID_AUTO=${var.domain-node-config.domain-id[1]} >> /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 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
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,20 @@ if [ "${enable_domains}" == "true" ]; then
{
# core domain
echo ' "--",'
echo ' "--domain-id", "${DOMAIN_ID}",'
echo ' "--domain-id", "${DOMAIN_ID_EVM}",'
echo ' "--state-pruning", "archive",'
echo ' "--blocks-pruning", "archive",'
echo ' "--listen-on", "/ip4/0.0.0.0/tcp/${OPERATOR_PORT}",'
echo ' "--rpc-cors", "all",'
echo ' "--rpc-listen-on", "0.0.0.0:8944",'
for (( i = 0; i < node_count; i++ )); do
addr=$(sed -nr "s/NODE_${i}_OPERATOR_MULTI_ADDR_TCP=//p" ~/subspace/node_keys.txt)
echo " \"--reserved-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
echo " \"--bootstrap-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
done
# auto domain
echo ' "--",'
echo ' "--domain-id", "${DOMAIN_ID_AUTO}",'
echo ' "--state-pruning", "archive",'
echo ' "--blocks-pruning", "archive",'
echo ' "--listen-on", "/ip4/0.0.0.0/tcp/${OPERATOR_PORT}",'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,17 @@ services:
labels:
- "traefik.enable=true"
- "traefik.http.services.archival-node.loadbalancer.server.port=8944"
- "traefik.http.routers.archival-node.rule=Host(\`\${DOMAIN_PREFIX}.\${NETWORK_NAME}.subspace.network\`) && Path(\`/ws\`)"
- "traefik.http.routers.archival-node.rule=Host(\`\${DOMAIN_PREFIX_EVM}-\${DOMAIN_ID_EVM}.\${NETWORK_NAME}.subspace.network\`) && Path(\`/ws\`)"
- "traefik.http.routers.archival-node.tls=true"
- "traefik.http.routers.archival-node.tls.certresolver=le"
- "traefik.http.routers.archival-node.entrypoints=websecure"
- "traefik.http.routers.archival-node.middlewares=redirect-https"
- "traefik.http.routers.archival-node-auto.rule=Host(\`\${DOMAIN_PREFIX_AUTO}-\${DOMAIN_ID_AUTO}.\${NETWORK_NAME}.subspace.network\`) && Path(\`/ws\`)"
- "traefik.http.routers.archival-node-auto.tls=true"
- "traefik.http.routers.archival-node-auto.tls.certresolver=le"
- "traefik.http.routers.archival-node-auto.entrypoints=websecure"
- "traefik.http.routers.archival-node-auto.middlewares=redirect-https"
- "traefik.http.services.archival-node-auto.loadbalancer.server.port=7944"
- "traefik.http.middlewares.redirect-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.redirect-https.redirectscheme.permanent=true"
- "traefik.docker.network=traefik-proxy"
Expand Down Expand Up @@ -129,7 +135,7 @@ if [ "${enable_domains}" == "true" ]; then
{
# core domain
echo ' "--",'
echo ' "--domain-id", "${DOMAIN_ID}",'
echo ' "--domain-id", "${DOMAIN_ID_EVM}",'
echo ' "--state-pruning", "archive",'
echo ' "--blocks-pruning", "archive",'
echo ' "--operator-id", "0",'
Expand All @@ -144,6 +150,23 @@ if [ "${enable_domains}" == "true" ]; then
echo " \"--reserved-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
echo " \"--bootstrap-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
done
# auto domain
echo ' "--",'
echo ' "--domain-id", "${DOMAIN_ID_AUTO}",'
echo ' "--state-pruning", "archive",'
echo ' "--blocks-pruning", "archive",'
echo ' "--operator-id", "0",'
echo ' "--listen-on", "/ip4/0.0.0.0/tcp/30334",'
echo ' "--listen-on", "/ip6/::/tcp/30334",'
echo ' "--rpc-cors", "all",'
echo ' "--rpc-methods", "safe",'
echo ' "--rpc-listen-on", "0.0.0.0:7944",'

for (( i = 0; i < bootstrap_node_evm_count; i++ )); do
addr=$(sed -nr "s/NODE_${i}_MULTI_ADDR_TCP=//p" ~/subspace/bootstrap_node_evm_keys.txt)
echo " \"--reserved-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
echo " \"--bootstrap-nodes\", \"${addr}\"," >> ~/subspace/subspace/docker-compose.yml
done

} >> ~/subspace/subspace/docker-compose.yml
fi
Expand Down
2 changes: 1 addition & 1 deletion testing-framework/ec2/base/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ variable "domain-node-config" {
instance-count = number
repo-org = string
docker-tag = string
domain-prefix = string
domain-prefix = list(string)
reserved-only = bool
prune = bool
node-dsn-port = number
Expand Down
2 changes: 1 addition & 1 deletion testing-framework/ec2/network/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ module "network" {
instance-count = var.instance_count["domain"]
repo-org = "subspace"
docker-tag = var.branch_name
domain-prefix = "domain"
domain-prefix = ["nova", "auto"]
reserved-only = false
prune = false
node-dsn-port = 30433
Expand Down
4 changes: 2 additions & 2 deletions testing-framework/ec2/network/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ variable "farmer_reward_address" {
variable "domain_id" {
description = "Domain ID"
type = list(number)
default = [0]
default = [0, 1]
}

//todo change this to a map
variable "domain_labels" {
description = "Tag of the domain to run"
type = list(string)
default = ["evm"]
default = ["nova", "auto"]
}

variable "instance_type" {
Expand Down

0 comments on commit f37f545

Please sign in to comment.