diff --git a/bootstrap/instance/node.tf b/bootstrap/instance/node.tf index 878585f..0a88455 100644 --- a/bootstrap/instance/node.tf +++ b/bootstrap/instance/node.tf @@ -22,6 +22,8 @@ locals { "3000" ] arguments = var.is_custom == true ? local.custom_arguments : local.default_arguments + + n2n_port_name = contains(["mainnet", "preview", "preprod"], var.network) && var.release == "stable" ? "n2n-${var.network}" : "n2n" } @@ -177,7 +179,7 @@ resource "kubernetes_stateful_set_v1" "node" { } port { - name = "n2n" + name = local.n2n_port_name container_port = 3000 } diff --git a/bootstrap/main.tf b/bootstrap/main.tf index 74ad733..ca9b409 100644 --- a/bootstrap/main.tf +++ b/bootstrap/main.tf @@ -105,3 +105,9 @@ module "services" { release = each.value.release active_salt = each.value.active_salt } + +module "node_relay" { + depends_on = [kubernetes_namespace.namespace] + source = "./relay" + namespace = var.namespace +} \ No newline at end of file diff --git a/bootstrap/proxy/config.tf b/bootstrap/proxy/config.tf index 72f5843..4e86618 100644 --- a/bootstrap/proxy/config.tf +++ b/bootstrap/proxy/config.tf @@ -11,8 +11,8 @@ locals { "max_connections" = 1 "rates" = [ { - "interval" = "1s", - "limit" = 1024 * 1024 + "interval" = "1m", + "limit" = 1024 * 1024 * 60 } ] }, @@ -21,8 +21,8 @@ locals { "max_connections" = 5 "rates" = [ { - "interval" = "1s", - "limit" = 1024 * 1024 + "interval" = "1m", + "limit" = 1024 * 1024 * 60 * 2 } ] }, @@ -31,8 +31,8 @@ locals { "max_connections" = 25 "rates" = [ { - "interval" = "1s", - "limit" = 1024 * 1024 + "interval" = "1m", + "limit" = 1024 * 1024 * 60 * 2 } ] }, @@ -40,9 +40,9 @@ locals { "name" = "3", "max_connections" = 75 "rates" = [ - { - "interval" = "1s", - "limit" = 1024 * 1024 + { + "interval" = "1m", + "limit" = 1024 * 1024 * 60 * 2 } ] } diff --git a/bootstrap/relay/main.tf b/bootstrap/relay/main.tf new file mode 100644 index 0000000..997ffee --- /dev/null +++ b/bootstrap/relay/main.tf @@ -0,0 +1,50 @@ +variable "namespace" { + description = "the namespace where the resources will be created" +} + +resource "kubernetes_service_v1" "node-relay-n2n" { + metadata { + name = "node-relay-n2n" + namespace = var.namespace + annotations = { + "service.beta.kubernetes.io/aws-load-balancer-nlb-target-type" : "instance" + "service.beta.kubernetes.io/aws-load-balancer-scheme" : "internet-facing" + "service.beta.kubernetes.io/aws-load-balancer-type" : "external" + } + } + + spec { + type = "LoadBalancer" + load_balancer_class = "service.k8s.aws/nlb" + + selector = { + "role" = "node" + "release" = "stable" + } + + port { + name = "mainnet" + protocol = "TCP" + port = 3000 + target_port = "n2n-mainnet" + } + + port { + name = "preprod" + protocol = "TCP" + port = 3001 + target_port = "n2n-preprod" + } + + port { + name = "preview" + protocol = "TCP" + port = 3002 + target_port = "n2n-preview" + } + + + + + } +}