Skip to content

Commit

Permalink
add mainnet subql (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaMandal0rian authored Nov 6, 2024
1 parent 5458cdf commit 316ff1f
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 4 deletions.
9 changes: 9 additions & 0 deletions explorer/terraform/aws/mainnet/backend.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
terraform {
cloud {
organization = "subspace-sre"

workspaces {
name = "subql-mainnet-aws"
}
}
}
75 changes: 75 additions & 0 deletions explorer/terraform/aws/mainnet/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
module "subql" {
source = "../../../../templates/terraform/subql/base/"
path_to_scripts = "../../../../templates/terraform/subql/base/scripts"
path_to_configs = "../../../../templates/terraform/subql/base/config"
network_name = var.network_name

blue-subql-node-config = {
deployment-color = "blue"
network-name = "${var.network_name}"
domain-prefix = "subql.blue"
docker-tag = "mainnet-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-blue = var.instance_count_blue
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
environment = "production"
}

green-subql-node-config = {
deployment-color = "green"
network-name = "${var.network_name}"
domain-prefix = "subql.green"
docker-tag = "mainnet-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-green = var.instance_count_green
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
environment = "staging"
}

nova-blue-subql-node-config = {
deployment-color = "blue"
network-name = "${var.network_name}"
domain-prefix = "nova.subql.blue"
docker-tag = "mainnet-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-blue = 0 #var.instance_count_blue
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
environment = "production"
}

nova-green-subql-node-config = {
deployment-color = "green"
network-name = "${var.network_name}"
domain-prefix = "nova.subql.green"
docker-tag = "mainnet-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
instance-count-green = 0 #var.instance_count_green
disk-volume-size = var.disk_volume_size
disk-volume-type = var.disk_volume_type
environment = "staging"
}

cloudflare_api_token = var.cloudflare_api_token
cloudflare_email = var.cloudflare_email
aws_key_name = var.aws_key_name
nr_api_key = var.nr_api_key
access_key = var.access_key
secret_key = var.secret_key
vpc_id = var.vpc_id
vpc_cidr_block = var.vpc_cidr_block
public_subnet_cidrs = var.public_subnet_cidrs
postgres_password = var.postgres_password
hasura_graphql_admin_secret = var.hasura_graphql_admin_secret
hasura_graphql_jwt_secret = var.hasura_graphql_jwt_secret
}
24 changes: 24 additions & 0 deletions explorer/terraform/aws/mainnet/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
output "subql-node-blue-ipv4-addresses" {
value = module.subql.subql_blue_node_public_ip
description = "subql blue node IPv4 Addresses"
}

output "subql-node-green-ipv4-addresses" {
value = module.subql.subql_green_node_public_ip
description = "subql green node IPv4 Addresses"
}

output "nova-subql-node-blue-ipv4-addresses" {
value = module.subql.nova_subql_blue_node_public_ip
description = "Nova subql blue node IPv4 Addresses"
}

output "nova-subql-node-green-ipv4-addresses" {
value = module.subql.nova_subql_green_node_public_ip
description = "Nova subql green node IPv4 Addresses"
}

output "dns-records" {
value = module.subql.dns-records
description = "DNS records"
}
21 changes: 21 additions & 0 deletions explorer/terraform/aws/mainnet/terraform.tfvars.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AWS access key used to create infrastructure
access_key = ""
# AWS secret key used to create AWS infrastructure
secret_key = ""
aws_key_name = "explorer-deployer"
ssh_user = "ubuntu"
vpc_id = "explorer-mainnet-vpc"
vpc_cidr_block = "172.36.0.0/16"
public_subnet_cidrs = ["172.34.1.0/24"]
network_name = "mainnet"
instance_type = "m6a.2xlarge"
instance_count_blue = 1
instance_count_green = 1
disk_volume_size = 200
private_key_path = ""
cloudflare_email = ""
cloudflare_api_token = ""
nr_api_key = ""
postgres_password = ""
hasura_graphql_admin_secret = ""
hasura_graphql_jwt_secret= ""
112 changes: 112 additions & 0 deletions explorer/terraform/aws/mainnet/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
variable "node_tag" {
type = string
}

variable "nr_api_key" {
description = "New relic API Key"
type = string
}

variable "cloudflare_email" {
type = string
description = "cloudflare email address"
}

variable "cloudflare_api_token" {
type = string
description = "cloudflare api token"
}

variable "network_name" {
description = "Network name"
type = string
default = "mainnet"
}

variable "instance_type" {
type = string
}

variable "vpc_id" {
default = "explorer-mainnet-vpc"
type = string
}

variable "vpc_cidr_block" {
type = string
}

variable "azs" {
type = list(string)
description = "Availability Zones"
default = ["us-east-2b"]
}

variable "instance_count_blue" {
type = number
}

variable "instance_count_green" {
type = number
}

variable "aws_region" {
description = "aws region"
type = list(string)
default = ["us-east-2"]
}

variable "public_subnet_cidrs" {
type = list(string)
description = "Public Subnet CIDR values"
}

variable "secret_key" {
type = string
sensitive = true
}

variable "access_key" {
type = string
sensitive = true
}

variable "aws_key_name" {
default = "explorer-deployer"
type = string
}

variable "ssh_user" {
default = "ubuntu"
type = string
}

variable "private_key_path" {
type = string
default = "~/.ssh/explorer-deployer.pem"
}

variable "disk_volume_size" {
type = number
default = 200
}

variable "disk_volume_type" {
type = string
default = "gp3"
}

variable "postgres_password" {
sensitive = true
type = string
}

variable "hasura_graphql_admin_secret" {
sensitive = true
type = string
}

variable "hasura_graphql_jwt_secret" {
sensitive = true
type = string
}
8 changes: 4 additions & 4 deletions explorer/terraform/aws/taurus/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module "subql" {
deployment-color = "blue"
network-name = "${var.network_name}"
domain-prefix = "subql.blue"
docker-tag = "taurus-2024-oct-30"
docker-tag = "taurus-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
Expand All @@ -22,7 +22,7 @@ module "subql" {
deployment-color = "green"
network-name = "${var.network_name}"
domain-prefix = "subql.green"
docker-tag = "taurus-2024-oct-30"
docker-tag = "taurus-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
Expand All @@ -36,7 +36,7 @@ module "subql" {
deployment-color = "blue"
network-name = "${var.network_name}"
domain-prefix = "nova.subql.blue"
docker-tag = "taurus-2024-oct-30"
docker-tag = "taurus-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
Expand All @@ -50,7 +50,7 @@ module "subql" {
deployment-color = "green"
network-name = "${var.network_name}"
domain-prefix = "nova.subql.green"
docker-tag = "taurus-2024-oct-30"
docker-tag = "taurus-2024-nov-05"
instance-type = var.instance_type
deployment-version = 0
regions = var.aws_region
Expand Down

0 comments on commit 316ff1f

Please sign in to comment.