Skip to content

Commit

Permalink
add auto domain to infra PT.1 (#311)
Browse files Browse the repository at this point in the history
* add auto domain to infra

add auto

add DNS records

minor fixes domain label and ID

add operator ID

decouple 2 separate domains for evm and autoid

add more changes to domains

Fix

Fix traefik labels and remove auto extra chains in configs

fix merge conflict

* bump traefik release

* fix more references

* remove relayer ids
  • Loading branch information
DaMandal0rian authored Aug 27, 2024
1 parent de91cbe commit c190aac
Show file tree
Hide file tree
Showing 20 changed files with 1,082 additions and 33 deletions.
37 changes: 36 additions & 1 deletion resources/devnet/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ module "devnet" {
disk-volume-type = var.disk_volume_type
}

bootstrap-node-autoid-config = {
instance-type = var.instance_type["autoid_bootstrap"]
deployment-version = 1
regions = var.aws_region
instance-count = var.instance_count["autoid_bootstrap"]
docker-org = "subspace"
docker-tag = "snapshot-2024-jan-23-2"
reserved-only = false
prune = false
genesis-hash = ""
dsn-listen-port = 30533
node-dsn-port = 30433
operator-port = 30334
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
}

full-node-config = {
instance-type = var.instance_type["full"]
deployment-version = 0
Expand Down Expand Up @@ -73,7 +90,25 @@ module "devnet" {
instance-count = var.instance_count["domain"]
docker-org = "subspace"
docker-tag = "snapshot-2024-jan-23-2"
domain-prefix = "domain"
domain-prefix = ["nova"]
reserved-only = false
prune = false
node-dsn-port = 30434
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
}

autoid-node-config = {
instance-type = var.instance_type["autoid"]
deployment-version = 0
regions = var.aws_region
instance-count = var.instance_count["autoid"]
docker-org = "subspace"
docker-tag = "snapshot-2024-jan-23-2"
domain-prefix = ["autoid"]
reserved-only = false
prune = false
node-dsn-port = 30434
Expand Down
10 changes: 10 additions & 0 deletions resources/devnet/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ output "bootstrap-node-evm-ipv4-addresses" {
description = "EVM Bootstrap node IPv4 Addresses"
}

output "bootstrap-node-autoid-ipv4-addresses" {
value = module.devnet.bootstrap_node_autoid_public_ip
description = "AutoID Bootstrap node IPv4 Addresses"
}

output "rpc-node-ipv4-addresses" {
value = module.devnet.rpc_node_public_ip
description = "Domain node IPv4 Addresses"
Expand All @@ -28,3 +33,8 @@ output "domain-node-ipv4-addresses" {
value = module.devnet.domain_node_public_ip
description = "Domain node IPv4 Addresses"
}

output "autoid-node-ipv4-addresses" {
value = module.devnet.autoid_node_public_ip
description = "AutoID node IPv4 Addresses"
}
8 changes: 6 additions & 2 deletions resources/devnet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ variable "farmer_reward_address" {
variable "domain_id" {
description = "Domain ID"
type = list(number)
default = [0]
default = [0, 1]
}

variable "domain_labels" {
description = "Tag of the domain to run"
type = list(string)
default = ["evm"]
default = ["nova", "autoid"]
}

variable "instance_type" {
Expand All @@ -21,9 +21,11 @@ variable "instance_type" {
bootstrap = "c6a.2xlarge"
rpc = "m6a.xlarge"
domain = "m6a.xlarge"
autoid = "m6a.xlarge"
full = "m6a.xlarge"
farmer = "c7i.2xlarge"
evm_bootstrap = "m6a.xlarge"
autoid_bootstrap = "m6a.xlarge"
}
}

Expand All @@ -48,9 +50,11 @@ variable "instance_count" {
bootstrap = 2
rpc = 1
domain = 1
autoid = 1
full = 0
farmer = 1
evm_bootstrap = 1
autoid_bootstrap = 1
}
}

Expand Down
35 changes: 35 additions & 0 deletions resources/gemini-3h/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,23 @@ module "gemini-3h" {
disk-volume-type = var.disk_volume_type
}

bootstrap-node-autoid-config = {
instance-type = var.instance_type["autoid_bootstrap"]
deployment-version = 0
regions = var.aws_region
instance-count = var.instance_count["autoid_bootstrap"]
docker-org = "autonomys"
docker-tag = "gemini-3h-2024-jul-29"
reserved-only = false
prune = false
genesis-hash = "0c121c75f4ef450f40619e1fca9d1e8e7fbabc42c895bc4790801e85d5a91c34"
dsn-listen-port = 30533
node-dsn-port = 30433
operator-port = 30334
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
}

rpc-squid-node-config = {
instance-type = var.instance_type["rpc-squid"]
deployment-version = 0
Expand Down Expand Up @@ -102,6 +119,24 @@ module "gemini-3h" {
disk-volume-type = var.disk_volume_type
}

autoid-node-config = {
instance-type = var.instance_type["autoid"]
deployment-version = 0
regions = var.aws_region
instance-count = var.instance_count["autoid"]
docker-org = "subspace"
docker-tag = "gemini-3h-2024-may-06"
domain-prefix = ["autoid"]
reserved-only = false
prune = false
node-dsn-port = 30434
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
}

farmer-node-config = {
instance-type = var.instance_type["farmer"]
deployment-version = 0
Expand Down
10 changes: 10 additions & 0 deletions resources/gemini-3h/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,21 @@ output "bootstrap-node-evm-ipv4-addresses" {
description = "EVM Bootstrap node IPv4 Addresses"
}

output "bootstrap-node-autoid-ipv4-addresses" {
value = module.gemini-3h.bootstrap_node_autoid_public_ip
description = "AutoID Bootstrap node IPv4 Addresses"
}

output "domain-node-ipv4-addresses" {
value = module.gemini-3h.domain_node_public_ip
description = "Domain node IPv4 Addresses"
}

output "autoid-node-ipv4-addresses" {
value = module.gemini-3h.autoid_node_public_ip
description = "AutoID node IPv4 Addresses"
}

output "rpc-node-ipv4-addresses" {
value = module.gemini-3h.rpc_node_public_ip
description = "RPC 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 @@ -13,14 +13,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, "autoid"]
}
variable "instance_type" {
Expand All @@ -33,6 +33,7 @@ variable "instance_type" {
nova-squid = "c7a.2xlarge"
farmer = "c7a.2xlarge"
evm_bootstrap = "c7a.xlarge"
autoid_bootstrap = "c7a.xlarge"
}
}
Expand All @@ -57,6 +58,7 @@ variable "instance_count" {
bootstrap = 2
rpc = 2
domain = 2
autoid = 2
rpc-squid = 1
nova-squid = 1
farmer = 0
Expand Down
176 changes: 176 additions & 0 deletions templates/scripts/create_autoid_node_compose_file.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
#!/bin/bash

EXTERNAL_IP=`curl -s -4 https://ifconfig.me`
EXTERNAL_IP_V6=`curl -s -6 https://ifconfig.me`

cat > ~/subspace/docker-compose.yml << EOF
version: "3.7"
volumes:
archival_node_data: {}
vmagentdata: {}
networks:
traefik-proxy:
services:
vmagent:
container_name: vmagent
image: victoriametrics/vmagent:latest
depends_on:
- "archival-node"
ports:
- 8429:8429
volumes:
- vmagentdata:/vmagentdata
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
command:
- "--httpListenAddr=0.0.0.0:8429"
- "--promscrape.config=/etc/prometheus/prometheus.yml"
- "--remoteWrite.url=http://vmetrics.subspace.network:8428/api/v1/write"
agent:
container_name: newrelic-infra
image: newrelic/infrastructure:latest
cap_add:
- SYS_PTRACE
network_mode: bridge
pid: host
privileged: true
volumes:
- "/:/host:ro"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
NRIA_LICENSE_KEY: "\${NR_API_KEY}"
NRIA_DISPLAY_NAME: "\${NETWORK_NAME}-autoid-node-\${NODE_ID}"
restart: unless-stopped
# traefik reverse proxy with automatic tls management using let encrypt
traefik:
image: traefik:v2.11.3
container_name: traefik
restart: unless-stopped
command:
- --api=false
- --api.dashboard=false
- --providers.docker
- --log.level=info
- --entrypoints.web.address=:80
- --entrypoints.web.http.redirections.entryPoint.to=websecure
- --entrypoints.websecure.address=:443
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- [email protected]
- --certificatesresolvers.le.acme.storage=/acme.json
- --certificatesresolvers.le.acme.tlschallenge=true
- "traefik.docker.network=traefik-proxy"
networks:
- traefik-proxy
ports:
- 80:80
- 443:443
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./letsencrypt/acme.json:/acme.json
archival-node:
image: ghcr.io/\${NODE_ORG}/node:\${NODE_TAG}
volumes:
- archival_node_data:/var/subspace:rw
- ./keystore:/var/subspace/keystore:ro
restart: unless-stopped
ports:
- "30333:30333/tcp"
- "30333:30333/udp"
- "30433:30433/tcp"
- "30433:30433/udp"
- "30334:30334/tcp"
- "9615:9615"
labels:
- "traefik.enable=true"
- "traefik.http.services.archival-node.loadbalancer.server.port=8944"
- "traefik.http.routers.archival-node.rule=Host(\`\${DOMAIN_PREFIX_AUTO}-\${DOMAIN_ID_AUTO}.\${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.middlewares.redirect-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.redirect-https.redirectscheme.permanent=true"
- "traefik.docker.network=traefik-proxy"
networks:
- traefik-proxy
logging:
driver: loki
options:
loki-url: "https://logging.subspace.network/loki/api/v1/push"
command: [
"run",
"--chain", "\${NETWORK_NAME}",
"--base-path", "/var/subspace",
"--state-pruning", "archive",
"--blocks-pruning", "archive",
"--pot-external-entropy", "\${POT_EXTERNAL_ENTROPY}",
"--listen-on", "/ip4/0.0.0.0/tcp/30333",
"--listen-on", "/ip6/::/tcp/30333",
"--node-key", "\${NODE_KEY}",
"--in-peers", "500",
"--out-peers", "250",
"--rpc-max-connections", "10000",
"--rpc-cors", "all",
"--rpc-listen-on", "0.0.0.0:9944",
"--rpc-methods", "safe",
"--prometheus-listen-on", "0.0.0.0:9615",
EOF

reserved_only=${1}
node_count=${2}
current_node=${3}
bootstrap_node_count=${4}
dsn_bootstrap_node_count=${4}
bootstrap_node_autoid_count=${5}
enable_domains=${6}
domain_id=${7}

for (( i = 0; i < node_count; i++ )); do
if [ "${current_node}" == "${i}" ]; then
dsn_addr=$(sed -nr "s/NODE_${i}_DSN_MULTI_ADDR=//p" ~/subspace/node_keys.txt)
echo " \"--dsn-external-address\", \"${dsn_addr}\"," >> ~/subspace/docker-compose.yml
fi
done

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

for (( i = 0; i < dsn_bootstrap_node_count; i++ )); do
dsn_addr=$(sed -nr "s/NODE_${i}_SUBSPACE_MULTI_ADDR=//p" ~/subspace/dsn_bootstrap_node_keys.txt)
echo " \"--dsn-reserved-peers\", \"${dsn_addr}\"," >> ~/subspace/docker-compose.yml
echo " \"--dsn-bootstrap-nodes\", \"${dsn_addr}\"," >> ~/subspace/docker-compose.yml
done

if [ "${reserved_only}" == "true" ]; then
echo " \"--reserved-only\"," >> ~/subspace/docker-compose.yml
fi

if [ "${enable_domains}" == "true" ]; then
{
# 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/${OPERATOR_PORT}",'
echo ' "--rpc-cors", "all",'
echo ' "--rpc-listen-on", "0.0.0.0:8944",'
for (( i = 0; i < bootstrap_node_autoid_count; i++ )); do
addr=$(sed -nr "s/NODE_${i}_MULTI_ADDR_TCP=//p" ~/subspace/bootstrap_node_autoid_keys.txt)
echo " \"--reserved-nodes\", \"${addr}\"," >> ~/subspace/docker-compose.yml
echo " \"--bootstrap-nodes\", \"${addr}\"," >> ~/subspace/docker-compose.yml
done
} >> ~/subspace/docker-compose.yml
fi

echo ' ]' >> ~/subspace/docker-compose.yml
Loading

0 comments on commit c190aac

Please sign in to comment.