diff --git a/automation/terraform/.gitignore b/automation/terraform/.gitignore deleted file mode 100644 index d5cc1d342f3..00000000000 --- a/automation/terraform/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.terraform/ -terraform.tfstate* -*gcloud-keyfile.json* \ No newline at end of file diff --git a/automation/terraform/infrastructure/main.tf b/automation/terraform/infrastructure/main.tf deleted file mode 100644 index a220333c3d6..00000000000 --- a/automation/terraform/infrastructure/main.tf +++ /dev/null @@ -1,23 +0,0 @@ -terraform { - required_version = ">= 0.12.0" - backend "s3" { - key = "terraform-coda-infra.tfstate" - encrypt = true - region = "us-west-2" - bucket = "o1labs-terraform-state" - acl = "bucket-owner-full-control" - } -} - -locals { - gcp_project = "o1labs-192920" - num_nodes_per_zone = 1 - node_type = "n1-standard-16" - - storage_reclaim_policies = [ - "Delete", - "Retain" - ] -} - -data "google_client_config" "current" {} diff --git a/automation/terraform/infrastructure/secrets.tf b/automation/terraform/infrastructure/secrets.tf deleted file mode 100644 index 36790859043..00000000000 --- a/automation/terraform/infrastructure/secrets.tf +++ /dev/null @@ -1,13 +0,0 @@ -provider aws { - region = "us-west-2" -} - -# Prometheus - -data "aws_secretsmanager_secret" "prometheus_remote_write_config" { - name = "coda-services/prometheus/remote_write_config" -} - -data "aws_secretsmanager_secret_version" "current_prometheus_remote_write_config" { - secret_id = "${data.aws_secretsmanager_secret.prometheus_remote_write_config.id}" -} diff --git a/automation/terraform/infrastructure/service-accounts.tf b/automation/terraform/infrastructure/service-accounts.tf deleted file mode 100644 index c8c459904c4..00000000000 --- a/automation/terraform/infrastructure/service-accounts.tf +++ /dev/null @@ -1,29 +0,0 @@ -locals { - gke_project = "o1labs-192920" - - janitor_roles = [ - "roles/container.developer", - "roles/container.viewer", - "roles/compute.viewer", - "roles/container.serviceAgent" - ] -} - -resource "google_service_account" "gcp_janitor_account" { - account_id = "gcp-janitor-svc" - display_name = "GCP Janitor Service" - description = "GCP janitor service account for managing resource authorization" - project = local.gke_project -} - -resource "google_project_iam_member" "janitor_iam_memberships" { - count = length(local.janitor_roles) - - project = local.gke_project - role = local.janitor_roles[count.index] - member = "serviceAccount:${google_service_account.gcp_janitor_account.email}" -} - -resource "google_service_account_key" "janitor_svc_key" { - service_account_id = google_service_account.gcp_janitor_account.name -} diff --git a/automation/terraform/infrastructure/us-central1.tf b/automation/terraform/infrastructure/us-central1.tf deleted file mode 100644 index 8b717cd633d..00000000000 --- a/automation/terraform/infrastructure/us-central1.tf +++ /dev/null @@ -1,303 +0,0 @@ -locals { - central1_region = "us-central1" - central1_k8s_context = "gke_o1labs-192920_us-central1_coda-infra-central1" - bk_central1_k8s_context = "gke_o1labs-192920_us-central1_buildkite-infra-central1" - - central1_prometheus_helm_values = { - server = { - global = { - external_labels = { - origin_prometheus = "central1-prometheus" - } - } - persistentVolume = { - size = "50Gi" - } - remoteWrite = [ - { - url = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_uri"] - basic_auth = { - username = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_username"] - password = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_password"] - } - write_relabel_configs = [ - { - source_labels : ["__name__"] - regex : "(buildkite.*|container.*|Coda.*|watchdog.*|go.*|process.*|Mina.*)" - action : "keep" - } - ] - } - ] - } - # Disable per-region instances due to grafanacloud aggregator setup - alertmanager = { - enabled = false - } - } -} - -provider "google" { - alias = "google_central1" - project = local.gcp_project - region = local.central1_region -} - -provider "kubernetes" { - alias = "k8s_central1" - config_context = local.central1_k8s_context -} - -data "google_compute_zones" "central1_available" { - project = local.gcp_project - region = local.central1_region - status = "UP" -} - -### Testnets - -resource "google_container_cluster" "coda_cluster_central1" { - provider = google.google_central1 - name = "coda-infra-central1" - location = local.central1_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.central1_available.names - - # We can't create a cluster with no node pool defined, but we want to only use - # separately managed node pools. So we create the smallest possible default - # node pool and immediately delete it. - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "central1_primary_nodes" { - provider = google.google_central1 - name = "coda-infra-central1" - location = local.central1_region - cluster = google_container_cluster.coda_cluster_central1.name - node_count = 4 - autoscaling { - min_node_count = 0 - max_node_count = 5 - } - node_config { - preemptible = false - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -resource "google_container_node_pool" "central1_preemptible_nodes" { - provider = google.google_central1 - name = "mina-preemptible-central1" - location = local.central1_region - cluster = google_container_cluster.coda_cluster_central1.name - - node_count = 5 - autoscaling { - min_node_count = 0 - max_node_count = 15 - } - node_config { - preemptible = true - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -### Buildkite - -resource "google_container_cluster" "buildkite_infra_central1" { - provider = google.google_central1 - name = "buildkite-infra-central1" - location = local.central1_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.central1_available.names - - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "central1_compute_nodes" { - provider = google.google_central1 - name = "buildkite-central1-compute" - location = local.central1_region - cluster = google_container_cluster.buildkite_infra_central1.name - - # total nodes provisioned = node_count * # of AZs - node_count = 1 - autoscaling { - min_node_count = 1 - max_node_count = 10 - } - node_config { - preemptible = true - machine_type = "c2-standard-16" - disk_size_gb = 500 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/cloud-platform" - ] - } -} - -## Data Persistence - -# TODO: deprecate below region based storage classes once OK to do so (i.e. all testnets have migrated to new classes) -resource "kubernetes_storage_class" "central1_ssd" { - provider = kubernetes.k8s_central1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.central1_region}-ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "central1_standard" { - provider = kubernetes.k8s_central1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.central1_region}-standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -# --- - -resource "kubernetes_storage_class" "central1_infra_ssd" { - provider = kubernetes.k8s_central1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "central1_infra_standard" { - provider = kubernetes.k8s_central1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -## Monitoring - -provider helm { - alias = "helm_central1" - kubernetes { - config_context = local.central1_k8s_context - } -} - -provider helm { - alias = "bk_helm_central1" - kubernetes { - config_context = local.bk_central1_k8s_context - } -} - -resource "helm_release" "central1_prometheus" { - provider = helm.helm_central1 - - name = "central1-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.central1_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.coda_cluster_central1] - force_update = true -} - -resource "helm_release" "bk_central1_prometheus" { - provider = helm.bk_helm_central1 - - name = "bk-central1-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.central1_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.coda_cluster_central1] - force_update = true -} diff --git a/automation/terraform/infrastructure/us-east1.tf b/automation/terraform/infrastructure/us-east1.tf deleted file mode 100644 index 2bd9349c665..00000000000 --- a/automation/terraform/infrastructure/us-east1.tf +++ /dev/null @@ -1,302 +0,0 @@ -locals { - east1_region = "us-east1" - east1_k8s_context = "gke_o1labs-192920_us-east1_coda-infra-east" - bk_east1_k8s_context = "gke_o1labs-192920_us-east1_buildkite-infra-east1" - - east_prometheus_helm_values = { - server = { - global = { - external_labels = { - origin_prometheus = "east1-prometheus" - } - } - persistentVolume = { - size = "50Gi" - } - remoteWrite = [ - { - url = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_uri"] - basic_auth = { - username = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_username"] - password = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_password"] - } - write_relabel_configs = [ - { - source_labels : ["__name__"] - regex : "(buildkite.*|container.*|Coda.*|watchdog.*|go.*|process.*|Mina.*)" - action : "keep" - } - ] - } - ] - } - # Disable per-region instances due to grafanacloud aggregator setup - alertmanager = { - enabled = false - } - } -} - -provider "google" { - alias = "google_east" - project = local.gcp_project - region = local.east1_region -} - -provider "kubernetes" { - alias = "k8s_east1" - config_context = local.east1_k8s_context -} - -data "google_compute_zones" "east1_available" { - project = local.gcp_project - region = local.east1_region - status = "UP" -} - -### Testnets - -resource "google_container_cluster" "coda_cluster_east" { - provider = google.google_east - name = "coda-infra-east" - location = local.east1_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.east1_available.names - - # We can't create a cluster with no node pool defined, but we want to only use - # separately managed node pools. So we create the smallest possible default - # node pool and immediately delete it. - remove_default_node_pool = true - initial_node_count = 1 - - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "east_primary_nodes" { - provider = google.google_east - name = "coda-infra-east" - location = local.east1_region - cluster = google_container_cluster.coda_cluster_east.name - node_count = 4 - autoscaling { - min_node_count = 0 - max_node_count = 7 - } - node_config { - preemptible = false - machine_type = local.node_type - disk_size_gb = 500 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -resource "google_container_node_pool" "east1_preemptible_nodes" { - provider = google.google_east - name = "mina-preemptible-east1" - location = local.east1_region - cluster = google_container_cluster.coda_cluster_east.name - node_count = 5 - autoscaling { - min_node_count = 0 - max_node_count = 20 - } - node_config { - preemptible = true - machine_type = "n1-standard-16" - disk_size_gb = 500 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -### Buildkite - -resource "google_container_cluster" "buildkite_infra_east1" { - provider = google.google_east - name = "buildkite-infra-east1" - location = local.east1_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.east1_available.names - - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "east1_compute_nodes" { - provider = google.google_east - name = "buildkite-east1-compute" - location = local.east1_region - cluster = google_container_cluster.buildkite_infra_east1.name - - # total nodes provisioned = node_count * # of AZs - node_count = 5 - autoscaling { - min_node_count = 2 - max_node_count = 10 - } - node_config { - preemptible = true - machine_type = "c2-standard-16" - disk_size_gb = 500 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/cloud-platform" - ] - } -} - -## Data Persistence - -# TODO: deprecate below region based storage classes once OK to do so (i.e. all testnets have migrated to new classes) -resource "kubernetes_storage_class" "east1_ssd" { - provider = kubernetes.k8s_east1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.east1_region}-ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "east1_standard" { - provider = kubernetes.k8s_east1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.east1_region}-standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -# --- - -resource "kubernetes_storage_class" "east1_infra_ssd" { - provider = kubernetes.k8s_east1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "east1_infra_standard" { - provider = kubernetes.k8s_east1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -## Monitoring - -provider helm { - alias = "helm_east" - kubernetes { - config_context = local.east1_k8s_context - } -} - -provider helm { - alias = "bk_helm_east" - kubernetes { - config_context = local.bk_east1_k8s_context - } -} - -resource "helm_release" "east1_prometheus" { - provider = helm.helm_east - - name = "east-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.east_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.coda_cluster_east] - force_update = true -} - -resource "helm_release" "bk_east1_prometheus" { - provider = helm.bk_helm_east - - name = "bk-east-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.east_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.coda_cluster_east] - force_update = true -} diff --git a/automation/terraform/infrastructure/us-east4.tf b/automation/terraform/infrastructure/us-east4.tf deleted file mode 100644 index b5b2d71ab39..00000000000 --- a/automation/terraform/infrastructure/us-east4.tf +++ /dev/null @@ -1,304 +0,0 @@ -locals { - east4_region = "us-east4" - - east4_k8s_context = "gke_o1labs-192920_us-east4_coda-infra-east4" - bk_east4_k8s_context = "gke_o1labs-192920_us-east4_buildkite-infra-east4" - - east4_prometheus_helm_values = { - server = { - global = { - external_labels = { - origin_prometheus = "east4-prometheus" - } - } - persistentVolume = { - size = "50Gi" - } - remoteWrite = [ - { - url = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_uri"] - basic_auth = { - username = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_username"] - password = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_password"] - } - write_relabel_configs = [ - { - source_labels : ["__name__"] - regex : "(buildkite.*|container.*|Coda.*|watchdog.*|go.*|process.*|Mina.*)" - action : "keep" - } - ] - } - ] - } - # Disable per-region instances due to grafanacloud aggregator setup - alertmanager = { - enabled = false - } - } -} - -provider "google" { - alias = "google_east4" - project = local.gcp_project - region = local.east4_region -} - -provider "kubernetes" { - alias = "k8s_east4" - config_context = local.east4_k8s_context -} - -data "google_compute_zones" "east4_available" { - project = "o1labs-192920" - region = local.east4_region - status = "UP" -} - -### Testnets - -resource "google_container_cluster" "coda_cluster_east4" { - provider = google.google_east4 - name = "coda-infra-east4" - location = local.east4_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.east4_available.names - - # We can't create a cluster with no node pool defined, but we want to only use - # separately managed node pools. So we create the smallest possible default - # node pool and immediately delete it. - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "east4_primary_nodes" { - provider = google.google_east4 - name = "coda-infra-east4" - location = local.east4_region - cluster = google_container_cluster.coda_cluster_east4.name - node_count = 4 - autoscaling { - min_node_count = 0 - max_node_count = 7 - } - node_config { - preemptible = false - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -resource "google_container_node_pool" "east4_preemptible_nodes" { - provider = google.google_east4 - name = "mina-preemptible-east4" - location = local.east4_region - cluster = google_container_cluster.coda_cluster_east4.name - node_count = 5 - autoscaling { - min_node_count = 0 - max_node_count = 20 - } - node_config { - preemptible = true - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -### Buildkite - -resource "google_container_cluster" "buildkite_infra_east4" { - provider = google.google_east4 - name = "buildkite-infra-east4" - location = local.east4_region - min_master_version = "1.15" - - node_locations = data.google_compute_zones.east4_available.names - - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "east4_compute_nodes" { - provider = google.google_east4 - name = "buildkite-east4-compute" - location = local.east4_region - cluster = google_container_cluster.buildkite_infra_east4.name - - # total nodes provisioned = node_count * # of AZs - node_count = 5 - autoscaling { - min_node_count = 2 - max_node_count = 10 - } - node_config { - preemptible = true - machine_type = "c2-standard-16" - disk_size_gb = 500 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/cloud-platform" - ] - } -} - -## Data Persistence - -# TODO: deprecate below region based storage classes once OK to do so (i.e. all testnets have migrated to new classes) -resource "kubernetes_storage_class" "east4_ssd" { - provider = kubernetes.k8s_east4 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.east4_region}-ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "east4_standard" { - provider = kubernetes.k8s_east4 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.east4_region}-standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -# --- - -resource "kubernetes_storage_class" "east4_infra_ssd" { - provider = kubernetes.k8s_east4 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "east4_infra_standard" { - provider = kubernetes.k8s_east4 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - - -## Monitoring - -provider helm { - alias = "helm_east4" - kubernetes { - config_context = local.east4_k8s_context - } -} - -provider helm { - alias = "bk_helm_east4" - kubernetes { - config_context = local.bk_east4_k8s_context - } -} - -resource "helm_release" "east4_prometheus" { - provider = helm.helm_east4 - - name = "east4-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.east4_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.coda_cluster_east4] - force_update = true -} - -resource "helm_release" "bk_east4_prometheus" { - provider = helm.bk_helm_east4 - - name = "bk-east4-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.east4_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.buildkite_infra_east4] - force_update = true -} diff --git a/automation/terraform/infrastructure/us-west1.tf b/automation/terraform/infrastructure/us-west1.tf deleted file mode 100644 index 1eb64410833..00000000000 --- a/automation/terraform/infrastructure/us-west1.tf +++ /dev/null @@ -1,339 +0,0 @@ -locals { - west1_region = "us-west1" - west1_k8s_context = "gke_o1labs-192920_us-west1_mina-integration-west1" - - west1_prometheus_helm_values = { - server = { - global = { - external_labels = { - origin_prometheus = "west1-prometheus" - } - } - persistentVolume = { - size = "50Gi" - } - remoteWrite = [ - { - url = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_uri"] - basic_auth = { - username = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_username"] - password = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_password"] - } - write_relabel_configs = [ - { - source_labels : ["__name__"] - regex : "(buildkite.*|container.*|Coda.*|watchdog.*|go.*|process.*|Mina.*)" - action : "keep" - } - ] - } - ] - } - # Disable per-region instances due to grafanacloud aggregator setup - alertmanager = { - enabled = false - } - } -} - -provider "google" { - alias = "google_west1" - project = local.gcp_project - region = local.west1_region -} - -provider "kubernetes" { - alias = "k8s_west1" - config_context = local.west1_k8s_context -} - -data "google_compute_zones" "west1_available" { - project = local.gcp_project - region = local.west1_region - status = "UP" -} - -### Testnets - -resource "google_container_cluster" "mina_integration_west1" { - provider = google.google_west1 - name = "mina-integration-west1" - location = local.west1_region - min_master_version = "1.16" - - node_locations = data.google_compute_zones.west1_available.names - - # We can't create a cluster with no node pool defined, but we want to only use - # separately managed node pools. So we create the smallest possible default - # node pool and immediately delete it. - remove_default_node_pool = true - initial_node_count = 1 - - master_auth { - username = "" - password = "" - - client_certificate_config { - issue_client_certificate = false - } - } -} - -resource "google_container_node_pool" "west1_integration_primary" { - provider = google.google_west1 - name = "mina-integration-primary" - location = local.west1_region - cluster = google_container_cluster.mina_integration_west1.name - node_count = 5 - autoscaling { - min_node_count = 1 - max_node_count = 5 - } - node_config { - preemptible = false - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -resource "google_container_node_pool" "west1_integration_preemptible" { - provider = google.google_west1 - name = "mina-integration-preemptible" - location = local.west1_region - cluster = google_container_cluster.mina_integration_west1.name - node_count = 5 - autoscaling { - min_node_count = 1 - max_node_count = 10 - } - node_config { - preemptible = true - machine_type = "n1-standard-16" - disk_size_gb = 100 - - metadata = { - disable-legacy-endpoints = "true" - } - - oauth_scopes = [ - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - ] - } -} - -## Data Persistence - -# TODO: deprecate below region based storage classes once OK to do so (i.e. all testnets have migrated to new classes) -resource "kubernetes_storage_class" "west1_ssd" { - provider = kubernetes.k8s_west1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.west1_region}-ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "west1_standard" { - provider = kubernetes.k8s_west1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "${local.west1_region}-standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -# --- - -resource "kubernetes_storage_class" "west1_infra_ssd" { - provider = kubernetes.k8s_west1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "ssd-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-ssd" - } -} - -resource "kubernetes_storage_class" "west1_infra_standard" { - provider = kubernetes.k8s_west1 - - count = length(local.storage_reclaim_policies) - - metadata { - name = "standard-${lower(local.storage_reclaim_policies[count.index])}" - } - - storage_provisioner = "kubernetes.io/gce-pd" - reclaim_policy = local.storage_reclaim_policies[count.index] - volume_binding_mode = "WaitForFirstConsumer" - parameters = { - type = "pd-standard" - } -} - -## Monitoring - -provider helm { - alias = "helm_west1" - kubernetes { - config_context = local.west1_k8s_context - } -} - -resource "helm_release" "west1_prometheus" { - provider = helm.helm_west1 - name = "west1-prometheus" - chart = "stable/prometheus" - namespace = "default" - values = [ - yamlencode(local.west1_prometheus_helm_values) - ] - wait = true - depends_on = [google_container_cluster.mina_integration_west1] - force_update = true -} - -# Utilities - -provider kubernetes { - config_context = local.west1_k8s_context -} - -resource "kubernetes_cron_job" "integration-testnet-namespace-cleanup" { - metadata { - name = "integration-testnet-namespace-cleanup" - namespace = "default" - } - spec { - concurrency_policy = "Replace" - failed_jobs_history_limit = 5 - schedule = "0 * * * *" - starting_deadline_seconds = 10 - successful_jobs_history_limit = 10 - job_template { - metadata {} - spec { - backoff_limit = 5 - ttl_seconds_after_finished = 10 - template { - metadata {} - spec { - container { - name = "integration-test-janitor" - image = "gcr.io/o1labs-192920/watchdog:0.4.6" - args = [ - "/scripts/network-utilities.py", - "janitor", - "cleanup-namespace-resources", - "--namespace-pattern", - "^it-.*|^ci-net.*", - "--cleanup-older-than", - "10800", # 60 * 60 * 3 seconds (3 hours) - "--k8s-context", - "gke_o1labs-192920_us-west1_mina-integration-west1", - "--kube-config-file", - "/root/.kube/config" - ] - env { - name = "GCLOUD_APPLICATION_CREDENTIALS_JSON" - value = base64decode(google_service_account_key.janitor_svc_key.private_key) - } - env { - name = "CLUSTER_SERVICE_EMAIL" - value = google_service_account.gcp_janitor_account.email - } - } - } - } - } - } - } -} - -resource "kubernetes_cron_job" "integration-testnet-port-mappings-cleanup" { - metadata { - name = "integration-testnet-port-mappings-cleanup" - namespace = "default" - } - spec { - concurrency_policy = "Replace" - failed_jobs_history_limit = 5 - schedule = "0 * * * *" - starting_deadline_seconds = 10 - successful_jobs_history_limit = 10 - job_template { - metadata {} - spec { - backoff_limit = 5 - ttl_seconds_after_finished = 10 - template { - metadata {} - spec { - container { - name = "integration-test-janitor" - image = "gcr.io/o1labs-192920/watchdog:0.4.6" - args = [ - "/scripts/network-utilities.py", - "janitor", - "cleanup-port-mappings", - "--k8s-context", - "gke_o1labs-192920_us-west1_mina-integration-west1", - "--kube-config-file", - "/root/.kube/config", - "--instance-group", - "k8s-ig--7e46c4017bf483c0", - "--zone", - "us-west1-a", - "--zone", - "us-west1-b", - "--zone", - "us-west1-c" - ] - env { - name = "GCLOUD_APPLICATION_CREDENTIALS_JSON" - value = base64decode(google_service_account_key.janitor_svc_key.private_key) - } - env { - name = "CLUSTER_SERVICE_EMAIL" - value = google_service_account.gcp_janitor_account.email - } - } - } - } - } - } - } -} diff --git a/automation/terraform/infrastructure/us-west2.tf b/automation/terraform/infrastructure/us-west2.tf deleted file mode 100644 index a8a9dce11b7..00000000000 --- a/automation/terraform/infrastructure/us-west2.tf +++ /dev/null @@ -1,101 +0,0 @@ -# locals { -# west_prometheus_helm_values = { -# server = { -# global = { -# external_labels = { -# origin_prometheus = "west-prometheus" -# } -# } -# remoteWrite = [ -# { -# url = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_uri"] -# basic_auth = { -# username = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_username"] -# password = jsondecode(data.aws_secretsmanager_secret_version.current_prometheus_remote_write_config.secret_string)["remote_write_password"] -# } -# } -# ] -# } -# } -# } - -# provider "google" { -# alias = "google_west" -# project = "o1labs-192920" -# region = "us-west2" -# zone = "us-west2-b" -# } - -# resource "google_container_cluster" "coda_cluster_west" { -# provider = google.google_west -# name = "coda-infra-west" -# location = "us-west2" -# min_master_version = "1.15" - -# # We can't create a cluster with no node pool defined, but we want to only use -# # separately managed node pools. So we create the smallest possible default -# # node pool and immediately delete it. -# remove_default_node_pool = true -# initial_node_count = 1 - - -# master_auth { -# username = "" -# password = "" - -# client_certificate_config { -# issue_client_certificate = false -# } -# } -# } - -# resource "google_container_node_pool" "west_primary_nodes" { -# provider = google.google_west -# name = "coda-infra-west" -# location = "us-west2" -# cluster = google_container_cluster.coda_cluster_west.name -# node_count = local.num_nodes_per_zone -# autoscaling { -# min_node_count = 0 -# max_node_count = 8 -# } -# node_config { -# preemptible = false -# machine_type = local.node_type - -# metadata = { -# disable-legacy-endpoints = "true" -# } - -# oauth_scopes = [ -# "https://www.googleapis.com/auth/logging.write", -# "https://www.googleapis.com/auth/monitoring", -# ] -# } -# } - -# ## Helm - -# provider helm { -# alias = "helm_west" -# kubernetes { -# host = "https://${google_container_cluster.coda_cluster_west.endpoint}" -# client_certificate = base64decode(google_container_cluster.coda_cluster_west.master_auth[0].client_certificate) -# client_key = base64decode(google_container_cluster.coda_cluster_west.master_auth[0].client_key) -# cluster_ca_certificate = base64decode(google_container_cluster.coda_cluster_west.master_auth[0].cluster_ca_certificate) -# token = data.google_client_config.current.access_token -# load_config_file = false -# } -# } - -# resource "helm_release" "west_prometheus" { -# provider = helm.helm_west -# name = "west-prometheus" -# chart = "stable/prometheus" -# namespace = "default" -# values = [ -# yamlencode(local.west_prometheus_helm_values) -# ] -# wait = true -# depends_on = [google_container_cluster.coda_cluster_west] -# } diff --git a/automation/terraform/modules/coda-node/container.tf b/automation/terraform/modules/coda-node/container.tf deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/automation/terraform/modules/coda-node/main.tf b/automation/terraform/modules/coda-node/main.tf deleted file mode 100644 index 36a60d10c0a..00000000000 --- a/automation/terraform/modules/coda-node/main.tf +++ /dev/null @@ -1,96 +0,0 @@ -# Declare provider for region taken as input -provider "aws" { - region = "${var.region}" -} - -# Discover availability zones -data "aws_availability_zones" "azs" { - state = "available" -} - -# Discover most recent debian stretch image -data "aws_ami" "image" { - most_recent = true - owners = ["379101102735"] - - filter { - name = "name" - values = ["debian-stretch-hvm-x86_64-gp2-*"] - } -} - -# The Node instance -resource "aws_instance" "coda_node" { - count = "${var.server_count}" - ami = "${var.custom_ami != "" ? var.custom_ami : data.aws_ami.image.id}" - instance_type = "${var.instance_type}" - security_groups = ["${aws_security_group.coda_sg.name}"] - key_name = "${var.public_key != "" ? aws_key_pair.testnet[0].key_name : var.key_name}" - availability_zone = "${element(data.aws_availability_zones.azs.names, count.index)}" - associate_public_ip_address = "${var.use_eip}" - - tags = { - Name = "${var.netname}_${var.region}_${var.rolename}_${count.index}" - role = "${var.netname}_${var.rolename}" - testnet = "${var.netname}" - module = "coda-node" - } - - # Default root is 8GB - root_block_device { - volume_size = 32 - } - - # Role Specific Magic Happens Here - user_data = <<-EOF -#!/bin/bash -echo "Setting Hostname" -hostnamectl set-hostname ${var.netname}_${var.region}_${var.rolename}_${count.index}.${var.region} -echo '127.0.1.1 ${var.netname}_${var.region}_${var.rolename}_${count.index}.${var.region}' >> /etc/hosts - -echo "Installing Coda" -echo "deb [trusted=yes] http://packages.o1test.net ${var.coda_repo} main" > /etc/apt/sources.list.d/coda.list -apt-get update -apt-get install --force-yes -t ${var.coda_repo} coda-${var.coda_variant}=${var.coda_version} -y - -# coda flags -echo ${var.rolename} > /etc/coda-rolename - -# journal logs on disk -mkdir /var/log/journal - -# user tools -apt-get --yes install \ - atop \ - bc \ - dnsutils \ - emacs-nox \ - htop \ - jq \ - lsof \ - monit \ - ncdu \ - rsync \ - tmux \ - ttyload \ - software-properties-common - -# dev tools -apt-get --yes install python3-pip -pip3 install \ - 'elasticsearch>=6.0.0,<7.0.0' \ - certifi \ - geoip2 \ - graphyte \ - psutil \ - sexpdata - - EOF -} - -resource "aws_key_pair" "testnet" { - count = "${var.public_key != "" ? 1 : 0}" - key_name = "${var.netname}_${var.region}_${var.rolename}_keypair" - public_key = "${var.public_key}" -} - diff --git a/automation/terraform/modules/coda-node/outputs.tf b/automation/terraform/modules/coda-node/outputs.tf deleted file mode 100644 index bfbb30964e1..00000000000 --- a/automation/terraform/modules/coda-node/outputs.tf +++ /dev/null @@ -1,74 +0,0 @@ -locals { - this_id = compact(coalescelist(aws_instance.coda_node.*.id, [""])) - this_availability_zone = compact(coalescelist(aws_instance.coda_node.*.availability_zone, [""])) - this_key_name = compact(coalescelist(aws_instance.coda_node.*.key_name, [""])) - this_public_dns = compact(coalescelist(aws_instance.coda_node.*.public_dns, [""])) - this_public_ip = compact(coalescelist(aws_instance.coda_node.*.public_ip, [""])) - this_primary_network_interface_id = compact(coalescelist(aws_instance.coda_node.*.primary_network_interface_id, [""])) - this_private_dns = compact(coalescelist(aws_instance.coda_node.*.private_dns, [""])) - this_private_ip = compact(coalescelist(aws_instance.coda_node.*.private_ip, [""])) - this_security_groups = coalescelist(aws_instance.coda_node.*.security_groups, [""]) - this_vpc_security_group_ids = coalescelist(flatten(aws_instance.coda_node.*.vpc_security_group_ids), [""]) - this_subnet_id = compact(coalescelist(aws_instance.coda_node.*.subnet_id, [""])) - this_tags = coalescelist(aws_instance.coda_node.*.tags, [""]) -} - -output "id" { - description = "List of IDs of instances" - value = local.this_id -} - -output "availability_zone" { - description = "List of availability zones of instances" - value = local.this_availability_zone -} - -output "key_name" { - description = "List of key names of instances" - value = local.this_key_name -} - -output "public_dns" { - description = "List of public DNS names assigned to the instances. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC" - value = local.this_public_dns -} - -output "public_ip" { - description = "List of public IP addresses assigned to the instances, if applicable" - value = local.this_public_ip -} - -output "primary_network_interface_id" { - description = "List of IDs of the primary network interface of instances" - value = local.this_primary_network_interface_id -} - -output "private_dns" { - description = "List of private DNS names assigned to the instances. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC" - value = local.this_private_dns -} - -output "private_ip" { - description = "List of private IP addresses assigned to the instances" - value = local.this_private_ip -} - -output "security_groups" { - description = "List of associated security groups of instances" - value = local.this_security_groups -} - -output "vpc_security_group_ids" { - description = "List of associated security groups of instances, if running in non-default VPC" - value = local.this_vpc_security_group_ids -} - -output "subnet_id" { - description = "List of IDs of VPC subnets of instances" - value = local.this_subnet_id -} - -output "tags" { - description = "List of tags of instances" - value = local.this_tags -} \ No newline at end of file diff --git a/automation/terraform/modules/coda-node/security_groups.tf b/automation/terraform/modules/coda-node/security_groups.tf deleted file mode 100644 index 5575c812784..00000000000 --- a/automation/terraform/modules/coda-node/security_groups.tf +++ /dev/null @@ -1,80 +0,0 @@ -resource "aws_security_group" "coda_sg" { - name = "${var.netname}_${var.region}_${var.rolename}_coda_sg" - description = "Allow control access and coda ports open" - - ingress { - description = "ssh" - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "TCP RPC - snark coordination" - from_port = "${var.port_rpc}" - to_port = "${var.port_rpc}" - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "TCP Gossip" - from_port = "${var.port_gossip}" - to_port = "${var.port_gossip}" - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "UDP Peer Discovery" - from_port = "${var.port_dht}" - to_port = "${var.port_dht}" - protocol = "udp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "TCP Peer Disovery - libp2p" - from_port = "${var.port_libp2p}" - to_port = "${var.port_libp2p}" - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "TCP ql" - from_port = "${var.port_ql}" - to_port = "${var.port_ql}" - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } - - ingress { - description = "Prometheus Monitor" - from_port = "10000" - to_port = "10000" - protocol = "tcp" - cidr_blocks = "${var.prometheus_cidr_blocks}" - } - - ingress { - description = "Ping echo" - from_port = 8 - to_port = 0 - protocol = "icmp" - cidr_blocks = ["0.0.0.0/0"] - } - - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - self = true - } - - tags = { - TestNet = "${var.netname}" - } -} diff --git a/automation/terraform/modules/coda-node/variables.tf b/automation/terraform/modules/coda-node/variables.tf deleted file mode 100644 index d43498a059c..00000000000 --- a/automation/terraform/modules/coda-node/variables.tf +++ /dev/null @@ -1,105 +0,0 @@ -variable "instance_type" { - description = "Type of instance to launch Coda on" - type = string - default = "c5.large" -} - -variable "custom_ami" { - description = "Optional Custom AMI - Defaults to newest debian stretch AMI" - type = string - default = "" -} - -variable "netname" { - description = "Name of the testnet, used for tagging resources" - type = string - default = "NONETNAMESET" -} - -variable "coda_repo" { - description = "repo of the Coda Deb to Install" - type = string - default = "stable" -} - -variable "coda_version" { - description = "Version of the Coda Deb to Install" - type = string - default = "0.0.1-release-beta-0d13213e" -} - -variable "coda_variant" { - description = "The variant (build profile) of the Coda Deb to install" - type = string - default = "testnet-postake-medium-curves" -} - -variable "port_rpc" { - description = "Port RPC protocol communicates over" - type = number - default = 8301 -} - -variable "port_gossip" { - description = "Port Gossip protocol communicates over" - type = number - default = 8302 -} - -variable "port_dht" { - description = "Port DHT protocol communicates over" - type = number - default = 8303 -} - -variable "port_libp2p" { - description = "Port libp2p protocol communicates over" - type = number - default = 8303 -} - -variable "port_ql" { - description = "Port GraphQL endpoint is listening on" - type = number - default = 8304 -} - -variable "public_key" { - description = "An SSH Public Key used to configure node access, if not set defaults to key_name" - type = "string" - default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKIzMn7890zeG1cdYEaxFhpTPY1ylgZKPZD/BKrVos7Yq6tTmqevQMXHSyvtbaQ7CQoyCiCAShFFzMjNelQ1q1X8Uo45YS4HL12eaqE9mbgwzVyaz5njL/N3DihxFqK5MGzolAh/Y/IerRzjq3f17twSzJwNOoiiqVoKk/JPeZUdvIKnrq09LckZ2ImWY520QchNS8bUHM1whlDU41Ovm/64cuheaLcI5+hz0Jc698YrQ83yh8Q0eo9qCmp7cE7JnLn5psxMwAVBSUHANret751qZZWvfNxwrV0J+UvHSVULtKyaM5WhM0dah9u+g84Lmoy+RRM5JfJGAa1VwtXibT testnet" -} - -variable "key_name" { - description = "The name of an AWS Public Key" - type = "string" - default = "" -} - -variable "region" { - description = "The region the module should be deployed to" - type = string - default = "us-west-2" -} - -#Options: "seed", "snarker", "joiner", "proposer" -variable "rolename" { - description = "The role the node should assume when it starts up, also used for resource tagging" - type = string -} - -variable "server_count" { - description = "Number of Coda nodes to launch" - type = number - default = 1 -} - -variable "use_eip" { - description = "If true, apply EIP" - default = true -} - -variable "prometheus_cidr_blocks" { - description = "One or more CIDR Blocks in use by Prometheus" - default = ["18.237.92.200/32", "52.35.51.5/32"] -} diff --git a/automation/terraform/modules/ecs/main.tf b/automation/terraform/modules/ecs/main.tf deleted file mode 100644 index 43b4e2efb52..00000000000 --- a/automation/terraform/modules/ecs/main.tf +++ /dev/null @@ -1,106 +0,0 @@ -locals { - ec2_resources_name = "${var.name}-${var.environment}" -} - -module "vpc" { - source = "terraform-aws-modules/vpc/aws" - version = "~> 2.0" - - name = var.name - - cidr = "10.1.0.0/16" - - azs = ["us-west-2a", "us-west-2b"] - private_subnets = ["10.1.1.0/24", "10.1.2.0/24"] - public_subnets = ["10.1.11.0/24", "10.1.12.0/24"] - - enable_nat_gateway = false # this is faster, but should be "true" for real - - tags = { - Environment = var.environment - Name = var.name - } -} - -#----- ECS -------- -module "ecs" { - source = "terraform-aws-modules/ecs/aws" - name = var.name -} - -module "ec2-profile" { - source = "github.com/terraform-aws-modules/terraform-aws-ecs/modules/ecs-instance-profile" - name = var.name -} - -#----- ECS Resources-------- - -#For now we only use the AWS ECS optimized ami -data "aws_ami" "amazon_linux_ecs" { - most_recent = true - - owners = ["amazon"] - - filter { - name = "name" - values = ["amzn-ami-*-amazon-ecs-optimized"] - } - - filter { - name = "owner-alias" - values = ["amazon"] - } -} - -module "this" { - source = "terraform-aws-modules/autoscaling/aws" - version = "~> 3.0" - - name = local.ec2_resources_name - - # Launch configuration - lc_name = local.ec2_resources_name - - image_id = data.aws_ami.amazon_linux_ecs.id - instance_type = var.cluster_instance_type - security_groups = [module.vpc.default_security_group_id, aws_security_group.allow_prometheus_9090.id, aws_security_group.allow_egress.id, aws_security_group.allow_ssh.id, aws_security_group.allow_lotsa_ports.id] - iam_instance_profile = module.ec2-profile.this_iam_instance_profile_id - user_data = data.template_file.user_data.rendered - key_name = var.cluster_ssh_key_name - - # Auto scaling group - asg_name = local.ec2_resources_name - vpc_zone_identifier = module.vpc.public_subnets - health_check_type = "EC2" - min_size = 1 - max_size = var.cluster_max_size - desired_capacity = var.cluster_desired_capacity - wait_for_capacity_timeout = 0 - associate_public_ip_address = "true" - - tags = [ - { - key = "Environment" - value = var.environment - propagate_at_launch = true - }, - { - key = "Cluster" - value = var.name - propagate_at_launch = true - }, - { - key = "module" - value = "ecs" - propagate_at_launch = true - }, - ] -} - -data "template_file" "user_data" { - template = file("${path.module}/templates/user-data.sh") - - vars = { - cluster_name = var.name - } -} \ No newline at end of file diff --git a/automation/terraform/modules/ecs/outputs.tf b/automation/terraform/modules/ecs/outputs.tf deleted file mode 100644 index ee99f968dd9..00000000000 --- a/automation/terraform/modules/ecs/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "cluster_id" { - value = "${module.ecs.this_ecs_cluster_id}" -} diff --git a/automation/terraform/modules/ecs/security_groups.tf b/automation/terraform/modules/ecs/security_groups.tf deleted file mode 100644 index 4afc89ac368..00000000000 --- a/automation/terraform/modules/ecs/security_groups.tf +++ /dev/null @@ -1,57 +0,0 @@ -resource "aws_security_group" "allow_ssh" { - name = "ecs_allow_ssh" - description = "Allow SSH Ingress" - vpc_id = "${module.vpc.vpc_id}" - - ingress { - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = ["0.0.0.0/0"] - } -} - -resource "aws_security_group" "allow_egress" { - name = "ecs_allow_egress" - description = "Allow Egress" - vpc_id = "${module.vpc.vpc_id}" - - egress { - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } -} - -resource "aws_security_group" "allow_prometheus_9090" { - name = "ecs_allow_prometheus_9090" - description = "Allow Prometheus Ingress" - vpc_id = "${module.vpc.vpc_id}" - - ingress { - from_port = 9090 - to_port = 9090 - protocol = "TCP" - cidr_blocks = ["0.0.0.0/0"] - } -} - -resource "aws_security_group" "allow_lotsa_ports" { - name = "ecs_allow_lotsa_ports" - description = "Allow Prometheus Ingress" - vpc_id = "${module.vpc.vpc_id}" - - ingress { - from_port = 10000 - to_port = 11000 - protocol = "TCP" - cidr_blocks = ["0.0.0.0/0"] - } - ingress { - from_port = 10000 - to_port = 11000 - protocol = "UDP" - cidr_blocks = ["0.0.0.0/0"] - } -} \ No newline at end of file diff --git a/automation/terraform/modules/ecs/templates/user-data.sh b/automation/terraform/modules/ecs/templates/user-data.sh deleted file mode 100644 index 90229c88e94..00000000000 --- a/automation/terraform/modules/ecs/templates/user-data.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -# ECS config -{ - echo "ECS_CLUSTER=${cluster_name}" -} >> /etc/ecs/ecs.config - -start ecs - -echo "Done" \ No newline at end of file diff --git a/automation/terraform/modules/ecs/variables.tf b/automation/terraform/modules/ecs/variables.tf deleted file mode 100644 index bf6a075655b..00000000000 --- a/automation/terraform/modules/ecs/variables.tf +++ /dev/null @@ -1,33 +0,0 @@ -variable "name" { - description = "Name for the ECS Cluster" - type = string -} - -variable "environment" { - description = "Environment this cluster is operating under" - type = string - default = "dev" -} - -variable "cluster_desired_capacity" { - description = "Desired number of ECS Nodes" - type = string - default = "2" -} - -variable "cluster_max_size" { - description = "Maximum Size of the ECS Cluster" - type = string - default = "3" -} - -variable "cluster_instance_type" { - description = "The type of instance to launch ECS Nodes with" - type = string - default = "t3.xlarge" -} - -variable "cluster_ssh_key_name" { - description = "The name of an SSH key to install on ECS Nodes" - default = "testnet" -} diff --git a/automation/terraform/modules/elasticsearch/main.tf b/automation/terraform/modules/elasticsearch/main.tf deleted file mode 100644 index f49ecce5c90..00000000000 --- a/automation/terraform/modules/elasticsearch/main.tf +++ /dev/null @@ -1,79 +0,0 @@ -locals { - domain_name = "${var.use_prefix ? join("", list(var.domain_prefix, var.domain_name)) : var.domain_name}" -} - -data "aws_iam_policy_document" "es_management_access" { - statement { - actions = [ - "es:*", - ] - - resources = [ - "${aws_elasticsearch_domain.es.arn}", - "${aws_elasticsearch_domain.es.arn}/*", - ] - - principals { - type = "AWS" - - identifiers = "${distinct(compact(var.management_iam_roles))}" - } - - condition { - test = "IpAddress" - variable = "aws:SourceIp" - - values = "${distinct(compact(var.management_public_ip_addresses))}" - } - } -} - -resource "aws_elasticsearch_domain" "es" { - depends_on = ["aws_iam_service_linked_role.es"] - - domain_name = "${local.domain_name}" - elasticsearch_version = "${var.es_version}" - - encrypt_at_rest { - enabled = "${var.encrypt_at_rest}" - kms_key_id = "${var.kms_key_id}" - } - - cluster_config { - instance_type = "${var.instance_type}" - instance_count = "${var.instance_count}" - dedicated_master_enabled = "${var.instance_count >= var.dedicated_master_threshold ? true : false}" - dedicated_master_count = "${var.instance_count >= var.dedicated_master_threshold ? 3 : 0}" - dedicated_master_type = "${var.instance_count >= var.dedicated_master_threshold ? (var.dedicated_master_type != "false" ? var.dedicated_master_type : var.instance_type) : ""}" - zone_awareness_enabled = "${var.es_zone_awareness}" - } - - advanced_options = "${var.advanced_options}" - - - node_to_node_encryption { - enabled = "${var.node_to_node_encryption_enabled}" - } - - ebs_options { - ebs_enabled = "${var.ebs_volume_size > 0 ? true : false}" - volume_size = "${var.ebs_volume_size}" - volume_type = "${var.ebs_volume_type}" - } - - snapshot_options { - automated_snapshot_start_hour = "${var.snapshot_start_hour}" - } - - tags = "${merge(map("Domain", local.domain_name), var.tags)}" -} - -resource "aws_elasticsearch_domain_policy" "es_management_access" { - domain_name = "${local.domain_name}" - access_policies = "${data.aws_iam_policy_document.es_management_access.json}" -} - -resource "aws_iam_service_linked_role" "es" { - count = "${var.create_iam_service_linked_role ? 1 : 0}" - aws_service_name = "es.amazonaws.com" -} \ No newline at end of file diff --git a/automation/terraform/modules/elasticsearch/outputs.tf b/automation/terraform/modules/elasticsearch/outputs.tf deleted file mode 100644 index 757b281689b..00000000000 --- a/automation/terraform/modules/elasticsearch/outputs.tf +++ /dev/null @@ -1,24 +0,0 @@ -output "arn" { - description = "Amazon Resource Name (ARN) of the domain" - value = "${element(concat(aws_elasticsearch_domain.es.*.arn, list("")), 0)}" -} - -output "domain_id" { - description = "Unique identifier for the domain" - value = "${element(concat(aws_elasticsearch_domain.es.*.domain_id, list("")), 0)}" -} - -output "domain_name" { - description = "The name of the Elasticsearch domain" - value = "${element(concat(aws_elasticsearch_domain.es.*.domain_name, list("")), 0)}" -} - -output "endpoint" { - description = "Domain-specific endpoint used to submit index, search, and data upload requests" - value = "${element(concat(aws_elasticsearch_domain.es.*.endpoint, list("")), 0)}" -} - -output "kibana_endpoint" { - description = "Domain-specific endpoint for kibana without https scheme" - value = "${element(concat(aws_elasticsearch_domain.es.*.kibana_endpoint, list("")), 0)}" -} \ No newline at end of file diff --git a/automation/terraform/modules/elasticsearch/variables.tf b/automation/terraform/modules/elasticsearch/variables.tf deleted file mode 100644 index a7f7a39ba8e..00000000000 --- a/automation/terraform/modules/elasticsearch/variables.tf +++ /dev/null @@ -1,107 +0,0 @@ -variable "create_iam_service_linked_role" { - description = "Whether to create IAM service linked role for AWS ElasticSearch service. Can be only one per AWS account." - default = true -} - -variable "domain_name" { - description = "Domain name for Elasticsearch cluster" - default = "es-domain" -} - -variable "es_version" { - description = "Version of Elasticsearch to deploy (default 5.1)" - default = "6.7" -} - -variable "instance_type" { - description = "ES instance type for data nodes in the cluster (default t2.small.elasticsearch)" - default = "t2.small.elasticsearch" -} - -variable "instance_count" { - description = "Number of data nodes in the cluster (default 6)" - default = 6 -} - -variable "dedicated_master_type" { - description = "ES instance type to be used for dedicated masters (default same as instance_type)" - default = false -} - -variable "encrypt_at_rest" { - description = "Enable encrption at rest (only specific instance family types support it: m4, c4, r4, i2, i3 default: false)" - default = false -} - -variable "management_iam_roles" { - description = "List of IAM role ARNs from which to permit management traffic (default ['*']). Note that a client must match both the IP address and the IAM role patterns in order to be permitted access." - type = "list" - default = ["*"] -} - -variable "management_public_ip_addresses" { - description = "List of IP addresses from which to permit management traffic (default []). Note that a client must match both the IP address and the IAM role patterns in order to be permitted access." - type = "list" - default = [] -} - -variable "es_zone_awareness" { - description = "Enable zone awareness for Elasticsearch cluster (default false)" - default = "false" -} - -variable "ebs_volume_size" { - description = "Optionally use EBS volumes for data storage by specifying volume size in GB (default 0)" - default = 0 -} - -variable "ebs_volume_type" { - description = "Storage type of EBS volumes, if used (default gp2)" - default = "gp2" -} - -variable "kms_key_id" { - description = "KMS key used for elasticsearch" - default = "" -} - -variable "snapshot_start_hour" { - description = "Hour at which automated snapshots are taken, in UTC (default 0)" - default = 0 -} - -variable "tags" { - description = "tags to apply to all resources" - type = "map" - default = {} -} - -variable "use_prefix" { - description = "Flag indicating whether or not to use the domain_prefix. Default: true" - default = true -} - -variable "domain_prefix" { - description = "String to be prefixed to search domain. Default: tf-" - default = "tf-" -} - -variable "dedicated_master_threshold" { - description = "The number of instances above which dedicated master nodes will be used. Default: 10" - default = 10 -} - -variable "advanced_options" { - description = "Map of key-value string pairs to specify advanced configuration options. Note that the values for these configuration options must be strings (wrapped in quotes) or they may be wrong and cause a perpetual diff, causing Terraform to want to recreate your Elasticsearch domain on every apply." - default = {} -} - -# variable "log_publishing_options" { -# description = "Map of options for publishing slow logs to CloudWatch Logs." -# default = {} -# } - -variable "node_to_node_encryption_enabled" { - description = "Whether to enable node-to-node encryption." - default = false -} \ No newline at end of file diff --git a/automation/terraform/modules/google-cloud/cloud-postgres/README.md b/automation/terraform/modules/google-cloud/cloud-postgres/README.md deleted file mode 100644 index 7ac9d424959..00000000000 --- a/automation/terraform/modules/google-cloud/cloud-postgres/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Google Cloud Postgres Deployment - -This terraform configuration is used to deploy an instance of Google Cloud Postgres. Although the default configuration works without creating a conflict, it is recommended to deploy the postgres instance as a module within a larger terraform deployment (which passes it unique var values). - -The default configuration uses Google Secret Manager to pull in a password for the default `postgres` user. After deployment, the assigned IP addresses, username, and password will be printed to the terminal as shown below: - -``` -Outputs: - -cloud_postgres_ip = tolist([ - { - "ip_address" = "35.35.35.35" <---- example IP - "time_to_retire" = "" - "type" = "PRIMARY" - }, - { - "ip_address" = "34.34.34.34" <---- example IP - "time_to_retire" = "" - "type" = "OUTGOING" - }, -]) -db_password = "PASSWORD_HERE" -db_user = "postgres" -``` - -The `PRIMARY` IP should be used when connecting to the new instance. By default, not database or schema is defined on the newly deployed db. diff --git a/automation/terraform/modules/google-cloud/cloud-postgres/main.tf b/automation/terraform/modules/google-cloud/cloud-postgres/main.tf deleted file mode 100644 index bcf21243df1..00000000000 --- a/automation/terraform/modules/google-cloud/cloud-postgres/main.tf +++ /dev/null @@ -1,36 +0,0 @@ -# Configure the Google Cloud provider -provider "google" { - project = var.gcp_project - region = var.gcp_region -} - -resource "random_id" "instance_id" { - byte_length = 4 -} - -data "google_secret_manager_secret_version" "db_password" { - provider = google - secret = var.db_pass -} - -# Create a Google Cloud SQL PostgreSQL instance -resource "google_sql_database_instance" "postgres_instance" { - name = "${var.db_name}-${random_id.instance_id.hex}" - database_version = var.postgres_version - project = var.gcp_project - region = var.gcp_region - settings { - tier = var.db_spec - user_labels = { - service = var.service_label - } - } - deletion_protection = var.deletion_protection -} - -# Define the database user -resource "google_sql_user" "database_user" { - name = var.db_user - instance = google_sql_database_instance.postgres_instance.name - password = data.google_secret_manager_secret_version.db_password.secret_data -} diff --git a/automation/terraform/modules/google-cloud/cloud-postgres/output.tf b/automation/terraform/modules/google-cloud/cloud-postgres/output.tf deleted file mode 100644 index b6f2e78cd34..00000000000 --- a/automation/terraform/modules/google-cloud/cloud-postgres/output.tf +++ /dev/null @@ -1,13 +0,0 @@ -output "cloud_postgres_ip" { - value = google_sql_database_instance.postgres_instance.ip_address -} - -output "db_user" { - value = google_sql_user.database_user.name -} - -output "db_password" { - value = data.google_secret_manager_secret_version.db_password.secret_data -} - - diff --git a/automation/terraform/modules/google-cloud/cloud-postgres/vars.tf b/automation/terraform/modules/google-cloud/cloud-postgres/vars.tf deleted file mode 100644 index fe6c59fbdd6..00000000000 --- a/automation/terraform/modules/google-cloud/cloud-postgres/vars.tf +++ /dev/null @@ -1,39 +0,0 @@ -variable "gcp_project" { - default = "o1labs-192920" -} - -variable "gcp_region" { - default = "us-east4" -} - -variable "gcp_zone" { - default = "us-east4-b" -} - -variable "db_name" { - default = "o1db" -} - -variable "db_user" { - default = "postgres" -} - -variable "db_pass" { - default = "o1db-pass" -} - -variable "deletion_protection" { - default = false -} - -variable "postgres_version" { - default = "POSTGRES_14" -} - -variable "db_spec" { - default = "db-g1-small" -} - -variable "service_label" { - default = "none" -} diff --git a/automation/terraform/modules/google-cloud/coda-seed-node/README.md b/automation/terraform/modules/google-cloud/coda-seed-node/README.md deleted file mode 100644 index cdd5260e361..00000000000 --- a/automation/terraform/modules/google-cloud/coda-seed-node/README.md +++ /dev/null @@ -1,31 +0,0 @@ -A terraform module to launch a Seed Node on Google Compute Engine - -## Providers - -| Name | Version | -|------|---------| -| google | n/a | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:-----:| -| client\_email | Service account email address | `string` | `""` | no | -| coda\_image | The docker image to deploy. | `any` | n/a | yes | -| cos\_image\_name | The forced COS image to use instead of latest | `string` | `"cos-stable-77-12371-89-0"` | no | -| discovery\_keypair | The LibP2P Keypair to use when launching the seed node. | `any` | n/a | yes | -| instance\_name | The desired name to assign to the deployed instance | `string` | `"coda-seed-node"` | no | -| project\_id | The project ID to deploy resources into | `any` | n/a | yes | -| region | The GCP region to deploy addresses into | `string` | n/a | yes | -| seed\_peers | An Optional space-separated list of -peer arguments for the mina daemon | `string` | `""` | no | -| subnetwork | The name of the subnetwork to deploy instances into | `any` | n/a | yes | -| subnetwork\_project | The project ID where the desired subnetwork is provisioned | `any` | n/a | yes | -| zone | The GCP zone to deploy instances into | `string` | n/a | yes | - -## Outputs - -| Name | Description | -|------|-------------| -| discovery\_keypair | n/a | -| instance\_external\_ip | n/a | - diff --git a/automation/terraform/modules/google-cloud/coda-seed-node/container.tf b/automation/terraform/modules/google-cloud/coda-seed-node/container.tf deleted file mode 100644 index 2b969ace50a..00000000000 --- a/automation/terraform/modules/google-cloud/coda-seed-node/container.tf +++ /dev/null @@ -1,10 +0,0 @@ -locals { - cos_image_family = "cos-stable" - cos_project = "cos-cloud" -} - -data "google_compute_image" "coreos" { - name = null - family = local.cos_image_family - project = local.cos_project -} diff --git a/automation/terraform/modules/google-cloud/coda-seed-node/main.tf b/automation/terraform/modules/google-cloud/coda-seed-node/main.tf deleted file mode 100644 index 9b57a8b4f86..00000000000 --- a/automation/terraform/modules/google-cloud/coda-seed-node/main.tf +++ /dev/null @@ -1,66 +0,0 @@ -locals { - container_command = format("mina daemon -log-level Info -config-directory /root/.mina-config -client-port 8301 -rest-port 8304 -external-port 10001 -metrics-port 10000 -libp2p-keypair %s -seed %s -config-file /root/daemon.json | tee log.txt", var.discovery_keypair, var.seed_peers) -} - -resource "google_compute_address" "external_ip" { - name = "${var.instance_name}-address" - address_type = "EXTERNAL" - region = var.region - project = var.project_id -} - -resource "google_compute_instance" "vm" { - project = var.project_id - name = var.instance_name - machine_type = "n1-standard-4" - zone = var.zone - - boot_disk { - initialize_params { - image = data.google_compute_image.coreos.self_link - size = 20 - } - } - - network_interface { - subnetwork_project = var.subnetwork_project - subnetwork = var.subnetwork - access_config { - nat_ip = google_compute_address.external_ip.address - } - } - - tags = ["coda-daemon"] - - metadata = { - gce-container-declaration = <- - ${local.container_command} - stdin: true - tty: true - restartPolicy: Always - EOF - google-logging-enabled = true - } - - labels = { - container-vm = data.google_compute_image.coreos.name - } - - service_account { - email = var.client_email - scopes = [ - "https://www.googleapis.com/auth/cloud-platform", - ] - } - - depends_on = [ var.subnetwork ] -} diff --git a/automation/terraform/modules/google-cloud/coda-seed-node/outputs.tf b/automation/terraform/modules/google-cloud/coda-seed-node/outputs.tf deleted file mode 100644 index b7404a2fb6a..00000000000 --- a/automation/terraform/modules/google-cloud/coda-seed-node/outputs.tf +++ /dev/null @@ -1,8 +0,0 @@ - -output "instance_external_ip" { - value = google_compute_address.external_ip.address -} - -output "discovery_keypair" { - value = var.discovery_keypair -} \ No newline at end of file diff --git a/automation/terraform/modules/google-cloud/coda-seed-node/variables.tf b/automation/terraform/modules/google-cloud/coda-seed-node/variables.tf deleted file mode 100644 index afc1cedf5e9..00000000000 --- a/automation/terraform/modules/google-cloud/coda-seed-node/variables.tf +++ /dev/null @@ -1,57 +0,0 @@ -variable "project_id" { - description = "The project ID to deploy resources into" -} - -variable "subnetwork_project" { - description = "The project ID where the desired subnetwork is provisioned" -} - -variable "subnetwork" { - description = "The name of the subnetwork to deploy instances into" -} - -variable "seed_peers" { - type = string - default = "" - description = "An Optional space-separated list of -peer arguments for the mina daemon" -} - -variable "instance_name" { - description = "The desired name to assign to the deployed instance" - default = "coda-seed-node" -} - -variable "zone" { - description = "The GCP zone to deploy instances into" - type = string -} - -variable "region" { - description = "The GCP region to deploy addresses into" - type = string -} - -variable "client_email" { - description = "Service account email address" - type = string - default = "" -} - -variable "cos_image_name" { - description = "The forced COS image to use instead of latest" - default = "cos-stable-77-12371-89-0" -} - -## Coda Vars - -variable "discovery_keypair" { - description = "The LibP2P Keypair to use when launching the seed node." -} - -variable "mina_image" { - description = "The docker image to deploy." -} - -variable "runtime_config" { - type = string -} diff --git a/automation/terraform/modules/google-cloud/vpc-network/README.md b/automation/terraform/modules/google-cloud/vpc-network/README.md deleted file mode 100644 index 4321160c6f2..00000000000 --- a/automation/terraform/modules/google-cloud/vpc-network/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Google Cloud VPC Network Module - -## Providers - -| Name | Version | -|------|---------| -| google | n/a | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:-----:| -| network\_name | n/a | `string` | `"coda-testnet"` | no | -| network\_region | n/a | `string` | `"us-west1"` | no | -| subnet\_cidr | n/a | `string` | `"10.0.0.0/16"` | no | -| subnet\_name | n/a | `string` | `"coda-subnet"` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| network\_link | n/a | -| network\_region | n/a | -| subnet\_link | n/a | - diff --git a/automation/terraform/modules/google-cloud/vpc-network/main.tf b/automation/terraform/modules/google-cloud/vpc-network/main.tf deleted file mode 100644 index e94b28510ee..00000000000 --- a/automation/terraform/modules/google-cloud/vpc-network/main.tf +++ /dev/null @@ -1,42 +0,0 @@ -resource "google_compute_network" "default" { - name = var.network_name - project = var.project_id -} - -resource "google_compute_subnetwork" "default" { - name = var.subnet_name - ip_cidr_range = var.subnet_cidr - region = var.network_region - network = google_compute_network.default.self_link - project = var.project_id -} - -resource "google_compute_firewall" "coda_daemon_ingress" { - name = "${var.network_name}-daemon-ingress" - network = google_compute_network.default.name - project = var.project_id - - source_ranges = [ "0.0.0.0/0" ] - - allow { - protocol = "tcp" - ports = [ "22" ] - } - - allow { - protocol = "icmp" - } - - allow { - protocol = "tcp" - ports = ["10000-11000", "8303", "8302"] - } - - allow { - protocol = "udp" - ports = ["10000-11000", "8303", "8302"] - } - - source_tags = ["coda-daemon"] -} - diff --git a/automation/terraform/modules/google-cloud/vpc-network/outputs.tf b/automation/terraform/modules/google-cloud/vpc-network/outputs.tf deleted file mode 100644 index 6848650a088..00000000000 --- a/automation/terraform/modules/google-cloud/vpc-network/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "network_link" { - value = google_compute_network.default.self_link -} - -output "network_region" { - value = google_compute_subnetwork.default.region -} - -output "subnet_link" { - value = google_compute_subnetwork.default.self_link -} diff --git a/automation/terraform/modules/google-cloud/vpc-network/variables.tf b/automation/terraform/modules/google-cloud/vpc-network/variables.tf deleted file mode 100644 index a97d2c23065..00000000000 --- a/automation/terraform/modules/google-cloud/vpc-network/variables.tf +++ /dev/null @@ -1,24 +0,0 @@ -variable "project_id" { - description = "The project ID to deploy resources into" -} - -variable "network_name" { - type = string - default = "coda-testnet" -} - -variable "network_region" { - type = string - default = "us-west1" -} - -variable "subnet_name" { - type = string - default = "coda-subnet" -} - -variable "subnet_cidr" { - type = string - default = "10.0.0.0/16" -} - diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/README.md b/automation/terraform/modules/kubernetes/buildkite-agent/README.md deleted file mode 100644 index 3d1a31689a1..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/README.md +++ /dev/null @@ -1,43 +0,0 @@ -

Terraform logo

-

buildkite logo

- -# Buildkite Agent Terraform Module (K8s/GKE) - -## Providers - -| Name | Version | -|------|---------| -| google | n/a | -| helm | n/a | -| kubernetes | n/a | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:-----:| -| cluster\_name | Name of K8s Buildkite Agent cluster to provision | `string` | n/a | yes | -| agent\_topology | Buildkite agent system resource and metadata specification | `map` | `{}` | yes | -| agent\_vcs\_privkey | Agent SSH private key for access to (Github) version control system | `string` | n/a | no | -| agent\_version | Version of Buildkite agent to launch | `string` | 3 | no | -| agent\_config | Buildkite agent configuration options (see: https://github.com/buildkite/charts/blob/master/stable/agent/README.md#configuration) | `map(string)` | `{}` | no | -| helm\_chart | Identifier of Buildkite helm chart. | `string` | `buildkite/agent` | no | -| helm\_repo | Repository URL where to locate the requested Buildkite chart. | `string` | `https://buildkite.github.io/charts/` | no | -| chart\_version | Buildkite chart version to provision | `string` | `0.3.16` | no | -| gsutil\_download\_url | gsutil tool archive download URL | `string` | `https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-296.0.1-linux-x86_64.tar.gz` | no | -| summon\_download\_url | Summon secrets management binary download URL | `string` | `https://github.com/cyberark/summon/releases/download/v0.8.1/summon-linux-amd64.tar.gz` | no | -| secretsmanager\_download\_url | AWS secrets manager summon provider download URL | `string` | `https://github.com/cyberark/summon-aws-secrets/releases/download/v0.3.0/summon-aws-secrets-linux-amd64.tar.gz` | no | -| enable\_gcs\_access | Whether to grant the provisioned cluster with GCS access (for artifact uploading, etc) | `bool` | `true` | no | -| artifact\_upload\_bin | Path to agent artifact upload binary | `string` | `/usr/local/google-cloud-sdk/bin/gsutil` | no | -| artifact\_upload\_path | Path within GCS to upload agent job artifacts | `string` | `gs://buildkite_k8s/coda/shared` | no | -| image\_pullPolicy | Agent container image pull policy | `string` | `IfNotPresent` | no | -| dind\_enabled | Whether to enable a preset Docker-in-Docker(DinD) pod configuration | `bool` | `true` | no | -| k8s\_cluster\_name | Infrastructure Kubernetes cluster to provision Buildkite agents on | `string` | `coda-infra-east` | no | -| k8s\_cluster\_region | Kubernetes cluster region | `string` | `useast-1` | no | -| k8s\_provider | Kubernetes resource provider (currently supports `GKE` and `minikube`) | `string` | `minikube` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| cluster_svc_name | Buildkite cluster Google service account name | -| cluster_svc_email | Buildkite cluster Google service account email identifier | diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/aws.tf b/automation/terraform/modules/kubernetes/buildkite-agent/aws.tf deleted file mode 100644 index c4aa7cc82d8..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/aws.tf +++ /dev/null @@ -1,126 +0,0 @@ -resource "aws_iam_user" "buildkite_aws_user" { - name = "buildkite-${var.cluster_name}" - path = "/service-accounts/" - - force_destroy = true -} - -resource "aws_iam_access_key" "buildkite_aws_key" { - user = aws_iam_user.buildkite_aws_user.name -} - -data "aws_iam_policy_document" "buildkite_aws_policydoc" { - statement { - actions = [ - "secretsmanager:GetSecretValue", - "secretsmanager:ListSecrets", - "secretsmanager:DescribeSecret", - "secretsmanager:TagResource", - "secretsmanager:GetResourcePolicy" - ] - - effect = "Allow" - - # TODO: narrow to buildkite agent pipeline specific set of secrets - resources = [ - "*", - ] - } - - statement { - actions = [ - "s3:GetObject", - "s3:PutObject", - "s3:PutObjectAcl", - "s3:DeleteObject" - ] - - effect = "Allow" - - resources = [ - "arn:aws:s3:::packages.o1test.net/*", - "arn:aws:s3:::snark-keys.o1test.net/*" - ] - } - - statement { - actions = [ - "s3:GetObject", - "s3:PutObject" - ] - - effect = "Allow" - - resources = [ - "arn:aws:s3:::o1labs-terraform-state/*", - "arn:aws:s3:::o1labs-terraform-state-destination/*" - ] - } - - statement { - actions = [ "s3:ListBucket" ] - - effect = "Allow" - - resources = [ - "arn:aws:s3:::o1labs-terraform-state", - "arn:aws:s3:::o1labs-terraform-state-destination" - ] - } - - statement { - actions = [ - "route53:ListHostedZones", - "route53:ListTagsForResource", - "route53:GetHostedZone", - "route53:GetChange", - "route53:ListResourceRecordSets", - "route53:ChangeResourceRecordSets" - ] - - effect = "Allow" - - resources = [ - "*", - ] - } -} - -resource "aws_iam_user_policy" "buildkite_aws_policy" { - name = "buildkite_agent_policy" - user = aws_iam_user.buildkite_aws_user.name - - policy = data.aws_iam_policy_document.buildkite_aws_policydoc.json -} - -data "aws_secretsmanager_secret" "buildkite_docker_token_metadata" { - name = "o1bot/docker/ci-access-token" -} - -data "aws_secretsmanager_secret_version" "buildkite_docker_token" { - secret_id = "${data.aws_secretsmanager_secret.buildkite_docker_token_metadata.id}" -} - -data "aws_secretsmanager_secret" "buildkite_api_token_metadata" { - name = "buildkite/agent/api-token" -} - -data "aws_secretsmanager_secret_version" "buildkite_api_token" { - secret_id = "${data.aws_secretsmanager_secret.buildkite_api_token_metadata.id}" -} - -data "aws_secretsmanager_secret" "npm_token_metadata" { - name = "mina-services/client-sdk/npm_token" -} - -data "aws_secretsmanager_secret_version" "npm_token" { - secret_id = "${data.aws_secretsmanager_secret.npm_token_metadata.id}" -} - -data "aws_secretsmanager_secret" "testnet_logengine_apikey_metadata" { - name = "testnet/gcp/api-key/log-engine" -} - -data "aws_secretsmanager_secret_version" "testnet_logengine_apikey" { - secret_id = "${data.aws_secretsmanager_secret.testnet_logengine_apikey_metadata.id}" -} diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/google_cloud.tf b/automation/terraform/modules/kubernetes/buildkite-agent/google_cloud.tf deleted file mode 100644 index 00028d2350b..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/google_cloud.tf +++ /dev/null @@ -1,53 +0,0 @@ -locals { - gke_project = "o1labs-192920" - gcs_artifact_buckets = [ - "buildkite_k8s", - "coda-charts" - ] - - buildkite_roles = [ - "roles/compute.viewer", - "roles/container.developer", - "roles/container.serviceAgent", - "roles/logging.configWriter", - "roles/stackdriver.accounts.viewer", - "roles/pubsub.editor", - "roles/storage.objectAdmin", - "roles/storage.admin" - ] -} - -resource "google_service_account" "gcp_buildkite_account" { - count = var.enable_gcs_access ? 1 : 0 - - account_id = "buildkite-${var.cluster_name}" - display_name = "Buildkite Agent Cluster (${var.cluster_name}) service account" - description = "GCS service account for Buildkite cluster ${var.cluster_name}" - project = local.gke_project -} - -resource "google_project_iam_member" "buildkite_iam_memberships" { - count = var.enable_gcs_access ? length(local.buildkite_roles) : 0 - - project = local.gke_project - role = local.buildkite_roles[count.index] - member = "serviceAccount:${google_service_account.gcp_buildkite_account[0].email}" -} - -# Grant storage object viewer (read) access to artifacts for all users -resource "google_storage_bucket_iam_binding" "buildkite_gcs_binding" { - count = var.enable_gcs_access ? length(local.gcs_artifact_buckets) : 0 - - bucket =local.gcs_artifact_buckets[count.index] - role = "roles/storage.objectViewer" - - members = [ - "allUsers" - ] -} - -resource "google_service_account_key" "buildkite_svc_key" { - count = var.enable_gcs_access ? 1 : 0 - - service_account_id = google_service_account.gcp_buildkite_account[0].name -} diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/helm.tf b/automation/terraform/modules/kubernetes/buildkite-agent/helm.tf deleted file mode 100644 index 966e4718cf7..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/helm.tf +++ /dev/null @@ -1,382 +0,0 @@ -provider kubernetes { - alias = "bk_deploy" - config_path = "~/.kube/config" - config_context = var.k8s_context -} - -provider helm { - alias = "bk_deploy" - kubernetes { - config_path = "~/.kube/config" - config_context = var.k8s_context - } -} - -# Helm Buildkite Agent Spec -locals { - buildkite_config_envs = [ - # Buildkite EnvVars - { - "name" = "BUILDKITE_GS_APPLICATION_CREDENTIALS_JSON" - "value" = var.enable_gcs_access ? base64decode(google_service_account_key.buildkite_svc_key[0].private_key) : var.google_app_credentials - }, - { - "name" = "GCLOUD_API_KEY" - "value" = data.aws_secretsmanager_secret_version.testnet_logengine_apikey.secret_string - }, - { - "name" = "BUILDKITE_ARTIFACT_UPLOAD_DESTINATION" - "value" = var.artifact_upload_path - }, - { - "name" = "BUILDKITE_API_TOKEN" - "value" = data.aws_secretsmanager_secret_version.buildkite_api_token.secret_string - }, - # Summon EnvVars - { - "name" = "SUMMON_DOWNLOAD_URL" - "value" = var.summon_download_url - }, - { - "name" = "SECRETSMANAGER_DOWNLOAD_URL" - "value" = var.secretsmanager_download_url - }, - # Google Cloud EnvVars - { - # used by GSUTIL tool for accessing GCS data - "name" = "CLUSTER_SERVICE_EMAIL" - "value" = var.enable_gcs_access? google_service_account.gcp_buildkite_account[0].email : "" - }, - { - "name" = "GCLOUDSDK_DOWNLOAD_URL" - "value" = var.gcloudsdk_download_url - }, - { - "name" = "UPLOAD_BIN" - "value" = var.artifact_upload_bin - }, - { - "name" = "CODA_HELM_REPO" - "value" = var.coda_helm_repo - }, - { - "name" = "KUBE_CONFIG_PATH" - "value" = "/root/.kube/config" - }, - # AWS EnvVars - { - "name" = "AWS_ACCESS_KEY_ID" - "value" = aws_iam_access_key.buildkite_aws_key.id - }, - { - "name" = "AWS_SECRET_ACCESS_KEY" - "value" = aws_iam_access_key.buildkite_aws_key.secret - }, - { - "name" = "AWS_REGION" - "value" = "us-west-2" - }, - # Docker EnvVars - { - "name" = "DOCKER_PASSWORD" - "value" = data.aws_secretsmanager_secret_version.buildkite_docker_token.secret_string - }, - # NPM EnvVars - { - "name" = "NPM_TOKEN" - "value" = data.aws_secretsmanager_secret_version.npm_token.secret_string - } - ] -} - -locals { - default_agent_vars = { - image = { - tag = var.agent_version - pullPolicy = var.image_pullPolicy - } - - privateSshKey = var.agent_vcs_privkey - - # Using Buildkite's config-setting <=> env-var mapping, convert all k,v's stored within agent config as extra environment variables - # in order to specify custom configuration (see: https://buildkite.com/docs/agent/v3/configuration#configuration-settings) - extraEnv = concat(local.buildkite_config_envs, - [for key, value in var.agent_config : { "name" : "BUILDKITE_$(upper(key))", "value" : value }]) - - dind = { - enabled = var.dind_enabled - } - - podAnnotations = { - "prometheus.io/scrape" = "true" - "prometheus.io/path" = "/metrics" - } - - rbac = { - create = true - role = { - rules = [ - { - apiGroups = [ - "", - "apps", - "batch" - ], - resources = [ - "*" - ], - verbs = [ - "get", - "list", - "watch" - ] - } - ] - } - } - - entrypointd = { - "00-artifact-cache-helper" = <<-EOF - #!/bin/bash - - set -o pipefail - - if [[ $1 ]]; then - export BUILDKITE_ARTIFACT_UPLOAD_DESTINATION="gs://buildkite_k8s/coda/shared/$${BUILDKITE_JOB_ID}" - FILE="$1" - DOWNLOAD_CMD="buildkite-agent artifact download --build $${BUILDKITE_BUILD_ID} --include-retried-jobs" - - while [[ "$#" -gt 0 ]]; do case $1 in - --upload) UPLOAD="true"; shift;; - --miss-cmd) MISS_CMD="$${2}"; shift;; - esac; shift; done - - # upload artifact if explicitly set and exit - if [[ $UPLOAD ]]; then - echo "--- Uploading artifact: $${FILE}" - pushd $(dirname $FILE) - buildkite-agent artifact upload "$(basename $FILE)"; popd - exit - fi - - set +e - if [[ -f "$${FILE}" ]] || $${DOWNLOAD_CMD} "$${FILE}" .; then - set -e - echo "*** Cache Hit -- skipping step ***" - elif [[ $${MISS_CMD} ]]; then - set -e - echo "*** Cache miss -- executing step ***" - bash -c "$${MISS_CMD}" - - echo "--- Uploading artifact: $${FILE}" - pushd $(dirname $FILE) - buildkite-agent artifact upload "$${FILE}"; popd - else - echo "*** Cache miss -- failing since a miss command was NOT provided ***" - exit 1 - fi - else - echo "*** Artifact not provided - skipping ***" - fi - EOF - - "00-fix-letsencrypt-cert" = <<-EOF - #!/bin/bash - # workarounds from https://github.com/nodesource/distributions/issues/1266 - apt-get -y update && apt-get -y install ca-certificates - rm /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt - dpkg-reconfigure ca-certificates - update-ca-certificates - EOF - - "01-install-gcloudsdk" = <<-EOF - #!/bin/bash - - set -euo pipefail - set +x - - if [[ ! -f $${UPLOAD_BIN} ]]; then - echo "Downloading gcloud sdk because it doesn't exist" - apt-get -y update && apt install -y wget python && wget $${GCLOUDSDK_DOWNLOAD_URL} - - tar -zxf $(basename $${GCLOUDSDK_DOWNLOAD_URL}) -C /usr/local/ - - # create local user bin symlinks for easier PATH access - ln --symbolic --force /usr/local/google-cloud-sdk/bin/gsutil /usr/local/bin/gsutil - ln --symbolic --force /usr/local/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud - ln --symbolic --force /usr/local/google-cloud-sdk/bin/docker-credential-gcloud /usr/local/bin/docker-credential-gcloud - - echo "$${BUILDKITE_GS_APPLICATION_CREDENTIALS_JSON}" > /tmp/gcp_creds.json - - export GOOGLE_APPLICATION_CREDENTIALS=/tmp/gcp_creds.json && /usr/local/google-cloud-sdk/bin/gcloud auth activate-service-account $${CLUSTER_SERVICE_EMAIL} --key-file /tmp/gcp_creds.json - - # enable GCR write access - gcloud components install --quiet docker-credential-gcr - gcloud auth configure-docker --quiet gcr.io - fi - EOF - - "01-install-summon" = <<-EOF - #!/bin/bash - - set -euo pipefail - set +x - - export SUMMON_BIN=/usr/local/bin/summon - export SECRETSMANAGER_LIB=/usr/local/lib/summon/summon-aws-secrets - - # download and install summon binary executable - if [[ ! -f $${SUMMON_BIN} ]]; then - echo "Downloading summon because it doesn't exist" - apt-get -y update && apt install -y wget && wget $${SUMMON_DOWNLOAD_URL} - - tar -xzf $(basename $${SUMMON_DOWNLOAD_URL}) -C /usr/local/bin/ - fi - - # download and install summon AWS Secrets provider - if [[ ! -f $${SECRETSMANAGER_LIB} ]]; then - echo "Downloading summon AWS secrets manager because it doesn't exist" - wget $${SECRETSMANAGER_DOWNLOAD_URL} - - mkdir -p $(dirname $${SECRETSMANAGER_LIB}) - tar -xzf $(basename $${SECRETSMANAGER_DOWNLOAD_URL}) -C $(dirname $${SECRETSMANAGER_LIB}) - fi - EOF - - "02-install-k8s-tools" = <<-EOF - #!/bin/bash - - set -euo pipefail - set +x - - export CI_SHARED_BIN="/var/buildkite/shared/bin" - mkdir -p "$${CI_SHARED_BIN}" - - # Install kubectl - apt-get update --yes && apt-get install --yes lsb-core apt-transport-https curl jq - - export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)" - echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \ - && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \ - && apt-get update --quiet --yes \ - && apt-get install --quiet --yes --no-install-recommends google-cloud-sdk kubectl google-cloud-sdk-gke-gcloud-auth-plugin \ - && rm -rf /var/lib/apt/lists/* - - export USE_GKE_GCLOUD_AUTH_PLUGIN=True - - - # Install helm - curl https://baltocdn.com/helm/signing.asc | apt-key add - - echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sources.list.d/helm-stable-debian.list - apt-get update -y && apt-get install helm -y --allow-unauthenticated - cp --update --verbose $(which helm) "$${CI_SHARED_BIN}/helm" - EOF - - "02-install-terraform" = <<-EOF - #!/bin/bash - - set -euo pipefail - - apt install -y unzip - curl -sL https://releases.hashicorp.com/terraform/0.14.7/terraform_0.14.7_linux_amd64.zip -o terraform.zip - unzip terraform.zip && mv terraform /usr/bin - - # Install custom versions of terraform in Buildkite shared DIR - curl -sL https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip -o terraform-0_12_29.zip - mkdir -p /var/buildkite/shared/terraform/0.12.29 - unzip terraform-0_12_29.zip && mv terraform /var/buildkite/shared/terraform/0.12.29/terraform - EOF - - "02-install-coda-network-tools" = <<-EOF - #!/bin/bash - - set -euo pipefail - - # Download and install NodeJS - curl -sL https://deb.nodesource.com/setup_12.x | bash - - apt-get install -y nodejs libjemalloc-dev - - # Build coda-network library - mkdir -p /tmp/mina && git clone https://github.com/MinaProtocol/mina.git /tmp/mina - cd /tmp/mina/automation && npm install -g && npm install -g yarn - yarn install && yarn build - chmod +x bin/coda-network && ln --symbolic --force bin/coda-network /usr/local/bin/coda-network - EOF - - "02-install-cortextool" = <<-EOF - #!/bin/bash - - set -euo pipefail - - curl -fSL -o /usr/local/bin/cortextool "https://github.com/grafana/cortex-tools/releases/download/v0.7.2/cortextool_0.7.2_linux_x86_64" - chmod a+x /usr/local/bin/cortextool - EOF - - "03-setup-k8s-ctx" = <<-EOF - #!/bin/bash - - set -euo pipefail - - # k8s_ctx = __ - # k8s context mappings: => - declare -A k8s_ctx_mappings=( - ["coda-infra-east"]="us-east1" - ["coda-infra-east4"]="us-east4" - ["coda-infra-central1"]="us-central1" - ["mina-integration-west1"]="us-west1" - ) - for cluster in "$${!k8s_ctx_mappings[@]}"; do - gcloud container clusters get-credentials "$${cluster}" --region "$${k8s_ctx_mappings[$cluster]}" - done - - # Copy kube config to shared Docker path - export CI_SHARED_CONFIG="/var/buildkite/shared/config" - mkdir -p "$${CI_SHARED_CONFIG}" - cp "$${KUBE_CONFIG_PATH:-/root/.kube/config}" "$${CI_SHARED_CONFIG}/.kube" && chmod ugo+rw "$${CI_SHARED_CONFIG}/.kube" - - # set agent default Kubernetes context for deployment - kubectl config use-context ${var.testnet_k8s_ctx} - EOF - - "03-setup-utiltiies" = <<-EOF - #!/bin/bash - - set -euo pipefail - - # Ensure artifact cache helper tool is in PATH - ln --symbolic --force /docker-entrypoint.d/00-artifact-cache-helper /usr/local/bin/artifact-cache-helper.sh - - # Install mina debian package tools - echo "deb [trusted=yes] http://packages.o1test.net stretch stable" > /etc/apt/sources.list.d/o1.list - apt-get update && apt-get install -y tzdata mina-devnet - EOF - } - } -} - -resource "kubernetes_namespace" "cluster_namespace" { - provider = kubernetes.bk_deploy - - metadata { - name = var.cluster_name - } -} - -resource "helm_release" "buildkite_agents" { - for_each = var.agent_topology - - provider = helm.bk_deploy - - name = "${var.cluster_name}-buildkite-${each.key}" - repository = "buildkite" - chart = var.helm_chart - namespace = var.cluster_namespace - create_namespace = true - version = var.chart_version - - values = [ - yamlencode(merge(local.default_agent_vars, each.value)) - ] - - wait = false -} diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/outputs.tf b/automation/terraform/modules/kubernetes/buildkite-agent/outputs.tf deleted file mode 100644 index 68b33d2ef6e..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/outputs.tf +++ /dev/null @@ -1,9 +0,0 @@ -output "cluster_svc_name" { - - value = var.enable_gcs_access ? google_service_account.gcp_buildkite_account[0].name : "custom" -} - -output "cluster_svc_email" { - - value = var.enable_gcs_access ? google_service_account.gcp_buildkite_account[0].email : "custom" -} diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/secrets.tf b/automation/terraform/modules/kubernetes/buildkite-agent/secrets.tf deleted file mode 100644 index fafe1c8e175..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/secrets.tf +++ /dev/null @@ -1,19 +0,0 @@ -resource "kubernetes_secret" "google_application_credentials" { - provider = kubernetes.bk_deploy - - count = var.enable_gcs_access ? 1 : 0 - - metadata { - name = "google-application-credentials" - namespace = kubernetes_namespace.cluster_namespace.metadata[0].name - annotations = { - "kubernetes.io/service-account.name" = google_service_account.gcp_buildkite_account[0].name, - "kubernetes.io/service-account.namespace" = kubernetes_namespace.cluster_namespace.metadata[0].name - } - } - - data = { - "credentials_json" = "${var.enable_gcs_access ? google_service_account_key.buildkite_svc_key[0].private_key : var.google_app_credentials}" - } -} - diff --git a/automation/terraform/modules/kubernetes/buildkite-agent/variables.tf b/automation/terraform/modules/kubernetes/buildkite-agent/variables.tf deleted file mode 100644 index 669e0b0b61c..00000000000 --- a/automation/terraform/modules/kubernetes/buildkite-agent/variables.tf +++ /dev/null @@ -1,147 +0,0 @@ -# GCP/K8s Cluster Vars - -variable "google_app_credentials" { - type = string - - description = "Google application credentials for enabling upload/download to GCS" - default = "" -} - -variable "enable_gcs_access" { - type = bool - - description = "Whether to grant the provisioned cluster with GCS access (for artifact uploading, etc)" - default = true -} - -variable "k8s_context" { - type = string - - description = "K8s resource provider context" - default = "minikube" -} - -variable "testnet_k8s_ctx" { - type = string - - description = "Default k8s resource provider context for deploying testnets" - default = "gke_o1labs-192920_us-west1_mina-integration-west1" -} - -# Module Vars: Agent - -variable "cluster_name" { - type = string - - description = "Name of K8s Buildkite Agent cluster to provision" -} - -variable "cluster_namespace" { - type = string - - description = "Name of K8s namespace to provision cluster under" -} - -variable "agent_topology" { - description = "Buildkite agent compute resource topology - system resource requests> (see: https://github.com/buildkite/charts/blob/master/stable/agent/values.yaml#L74)" -} - -variable "agent_vcs_privkey" { - type = string - - description = "Agent SSH private key for access to (Github) version control system" - default = "" -} - -variable "agent_config" { - type = map(string) - - description = "Buildkite agent configuration options (see: https://github.com/buildkite/charts/blob/master/stable/agent/README.md#configuration)" - default = {} -} - -variable "gcloudsdk_download_url" { - type = string - - description = "gcloud sdk tool archive download URL" - default = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-296.0.1-linux-x86_64.tar.gz" -} - -variable "artifact_upload_bin" { - type = string - - description = "Path to agent artifact upload binary" - default = "/usr/local/google-cloud-sdk/bin/gsutil" -} - -variable "artifact_upload_path" { - type = string - - description = "Path to upload agent job artifacts" - default = "gs://buildkite_k8s/coda/shared" -} - -# Module Vars: Summon secrets management -variable "summon_download_url" { - type = string - - description = "Summon secrets management binary download URL" - default = "https://github.com/cyberark/summon/releases/download/v0.8.1/summon-linux-amd64.tar.gz" -} - -variable "secretsmanager_download_url" { - type = string - - description = "AWS secrets manager summon provider download URL" - default = "https://github.com/cyberark/summon-aws-secrets/releases/download/v0.3.0/summon-aws-secrets-linux-amd64.tar.gz" -} - -# Module Vars: Helm Chart -variable "helm_chart" { - type = string - - description = "Identifier of Buildkite helm chart." - default = "buildkite/agent" -} - -variable "helm_repo" { - type = string - - description = "Repository URL where to locate the requested chart Buildkite chart." - default = "https://buildkite.github.io/charts/" -} - -variable "coda_helm_repo" { - type = string - - description = "Repository URL where to locate Coda developed Helm charts." - default = "gs://coda-charts" -} - -variable "agent_version" { - type = string - - description = "Version of Buildkite agent to launch" - default = "3.25.0-ubuntu" -} - -variable "chart_version" { - type = string - - description = "Buildkite chart version to provision" - default = "0.4.6" -} - -variable "image_pullPolicy" { - type = string - - description = "Agent container image pull policy" - default = "IfNotPresent" -} - -variable "dind_enabled" { - type = bool - - description = "Whether to enable a preset Docker-in-Docker(DinD) pod configuration" - default = true -} diff --git a/automation/terraform/modules/kubernetes/testnet/README.md b/automation/terraform/modules/kubernetes/testnet/README.md deleted file mode 100644 index 5d3b37c7e43..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# Testnet Terraform Module (K8s/GKE) - -## Providers - -| Name | Version | -|------|---------| -| google | n/a | -| helm | n/a | -| kubernetes | n/a | - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:-----:| -| additional\_seed\_peers | n/a | `list` | `[]` | no | -| block\_producer\_key\_pass | n/a | `string` | n/a | yes | -| block\_producer\_starting\_host\_port | n/a | `number` | `10000` | no | -| cluster\_name | n/a | `string` | n/a | yes | -| cluster\_region | n/a | `string` | n/a | yes | -| coda\_image | n/a | `string` | `"codaprotocol/coda-daemon:0.0.13-beta-master-99d1e1f"` | no | -| fish\_block\_producer\_label\_offset | n/a | `number` | `0` | no | -| num\_fish\_block\_producers | n/a | `number` | `5` | no | -| num\_whale\_block\_producers | n/a | `number` | `3` | no | -| seed\_discovery\_keypairs | n/a | `list` |
[
"CAESQNf7ldToowe604aFXdZ76GqW/XVlDmnXmBT+otorvIekBmBaDWu/6ZwYkZzqfr+3IrEh6FLbHQ3VSmubV9I9Kpc=,CAESIAZgWg1rv+mcGJGc6n6/tyKxIehS2x0N1Uprm1fSPSqX,12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr",
"CAESQKtOnmYHQacRpNvBZDrGLFw/tVB7V4I14Y2xtGcp1sEsEyfcsNoFi7NnUX0T2lQDGQ31KvJRXJ+u/f9JQhJmLsI=,CAESIBMn3LDaBYuzZ1F9E9pUAxkN9SryUVyfrv3/SUISZi7C,12D3KooWB79AmjiywL1kMGeKHizFNQE9naThM2ooHgwFcUzt6Yt1"
]
| no | -| seed\_region | n/a | `string` | `"us-west1"` | no | -| seed\_zone | n/a | `string` | `"us-west1-a"` | no | -| snark\_worker\_fee | n/a | `number` | `10` | no | -| snark\_worker\_host\_port | n/a | `number` | `10400` | no | -| snark\_worker\_public\_key | n/a | `string` | `"4vsRCVadXwWMSGA9q81reJRX3BZ5ZKRtgZU7PtGsNq11w2V9tUNf4urZAGncZLUiP4SfWqur7AZsyhJKD41Ke7rJJ8yDibL41ePBeATLUnwNtMTojPDeiBfvTfgHzbAVFktD65vzxMNCvvAJ"` | no | -| snark\_worker\_replicas | n/a | `number` | `1` | no | -| testnet\_name | n/a | `string` | `"coda-testnet"` | no | - -## Outputs - -| Name | Description | -|------|-------------| -| seed\_addresses | n/a | -| seed\_one\_ip | n/a | -| seed\_two\_ip | n/a | - diff --git a/automation/terraform/modules/kubernetes/testnet/helm.tf b/automation/terraform/modules/kubernetes/testnet/helm.tf deleted file mode 100644 index d346996430a..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/helm.tf +++ /dev/null @@ -1,178 +0,0 @@ -# Cluster-Local Seed Node - -resource "kubernetes_role_binding" "helm_release" { - metadata { - name = "admin-role" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - } - - role_ref { - api_group = "rbac.authorization.k8s.io" - kind = "ClusterRole" - name = "admin" - } - - subject { - kind = "ServiceAccount" - name = "default" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - } -} - -resource "helm_release" "seeds" { - provider = helm.testnet_deploy - count = length(local.seed_vars.seedConfigs) > 0 ? 1 : 0 - - name = "${var.testnet_name}-seeds" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/seed-node" : "seed-node" - version = "1.0.11" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.seed_vars) - ] - wait = false - timeout = 600 - depends_on = [ - kubernetes_role_binding.helm_release - ] -} - -# Block Producer - -resource "helm_release" "block_producers" { - provider = helm.testnet_deploy - count = length(local.block_producer_vars.blockProducerConfigs) > 0 ? 1 : 0 - - name = "${var.testnet_name}-block-producers" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/block-producer" : "block-producer" - version = "1.0.10" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.block_producer_vars) - ] - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} - -# Plain nodes - -resource "helm_release" "plain_nodes" { - provider = helm.testnet_deploy - count = length(local.plain_node_vars) - name = "${var.testnet_name}-plain-node-${count.index + 1}" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/plain-node" : "plain-node" - version = "1.0.6" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.plain_node_vars[count.index]) - ] - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} - -# Snark Worker -resource "helm_release" "snark_workers" { - provider = helm.testnet_deploy - count = length(local.snark_vars) - - name = "${var.testnet_name}-snark-set-${count.index + 1}" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/snark-worker" : "snark-worker" - version = "1.0.9" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.snark_vars[count.index]) - ] - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} - -# Archive Node - -resource "helm_release" "archive_node" { - provider = helm.testnet_deploy - count = length(local.archive_vars) - - name = "archive-${count.index + 1}" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/archive-node" : "archive-node" - version = "1.1.7" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.archive_vars[count.index]) - ] - - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} - -# Watchdog - -resource "helm_release" "watchdog" { - provider = helm.testnet_deploy - count = var.deploy_watchdog ? 1 : 0 - - name = "${var.testnet_name}-watchdog" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/watchdog" : "watchdog" - version = "0.1.0" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.watchdog_vars) - ] - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} - -# zkApps Dashboard - -resource "helm_release" "zkapps-dashboard" { - provider = helm.testnet_deploy - - name = "zkapps-dashboard" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/zkapps-dashboard" : "zkapps-dashboard" - version = "0.1.2" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - - set { - name = "postgresql.primary.initdb.password" - value = var.zkapps_dashboard_key - } - - set { - name = "postgresql.auth.password" - value = var.zkapps_dashboard_key - } - - wait = false - timeout = 600 - depends_on = [helm_release.archive_node] -} - -# itn orchestrator - -resource "helm_release" "itn-orchestrator" { - provider = helm.testnet_deploy - count = var.expose_itn_graphql ? 1 : 0 - - name = "${var.testnet_name}-itn-orchestrator" - repository = var.use_local_charts ? "" : local.mina_helm_repo - chart = var.use_local_charts ? "../../../../helm/itn-orchestrator" : "itn-orchestrator" - version = "0.1.0" - namespace = kubernetes_namespace.testnet_namespace.metadata[0].name - values = [ - yamlencode(local.itn_orchestrator_vars) - ] - wait = false - timeout = 600 - depends_on = [helm_release.seeds] -} \ No newline at end of file diff --git a/automation/terraform/modules/kubernetes/testnet/kubernetes.tf b/automation/terraform/modules/kubernetes/testnet/kubernetes.tf deleted file mode 100644 index 9099ee0169b..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/kubernetes.tf +++ /dev/null @@ -1,16 +0,0 @@ -data "google_client_config" "current" {} - -provider "kubernetes" { - alias = "testnet_deploy" - config_context = var.k8s_context -} - -resource "kubernetes_namespace" "testnet_namespace" { - metadata { - name = var.testnet_name - } - - timeouts { - delete = "15m" - } -} diff --git a/automation/terraform/modules/kubernetes/testnet/locals.tf b/automation/terraform/modules/kubernetes/testnet/locals.tf deleted file mode 100644 index 686d01aab29..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/locals.tf +++ /dev/null @@ -1,231 +0,0 @@ -provider "helm" { - alias = "testnet_deploy" - kubernetes { - config_context = var.k8s_context - } -} - -locals { - mina_helm_repo = "https://coda-charts.storage.googleapis.com" - - # peers = var.additional_peers - - healthcheck_vars = { - enabled = var.healthcheck_enabled - failureThreshold = 60 - periodSeconds = 5 - initialDelaySeconds = 30 - } - - seed_vars = { - testnetName = var.testnet_name - mina = { - runtimeConfig = var.runtime_config - image = var.mina_image - useCustomEntrypoint = var.use_custom_entrypoint - customEntrypoint = var.custom_entrypoint - // TODO: Change this to a better name - seedPeers = var.additional_peers - logLevel = var.log_level - startFilteredLogs = var.start_filtered_logs - logSnarkWorkGossip = var.log_snark_work_gossip - logTxnPoolGossip = var.log_txn_pool_gossip - ports = { - client = "8301" - graphql = "3085" - metrics = "8081" - p2p = var.seed_external_port - } - itn = { - port = "3086" - keys = var.itn_keys - } - uploadBlocksToGCloud = var.upload_blocks_to_gcloud - exposeGraphql = var.expose_graphql - exposeItnGraphql = var.expose_itn_graphql - } - - priorityClass = var.priority_class - persist_working_dir = var.enable_working_dir_persitence - - seedConfigs = [ - for index, config in var.seed_configs : { - name = config.name - class = config.class - libp2pSecret = config.libp2p_secret - libp2pSecretPassword = config.libp2p_secret_pw - # privateKeySecret = config.private_key_secret - # externalPort = config.external_port - externalIp = config.external_ip - enableArchive = config.enableArchive - archiveAddress = config.archiveAddress - } - ] - - healthcheck = local.healthcheck_vars - - } - - daemon = { - runtimeConfig = var.runtime_config - image = var.mina_image - useCustomEntrypoint = var.use_custom_entrypoint - customEntrypoint = var.custom_entrypoint - # privkeyPass = var.block_producer_key_pass - seedPeers = var.additional_peers - logLevel = var.log_level - logSnarkWorkGossip = var.log_snark_work_gossip - logPrecomputedBlocks = var.log_precomputed_blocks - startFilteredLogs = var.start_filtered_logs - logTxnPoolGossip = var.log_txn_pool_gossip - uploadBlocksToGCloud = var.upload_blocks_to_gcloud - # seedPeersURL = var.seed_peers_url - exposeGraphql = var.expose_graphql - exposeItnGraphql = var.expose_itn_graphql - cpuRequest = var.cpu_request - memRequest= var.mem_request - } - - block_producer_vars = { - testnetName = var.testnet_name - - mina = local.daemon - - healthcheck = local.healthcheck_vars - - userAgent = { - image = var.mina_agent_image - minFee = var.agent_min_fee - maxFee = var.agent_max_fee - minTx = var.agent_min_tx - maxTx = var.agent_max_tx - txBatchSize = var.agent_tx_batch_size - sendEveryMins = var.agent_send_every_mins - ports = { metrics : 8000 } - } - - bots = { - image = var.mina_bots_image - faucet = { - amount = var.mina_faucet_amount - fee = var.mina_faucet_fee - } - } - - blockProducerConfigs = [ - for index, config in var.block_producer_configs : { - name = config.name - class = config.class - externalPort = config.external_port - runWithUserAgent = config.run_with_user_agent - runWithBots = config.run_with_bots - enableGossipFlooding = config.enable_gossip_flooding - keypairName = config.keypair_name - # privateKey = config.private_key - # publicKey = config.private_key - privateKeyPW = config.privkey_password - libp2pSecret = config.libp2p_secret - enablePeerExchange = config.enable_peer_exchange - isolated = config.isolated - enableArchive = config.enableArchive - archiveAddress = config.archiveAddress - } - ] - priorityClass = var.priority_class - persist_working_dir = var.enable_working_dir_persitence - } - - archive_vars = [for item in var.archive_configs : { - testnetName = var.testnet_name - mina = local.daemon - healthcheck = local.healthcheck_vars - archive = item - postgresql = { - persistence = { - enabled = item["persistenceEnabled"] - size = item["persistenceSize"] - storageClass = item["persistenceStorageClass"] - accessModes = item["persistenceAccessModes"] - } - primary = { - affinity = { - nodeAffinity = { - requiredDuringSchedulingIgnoredDuringExecution = { - nodeSelectorTerms = [ - { - matchExpressions = [ - { - key = "cloud.google.com/gke-spot" - operator = item["spotAllowed"] ? "In" : "NotIn" - values = ["true"] - } - ] - } - ] - } - } - } - } - } - priorityClass = var.priority_class - persist_working_dir = var.enable_working_dir_persitence - }] - - snark_vars = [ - for i, snark in var.snark_coordinators: { - testnetName = var.testnet_name - mina = local.daemon - healthcheck = local.healthcheck_vars - - # coordinatorName = "snark-coordinator-${lower(substr(snark.snark_worker_public_key,-6,-1))}" - coordinatorName = snark.snark_coordinator_name - # workerName = "snark-worker-${lower(substr(snark.snark_worker_public_key,-6,-1))}" - workerName = "${snark.snark_coordinator_name}-worker" - workerReplicas = snark.snark_worker_replicas - coordinatorHostName = "${snark.snark_coordinator_name}.${var.testnet_name}" - coordinatorRpcPort = 8301 - coordinatorHostPort = snark.snark_coordinators_host_port - publicKey = snark.snark_worker_public_key - snarkFee = snark.snark_worker_fee - workSelectionAlgorithm = "seq" - - workerCpuRequest = var.worker_cpu_request - workerMemRequest = var.worker_mem_request - priorityClass = var.priority_class - persist_working_dir = var.enable_working_dir_persitence - } - ] - - plain_node_vars = [ - for i, node in var.plain_node_configs: { - testnetName = var.testnet_name - mina = local.daemon - healthcheck = local.healthcheck_vars - name = node.name - priorityClass = var.priority_class - persist_working_dir = var.enable_working_dir_persitence - } - ] - - watchdog_vars = { - testnetName = var.testnet_name - image = var.watchdog_image - mina = { - image = var.mina_image - ports = { metrics : 8000 } - uploadBlocksToGCloud = var.upload_blocks_to_gcloud - } - restartEveryMins = var.restart_nodes_every_mins - restartNodes = var.restart_nodes - makeReports = var.make_reports - makeReportEveryMins = var.make_report_every_mins - makeReportDiscordWebhookUrl = var.make_report_discord_webhook_url - makeReportAccounts = var.make_report_accounts - seedPeersURL = var.additional_peers - } - - itn_orchestrator_vars = { - testnetName = var.testnet_name - image = var.itn_orchestrator_image - } -} diff --git a/automation/terraform/modules/kubernetes/testnet/outputs.tf b/automation/terraform/modules/kubernetes/testnet/outputs.tf deleted file mode 100644 index 6160cecc268..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/outputs.tf +++ /dev/null @@ -1,19 +0,0 @@ -output "testnet_namespace" { - value = kubernetes_namespace.testnet_namespace -} - -output "seeds_release" { - value = helm_release.seeds -} - -output "archive_nodes_release" { - value = helm_release.archive_node -} - -output "block_producers_release" { - value = helm_release.block_producers -} - -output "snark_workers_release" { - value = helm_release.snark_workers -} diff --git a/automation/terraform/modules/kubernetes/testnet/variables.tf b/automation/terraform/modules/kubernetes/testnet/variables.tf deleted file mode 100644 index 064337a8a3a..00000000000 --- a/automation/terraform/modules/kubernetes/testnet/variables.tf +++ /dev/null @@ -1,401 +0,0 @@ -# terraform { -# experiments = [module_variable_optional_attrs] -# } - -# K8s Cluster Vars - -variable "cluster_name" { - type = string -} - -variable "cluster_region" { - type = string -} - -variable "k8s_context" { - type = string - - description = "K8s resource provider context" - default = "gke_o1labs-192920_us-east1_coda-infra-east" -} - -# Global Vars - -variable "expose_graphql" { - type = bool - default = false -} - -variable "expose_itn_graphql" { - type = bool - default = false -} - -variable "itn_keys" { - type = string - default = "" -} - -variable "use_local_charts" { - type = bool - default = false -} - -variable "healthcheck_enabled" { - type = bool - default = true -} - -variable "deploy_watchdog" { - type = bool - default = true -} - -variable "mina_image" { - type = string - default = "gcr.io/o1labs-192920/mina-daemon:1.2.0beta8-5b35b27-devnet" -} - -variable "use_custom_entrypoint" { - type = bool - default = false -} - -variable "custom_entrypoint" { - type = string - default = "" -} - -variable "mina_archive_image" { - type = string - default = "" -} - -variable "mina_archive_schema" { - type = string - default = "" -} - -variable "mina_archive_schema_aux_files" { - type = list(string) - default = [] -} - -variable "archive_node_count" { - type = number - default = 0 -} - -variable "mina_agent_image" { - type = string - default = "codaprotocol/coda-user-agent:0.1.4" -} - -variable "priority_class" { - type = string - default = null -} - -#this var doesn't actually hook up to anything -variable "mina_agent_active" { - type = string - default = "true" -} - -variable "mina_bots_image" { - type = string - default = "" -} - -variable "mina_points_image" { - type = string - default = "" -} - -variable "watchdog_image" { - type = string - default = "gcr.io/o1labs-192920/watchdog:latest" -} - -variable "itn_orchestrator_image" { - type = string - default = "gcr.io/o1labs-192920/itn_orchestrator_image:latest" -} - - -# this must be a string to avoid scientific notation truncation -variable "mina_faucet_amount" { - type = string - default = "10000000000" -} - -# this must be a string to avoid scientific notation truncation -variable "mina_faucet_fee" { - type = string - default = "100000000" -} - -variable "testnet_name" { - type = string - default = "mina-testnet" -} - -variable "additional_peers" { - type = list(any) - default = [] -} - -variable "runtime_config" { - type = string - default = "" -} - -variable "log_snark_work_gossip" { - type = bool - default = false -} - -variable "log_precomputed_blocks" { - type = bool - default = false -} - -variable "start_filtered_logs" { - type = list(string) - default = [] -} - -variable "log_txn_pool_gossip" { - type = bool - default = false -} - -variable "cpu_request" { - type = number - default = 0 -} - -variable "mem_request" { - type = string - default = "0Mi" -} - -# Seed Vars - -variable "seed_region" { - type = string - default = "us-west1" -} - -variable "seed_zone" { - type = string - default = "us-west1-a" -} - -# variable "seed_discovery_keypairs" { -# type = list(any) -# default = [ -# "CAESQNf7ldToowe604aFXdZ76GqW/XVlDmnXmBT+otorvIekBmBaDWu/6ZwYkZzqfr+3IrEh6FLbHQ3VSmubV9I9Kpc=,CAESIAZgWg1rv+mcGJGc6n6/tyKxIehS2x0N1Uprm1fSPSqX,12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr", -# "CAESQKtOnmYHQacRpNvBZDrGLFw/tVB7V4I14Y2xtGcp1sEsEyfcsNoFi7NnUX0T2lQDGQ31KvJRXJ+u/f9JQhJmLsI=,CAESIBMn3LDaBYuzZ1F9E9pUAxkN9SryUVyfrv3/SUISZi7C,12D3KooWB79AmjiywL1kMGeKHizFNQE9naThM2ooHgwFcUzt6Yt1" -# ] -# } - -variable "seed_external_port" { - type = string - default = "10001" -} - -variable "seed_configs" { - type = list( - object({ - name = string, - class = string, - libp2p_secret = string, - libp2p_secret_pw = string - external_ip = string, - enableArchive = bool, - archiveAddress = string - persist_working_dir = bool, - }) - ) - default = [] -} - -# Block Producer Vars - -variable "log_level" { - type = string - default = "Trace" -} - -variable "block_producer_key_pass" { - type = string - default = "naughty blue worm" -} - -variable "block_producer_configs" { - type = list( - object({ - name = string, - class = string, - keypair_name = string, - privkey_password = string, - external_port = number, - libp2p_secret = string, - enable_gossip_flooding = bool, - enable_peer_exchange = bool, - isolated = bool, - run_with_user_agent = bool, - run_with_bots = bool, - enableArchive = bool, - archiveAddress = string - persist_working_dir = bool, - }) - ) - default = [] -} - -variable "plain_node_configs" { - default = null -} - -# Snark Worker Vars -variable "snark_coordinators" { - type = list( - object({ - - snark_coordinator_name = string - snark_worker_replicas = number - snark_worker_fee = number - snark_worker_public_key = string - snark_coordinators_host_port = number - persist_working_dir = bool - })) - default = [] -} - -variable "agent_min_fee" { - type = string - default = "" -} - -variable "agent_max_fee" { - type = string - default = "" -} - -variable "agent_min_tx" { - type = string - default = "" -} - -variable "agent_max_tx" { - type = string - default = "" -} - -variable "agent_tx_batch_size" { - type = string - default = "" -} - -variable "agent_send_every_mins" { - type = string - default = "" -} - -variable "gcloud_seeds" { - type = list(any) - default = [] -} - -variable "worker_cpu_request" { - type = number - default = 0 -} - -variable "worker_mem_request" { - type = string - default = "0Mi" -} - -# Mina network services vars - -variable "restart_nodes" { - type = bool - default = true -} - -variable "restart_nodes_every_mins" { - type = string - default = "60" -} - -variable "make_report_every_mins" { - type = string - default = "30" -} - -variable "make_reports" { - type = bool - default = true -} - -variable "make_report_discord_webhook_url" { - type = string - default = "" -} - -variable "make_report_accounts" { - type = string - default = "" -} - -# Archive | Postgres Vars - -variable "archive_configs" { - type = list( - object({ - name = string - image = string - serverPort = string - externalPort = string - enableLocalDaemon = bool - enablePostgresDB = bool - - postgresHost = string - postgresPort = string - remoteSchemaFile = string - remoteSchemaAuxFiles = list(string) - - persistenceEnabled = bool - persistenceSize = string - persistenceStorageClass = string - persistenceAccessModes = list(string) - spotAllowed = string - persist_working_dir = bool - }) - ) - default = [] -} - -variable "upload_blocks_to_gcloud" { - type = bool - default = false -} - -# variable "seed_peers_url" { -# type = string -# default = "" -# } - -variable "zkapps_dashboard_key" { - type = string - default = "" -} - - -variable "enable_working_dir_persitence" { - type = bool - default = false -} diff --git a/automation/terraform/modules/o1-integration/graphql_ingress.tf b/automation/terraform/modules/o1-integration/graphql_ingress.tf deleted file mode 100644 index 54528d44878..00000000000 --- a/automation/terraform/modules/o1-integration/graphql_ingress.tf +++ /dev/null @@ -1,54 +0,0 @@ -resource "kubernetes_ingress_v1" "testnet_graphql_ingress" { - count = var.deploy_graphql_ingress ? 1 : 0 - depends_on = [ - module.kubernetes_testnet.testnet_namespace, - module.kubernetes_testnet.seeds_release, - module.kubernetes_testnet.block_producers_release, - module.kubernetes_testnet.archive_nodes_release, - module.kubernetes_testnet.snark_workers_release - ] - - metadata { - name = "${var.testnet_name}-graphql-ingress" - namespace = var.testnet_name - annotations = { - "kubernetes.io/ingress.class" = "nginx" - "nginx.org/mergeable-ingress-type" = "minion" - "nginx.ingress.kubernetes.io/use-regex" = "true" - "nginx.ingress.kubernetes.io/rewrite-target" = "/$2" - } - } - - spec { - rule { - host = local.graphql_ingress_dns - http { - dynamic "path" { - for_each = concat( - [local.seed_config.name], - [for config in var.block_producer_configs : config.name], - [for config in local.archive_node_configs : config.name], - var.snark_coordinator_config != null ? [var.snark_coordinator_config.name] : [] - ) - - content { - backend { - service { - name = "${path.value}-graphql" - port { - number = 80 - } - } - } - - path = "/${path.value}(/|$)(.*)" - path_type = "Prefix" - } - } - } - } - } - - # wait_for_load_balancer = true - wait_for_load_balancer = false -} diff --git a/automation/terraform/modules/o1-integration/inputs.tf b/automation/terraform/modules/o1-integration/inputs.tf deleted file mode 100644 index ccf21707a73..00000000000 --- a/automation/terraform/modules/o1-integration/inputs.tf +++ /dev/null @@ -1,156 +0,0 @@ -provider "google" { - alias = "gke" -} - -variable "deploy_graphql_ingress" { - type = bool -} - -variable "expose_itn_graphql" { - type = bool - default = false -} - -variable "itn_keys" { - type = string - default = "" -} - -variable "itn_orchestrator_image" { - type = string - default = "gcr.io/o1labs-192920/itn_orchestrator_image:latest" -} - -variable "aws_route53_zone_id" { - type = string -} - -variable "cluster_name" { - type = string -} - -variable "cluster_region" { - type = string -} - -variable "k8s_context" { - type = string -} - -variable "testnet_name" { - type = string -} - -variable "mina_image" { - type = string -} - -variable "mina_archive_image" { - type = string -} - -variable "mina_agent_image" { - type = string -} - -variable "mina_bots_image" { - type = string -} - -variable "mina_points_image" { - type = string -} - -variable "enable_working_dir_persitence" { - type = bool - default = false -} - -variable "runtime_config" { - type = string -} - -variable "snark_worker_fee" { - type = string -} - -# variable "snark_worker_public_key" { -# type = string -# default = "4vsRCVadXwWMSGA9q81reJRX3BZ5ZKRtgZU7PtGsNq11w2V9tUNf4urZAGncZLUiP4SfWqur7AZsyhJKD41Ke7rJJ8yDibL41ePBeATLUnwNtMTojPDeiBfvTfgHzbAVFktD65vzxMNCvvAJ" -# } - -variable "snark_coordinator_config" { - description = "configurations for the snark coordinator and its workers" - type = object({ - name = string, - public_key = string, - worker_nodes = number - }) - default = null -} - -variable "log_precomputed_blocks" { - type = bool -} - -variable "start_filtered_logs" { - type = list(string) - default = [] -} - -variable "worker_cpu_request" { - type = number - default = 0 -} - -variable "worker_mem_request" { - type = string - default = "0Mi" -} - -variable "cpu_request" { - type = number - default = 0 -} - -variable "mem_request" { - type = string - default = "0Mi" -} - -variable "pod_priority" { - type = number -} - -variable "archive_configs" { - description = "individual archive-node deployment configurations" - default = null -} - -variable "archive_node_count" { - type = number -} - -variable "mina_archive_schema" { - type = string -} - -variable "mina_archive_schema_aux_files" { - type = list(string) - default = [] -} - -variable "block_producer_configs" { - type = list( - object({ - name = string, - keypair = object({ - keypair_name = string - public_key = string - private_key = string, - privkey_password = string - }), - libp2p_secret = string - }) - ) -} diff --git a/automation/terraform/modules/o1-integration/locals.tf b/automation/terraform/modules/o1-integration/locals.tf deleted file mode 100644 index 3d9d4b95569..00000000000 --- a/automation/terraform/modules/o1-integration/locals.tf +++ /dev/null @@ -1,61 +0,0 @@ -locals { - graphql_ingress_dns = "${var.testnet_name}.graphql.test.o1test.net" - snark_worker_host_port = 10001 - block_producer_starting_host_port = 10010 - - - # seed_peer = { - # multiaddr = "/dns4/seed.${var.testnet_name}/tcp/10401/p2p/12D3KooWCoGWacXE4FRwAX8VqhnWVKhz5TTEecWEuGmiNrDt2XLf", - # peerid = "12D3KooWCoGWacXE4FRwAX8VqhnWVKhz5TTEecWEuGmiNrDt2XLf", - # private_key_secretbox = "{\"box_primitive\":\"xsalsa20poly1305\",\"pw_primitive\":\"argon2i\",\"nonce\":\"7YSQmeRbo4fGd2nYh9aS4WzNWzSXsFmmkTqKy93\",\"pwsalt\":\"9QsEJdSkFbF8PUwLPo2ZLHpgT7ja\",\"pwdiff\":[134217728,6],\"ciphertext\":\"7o8WU4cBiuUqGPaF2fNA815XqhZM5j95dhns5zztCiSehb3xVzTUSbCj1nDXG5rAteu67pvMnaGbQ57cQw1HEPB2DDdrtAAWbCt7qYjmP6cNm2L7H9DC8NKHs1LYuWvthfjDvxBDHnVidpRCyqtMBg9TPWtMPkZy1UCVRFokAA5HaA2xkh4WFgy2SCVrAeWNP5BeUGq9u779KcM9BAtg9n6rqbKDTybX4h1aSZ9qA72tg1LHzENfHLAgzJXZQcxhjvw6b8H51m9rVhwFTKPCRRCNXfcyQqjEpH4fm\"}", - # secret = "seed-discovery-keys", - # port = 10401 - # } - - seed_external_port = 10001 - - seed_config = { - name = "seed", - class = "seed", - libp2p_secret = "seed-discovery-keys", - libp2p_secret_pw = "naughty blue worm" - external_ip = null, - # private_key_secret = null, - enableArchive = false, - archiveAddress = null - persist_working_dir = var.enable_working_dir_persitence - } - - - #snark_coordinator_name = "snark-coordinator-${lower(substr(var.snark_worker_public_key, -6, -1))}" - - default_archive_node = { - image = var.mina_archive_image - serverPort = "3086" - externalPort = "11010" - enableLocalDaemon = true - enablePostgresDB = true - - postgresHost = "archive-1-postgresql" - postgresPort = 5432 - # remoteSchemaFile needs to be just the script name, not a url. remoteSchemaAuxFiles needs to be a list of urls of scripts, one of these urls needs to be the url of the main sql script that invokes the other ones. sorry it's confusing - remoteSchemaFile = var.mina_archive_schema - remoteSchemaAuxFiles = var.mina_archive_schema_aux_files - - persistenceEnabled = false - persistenceSize = "1Gi" - persistenceStorageClass = "ssd-delete" - persistenceAccessModes = ["ReadWriteOnce"] - spotAllowed = "true" - persist_working_dir = var.enable_working_dir_persitence - } - - archive_node_configs = var.archive_configs != null ? [for item in var.archive_configs : merge(local.default_archive_node, item)] : [ - for i in range(1, var.archive_node_count + 1) : merge(local.default_archive_node, { - name = "archive-${i}" - postgresHost = "archive-${i}-postgresql" - }) - ] - - archive_node_names = var.archive_node_count == 0 ? [ "" ] : [for i in range(var.archive_node_count) : "archive-${i + 1}:3086"] -} diff --git a/automation/terraform/modules/o1-integration/priority_class.tf b/automation/terraform/modules/o1-integration/priority_class.tf deleted file mode 100644 index c58ee71d745..00000000000 --- a/automation/terraform/modules/o1-integration/priority_class.tf +++ /dev/null @@ -1,9 +0,0 @@ -resource "kubernetes_priority_class" "testnet_priority_class" { - metadata { - name = "${var.testnet_name}-nonpreemptible-priority-class" - } - - value = var.pod_priority - preemption_policy = "Never" - global_default = false -} diff --git a/automation/terraform/modules/o1-integration/secrets.tf b/automation/terraform/modules/o1-integration/secrets.tf deleted file mode 100644 index d8e8dfdb1e0..00000000000 --- a/automation/terraform/modules/o1-integration/secrets.tf +++ /dev/null @@ -1,29 +0,0 @@ -resource "kubernetes_secret" "mina_account_keypairs" { - depends_on = [module.kubernetes_testnet.testnet_namespace] - for_each = {for config in var.block_producer_configs : config.name => config} - - metadata { - name = each.value.keypair.keypair_name - namespace = var.testnet_name - } - - data = { - pub = each.value.keypair.public_key - key = each.value.keypair.private_key - } -} - -#this is entire for the seed peer -resource "kubernetes_secret" "libp2p_discovery_keys" { - depends_on = [module.kubernetes_testnet.testnet_namespace] - - metadata { - name = local.seed_config.libp2p_secret - namespace = var.testnet_name - } - - data = { - key = "{\"box_primitive\":\"xsalsa20poly1305\",\"pw_primitive\":\"argon2i\",\"nonce\":\"7YSQmeRbo4fGd2nYh9aS4WzNWzSXsFmmkTqKy93\",\"pwsalt\":\"9QsEJdSkFbF8PUwLPo2ZLHpgT7ja\",\"pwdiff\":[134217728,6],\"ciphertext\":\"7o8WU4cBiuUqGPaF2fNA815XqhZM5j95dhns5zztCiSehb3xVzTUSbCj1nDXG5rAteu67pvMnaGbQ57cQw1HEPB2DDdrtAAWbCt7qYjmP6cNm2L7H9DC8NKHs1LYuWvthfjDvxBDHnVidpRCyqtMBg9TPWtMPkZy1UCVRFokAA5HaA2xkh4WFgy2SCVrAeWNP5BeUGq9u779KcM9BAtg9n6rqbKDTybX4h1aSZ9qA72tg1LHzENfHLAgzJXZQcxhjvw6b8H51m9rVhwFTKPCRRCNXfcyQqjEpH4fm\"}" - pub = "12D3KooWCoGWacXE4FRwAX8VqhnWVKhz5TTEecWEuGmiNrDt2XLf" #this is also the peer-id - } -} diff --git a/automation/terraform/modules/o1-integration/testnet.tf b/automation/terraform/modules/o1-integration/testnet.tf deleted file mode 100644 index 1b83c07ffe2..00000000000 --- a/automation/terraform/modules/o1-integration/testnet.tf +++ /dev/null @@ -1,88 +0,0 @@ -module "kubernetes_testnet" { - providers = { google = google.gke } - source = "../kubernetes/testnet" - - use_local_charts = true - expose_graphql = var.deploy_graphql_ingress - expose_itn_graphql = var.expose_itn_graphql - itn_keys = var.itn_keys - healthcheck_enabled = false - deploy_watchdog = false - - cluster_name = var.cluster_name - cluster_region = var.cluster_region - k8s_context = var.k8s_context - testnet_name = var.testnet_name - priority_class = kubernetes_priority_class.testnet_priority_class.metadata[0].name - - itn_orchestrator_image = var.itn_orchestrator_image - mina_image = var.mina_image - use_custom_entrypoint = true - custom_entrypoint = "/mina_daemon_puppeteer.py" - mina_archive_image = var.mina_archive_image - mina_agent_image = var.mina_agent_image - mina_bots_image = var.mina_bots_image - mina_points_image = var.mina_points_image - enable_working_dir_persitence = var.enable_working_dir_persitence - log_level = "Trace" - log_snark_work_gossip = true - - #make sure everyone has the seed peer's multiaddress - additional_peers = ["/dns4/seed.${var.testnet_name}/tcp/${local.seed_external_port}/p2p/12D3KooWCoGWacXE4FRwAX8VqhnWVKhz5TTEecWEuGmiNrDt2XLf"] - runtime_config = var.runtime_config - - seed_zone = "us-west1-a" - seed_region = "us-west1" - seed_external_port = local.seed_external_port - seed_configs = [local.seed_config] - - archive_configs = local.archive_node_configs - - log_precomputed_blocks = var.log_precomputed_blocks - start_filtered_logs = var.start_filtered_logs - log_txn_pool_gossip = true - - archive_node_count = var.archive_node_count - - snark_coordinators = var.snark_coordinator_config == null ? [] :[ - { - snark_coordinator_name = var.snark_coordinator_config.name - snark_worker_replicas = var.snark_coordinator_config.worker_nodes - snark_worker_fee = var.snark_worker_fee - snark_worker_public_key = var.snark_coordinator_config.public_key - snark_coordinators_host_port = local.snark_worker_host_port - persist_working_dir = var.enable_working_dir_persitence - } - ] - - # block_producer_key_pass = "naughty blue worm" - block_producer_configs = [ - for index, config in var.block_producer_configs : { - name = config.name - # id = config.id - class = "test", - external_port = local.block_producer_starting_host_port + index - keypair_name = config.keypair.keypair_name - # private_key = config.keypair.private_key - # public_key = config.keypair.public_key - privkey_password = config.keypair.privkey_password - libp2p_secret = config.libp2p_secret - isolated = false - enable_gossip_flooding = false - run_with_user_agent = false - run_with_bots = false - enable_peer_exchange = true - enableArchive = var.archive_node_count > 0 - archiveAddress = element(local.archive_node_names, index) - persist_working_dir = var.enable_working_dir_persitence - } - ] - - cpu_request = var.cpu_request - mem_request= var.mem_request - worker_cpu_request = var.worker_cpu_request - worker_mem_request= var.worker_mem_request - - #we don't use plain nodes in the intg test - plain_node_configs = [] -} diff --git a/automation/terraform/modules/o1-testnet/files.tf b/automation/terraform/modules/o1-testnet/files.tf deleted file mode 100644 index 8f39b9982e3..00000000000 --- a/automation/terraform/modules/o1-testnet/files.tf +++ /dev/null @@ -1,37 +0,0 @@ -# terraform cannot handle file sizes above 4mb, as a result, using a genesis_ledger.json file is no longer supported - -# data "local_file" "genesis_ledger" { -# filename = "${var.artifact_path}/genesis_ledger.json" -# depends_on = [ -# null_resource.block_producer_key_generation -# ] -# } - -# data "local_file" "libp2p_peers" { -# for_each = toset(concat(local.whale_block_producer_libp2p_names, local.fish_block_producer_libp2p_names)) -# filename = "${path.module}/../../../keys/libp2p/${var.testnet_name}/${each.key}" -# depends_on = [ -# null_resource.block_producer_key_generation -# ] -# } - -# Generate random strings for peer IDs -resource "random_id" "peer_id" { - for_each = var.create_libp2p_files ? toset(local.seed_names) : [] - byte_length = 32 -} - -# Create the files with the generated peer IDs -resource "local_file" "libp2p_seed_peers" { - for_each = var.create_libp2p_files ? toset(local.seed_names) : [] - filename = "${var.artifact_path}/keys/libp2p-keys/${each.key}.peerid" - content = random_id.peer_id[each.key].hex -} - -data "local_file" "libp2p_seed_peers" { - for_each = toset(local.seed_names) - filename = "${var.artifact_path}/keys/libp2p-keys/${each.key}.peerid" - depends_on = [ - local_file.libp2p_seed_peers - ] -} diff --git a/automation/terraform/modules/o1-testnet/inputs.tf b/automation/terraform/modules/o1-testnet/inputs.tf deleted file mode 100644 index e250639d4a4..00000000000 --- a/automation/terraform/modules/o1-testnet/inputs.tf +++ /dev/null @@ -1,335 +0,0 @@ -terraform { - experiments = [module_variable_optional_attrs] -} - -provider "google" { - alias = "gke" -} - -# K8s Cluster Vars - -variable "cluster_name" { - type = string -} - -variable "cluster_region" { - type = string -} - -variable "k8s_context" { - type = string - - description = "K8s resource provider context" - default = "gke_o1labs-192920_us-east1_coda-infra-east" -} - -# Global Vars - -variable "artifact_path" { - type = string - default = "/tmp" -} - -# Variable to control file creation -variable "create_libp2p_files" { - description = "Whether to create LibP2P peer ID files" - type = bool - default = false -} - -variable "mina_image" { - type = string - default = "gcr.io/o1labs-192920/mina-daemon:1.2.0beta8-5b35b27-devnet" -} - -variable "mina_archive_image" { - type = string - default = "" -} - -variable "mina_archive_schema" { - type = string - default = "" -} - -variable "mina_archive_schema_aux_files" { - type = list(string) - default = [] -} - -variable "mina_agent_image" { - type = string - default = "codaprotocol/coda-user-agent:0.1.4" -} - -variable "mina_agent_active" { - type = string - default = "true" -} - -variable "mina_bots_image" { - type = string - default = "" -} - -variable "mina_points_image" { - type = string - default = "" -} - -variable "use_embedded_runtime_config" { - type = bool - default = false -} - -variable "watchdog_image" { - type = string - default = "gcr.io/o1labs-192920/watchdog:latest" -} - -variable "itn_orchestrator_image" { - type = string - default = "gcr.io/o1labs-192920/itn_orchestrator_image:latest" -} - -# this must be a string to avoid scientific notation truncation -variable "mina_faucet_amount" { - type = string - default = "10000000000" -} - -# this must be a string to avoid scientific notation truncation -variable "mina_faucet_fee" { - type = string - default = "100000000" -} - -variable "testnet_name" { - type = string -} - -# Seed Vars - -variable "seed_port" { - type = string - default = "10001" -} - -variable "seed_region" { - type = string - default = "us-west1" -} - -variable "seed_zone" { - type = string - default = "us-west1-a" -} - -variable "seed_discovery_keypairs" { - type = list(any) - default = [ - "CAESQNf7ldToowe604aFXdZ76GqW/XVlDmnXmBT+otorvIekBmBaDWu/6ZwYkZzqfr+3IrEh6FLbHQ3VSmubV9I9Kpc=,CAESIAZgWg1rv+mcGJGc6n6/tyKxIehS2x0N1Uprm1fSPSqX,12D3KooWAFFq2yEQFFzhU5dt64AWqawRuomG9hL8rSmm5vxhAsgr", - "CAESQKtOnmYHQacRpNvBZDrGLFw/tVB7V4I14Y2xtGcp1sEsEyfcsNoFi7NnUX0T2lQDGQ31KvJRXJ+u/f9JQhJmLsI=,CAESIBMn3LDaBYuzZ1F9E9pUAxkN9SryUVyfrv3/SUISZi7C,12D3KooWB79AmjiywL1kMGeKHizFNQE9naThM2ooHgwFcUzt6Yt1" - ] -} - -variable "seed_external_port" { - type = string - default = "10001" -} - -# Block Producer Vars - -variable "whales" { - description = "individual whale block producer node deployment configurations" - default = null -} - -variable "fishes" { - description = "individual fish block producer node deployment configurations" - default = null -} - -variable "nodes_with_user_agent" { - type = list(string) - default = [] -} - -variable "seed_count" { - type = number - default = 1 -} - -variable "plain_node_count" { - type = number - default = 1 -} - -variable "log_level" { - type = string - default = "Trace" -} - -variable "log_snark_work_gossip" { - type = bool - default = false -} - -variable "log_txn_pool_gossip" { - type = bool - default = false -} - -variable "block_producer_key_pass" { - type = string -} - -variable "block_producer_starting_host_port" { - type = number - default = 10000 -} - -variable "seed_starting_host_port" { - type = number - default = 10000 -} - -# Snark Worker Vars - -variable "snark_coordinators" { - description = "configurations for not just the snark coordinators but also the snark workers they coordinate" - type = list( - object({ - snark_coordinator_name = string, - snark_worker_replicas = number - snark_worker_fee = number - snark_worker_public_key = string - snark_coordinators_host_port = number - persist_working_dir = bool - })) - default = [] -} - -variable "agent_min_fee" { - type = string - default = "" -} - -variable "agent_max_fee" { - type = string - default = "" -} - -variable "agent_min_tx" { - type = string - default = "" -} - -variable "agent_max_tx" { - type = string - default = "" -} - -variable "agent_tx_batch_size" { - type = string - default = "" -} - -variable "agent_send_every_mins" { - type = string - default = "" -} - -variable "gcloud_seeds" { - type = list(any) - default = [] -} - -# Mina network services vars - -variable "restart_nodes" { - type = bool - default = true -} - -variable "restart_nodes_every_mins" { - type = string - default = "60" -} - -variable "make_report_every_mins" { - type = string - default = "30" -} - -variable "make_reports" { - type = bool - default = true -} - -variable "make_report_discord_webhook_url" { - type = string - default = "" -} - -variable "make_report_accounts" { - type = string - default = "" -} - -variable "log_precomputed_blocks" { - type = bool - default = false -} - -variable "start_filtered_logs" { - type = list(string) - default = [] -} - -variable "worker_cpu_request" { - type = number - default = 0 -} - -variable "worker_mem_request" { - type = string - default = "0Mi" -} - -variable "cpu_request" { - type = number - default = 0 -} - -variable "mem_request" { - type = string - default = "0Mi" -} - -# Archive-Postgres Vars - -variable "archive_node_count" { - type = number - default = 0 -} - -variable "archive_configs" { - description = "individual archive-node deployment configurations" - default = null -} - -variable "upload_blocks_to_gcloud" { - type = bool - default = false -} - -variable "seed_peers_url" { - type = string - default = "" -} - -variable "zkapps_dashboard_key" { - type = string - default = "" -} diff --git a/automation/terraform/modules/o1-testnet/locals.tf b/automation/terraform/modules/o1-testnet/locals.tf deleted file mode 100644 index d825c4d4dee..00000000000 --- a/automation/terraform/modules/o1-testnet/locals.tf +++ /dev/null @@ -1,102 +0,0 @@ -locals { - - - whale_count_total = length(flatten([ - for bp in var.whales : - [ - for i in range(bp.duplicates) : "" - - ]])) - - fish_count_total = length(flatten([ - for index, bp in var.fishes : - [ - for i in range(bp.duplicates) : "" - - ]])) - - - - whale_block_producer_libp2p_names = [for i in range(local.whale_count_total) : "whale-block-producer-${i + 1}"] - fish_block_producer_libp2p_names = [for i in range(local.fish_count_total) : "fish-block-producer-${i + 1}"] - - - whale_configs = flatten([ - for index, bp in var.whales : - [ - for i in range(bp.duplicates) : { - name = "whale-${index + 1}-${i + 1}" - unique_node_index = index + 1 - total_node_index = 1 + i + length(flatten([for b in slice(var.whales, 0, index) : [for k in range(b.duplicates) : 0]])) #summation of all duplicates so far - # full_peer = "/dns4/whale-${index+1}-${i+1}.${var.testnet_name}/tcp/${var.block_producer_starting_host_port +i+ length ( flatten([for b in slice(var.whales,0, index) : [ for k in range(b.duplicates):0 ] ]))}/p2p/${trimspace(data.local_file.libp2p_peers[element (local.whale_block_producer_libp2p_names,i+ length ( flatten([for b in slice(var.whales,0, index) : [ for k in range(b.duplicates):0 ] ])) ) ].content)}", - port = var.block_producer_starting_host_port + i + length(flatten([for b in slice(var.whales, 0, index) : [for k in range(b.duplicates) : ""]])) - class = "whale" - - } - - ]]) - - fish_configs = flatten([ - for index, bp in var.fishes : - [ - for i in range(bp.duplicates) : { - name = "fish-${index + 1}-${i + 1}" - unique_node_index = index + 1 - total_node_index = 1 + i + length(flatten([for b in slice(var.fishes, 0, index) : [for k in range(b.duplicates) : 0]])) - # full_peer = "/dns4/fish-${index+1}-${i+1}.${var.testnet_name}/tcp/${var.block_producer_starting_host_port +i+ length ( flatten([for b in slice(var.fishes,0, index) : [ for k in range(b.duplicates):0 ] ]))}/p2p/${trimspace(data.local_file.libp2p_peers[element (local.fish_block_producer_libp2p_names,i+ length ( flatten([for b in slice(var.fishes,0, index) : [ for k in range(b.duplicates):0 ] ])) ) ].content)}", - port = var.block_producer_starting_host_port + i + length(flatten([for b in slice(var.fishes, 0, index) : [for k in range(b.duplicates) : ""]])) - class = "fish" - - } - - ]]) - - block_producer_configs = concat(local.whale_configs, local.fish_configs) - - whale_count_unique = length(var.whales) - fish_count_unique = length(var.fishes) - - seed_names = [for i in range(var.seed_count) : "seed-${i + 1}"] - - seed_static_peers = [ - for index, name in keys(data.local_file.libp2p_seed_peers) : { - # i don't think the seeds need to have different ports - full_peer = "/dns4/${name}.${var.testnet_name}.o1test.net/tcp/${var.seed_external_port}/p2p/${trimspace(data.local_file.libp2p_seed_peers[name].content)}", - # port = var.seed_starting_host_port + index - name = local.seed_names[index] - unique_node_index = -1 - total_node_index = -1 - class = "seed" - } - ] - - default_archive_node = { - image = var.mina_archive_image - serverPort = "3086" - externalPort = "11010" - enableLocalDaemon = true - enablePostgresDB = true - - postgresHost = "archive-1-postgresql" - postgresPort = 5432 - # remoteSchemaFile needs to be just the script name, not a url. remoteSchemaAuxFiles needs to be a list of urls of scripts, one of these urls needs to be the url of the main sql script that invokes the other ones. sorry it's confusing - remoteSchemaFile = var.mina_archive_schema - remoteSchemaAuxFiles = var.mina_archive_schema_aux_files - - persistenceEnabled = true - persistenceSize = "8Gi" - persistenceStorageClass = "ssd-delete" - persistenceAccessModes = ["ReadWriteOnce"] - spotAllowed = "false" - persist_working_dir = true - } - - static_peers = local.seed_static_peers - - archive_node_configs = var.archive_configs != null ? [for item in var.archive_configs : merge(local.default_archive_node, item)] : [ - for i in range(1, var.archive_node_count + 1) : merge(local.default_archive_node, { - name = "archive-${i}" - postgresHost = "archive-${i}-postgresql" - }) - ] -} diff --git a/automation/terraform/modules/o1-testnet/outputs.tf b/automation/terraform/modules/o1-testnet/outputs.tf deleted file mode 100644 index e7fdeec4b3d..00000000000 --- a/automation/terraform/modules/o1-testnet/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "static_peers" { - value = local.static_peers -} diff --git a/automation/terraform/modules/o1-testnet/scripts.tf b/automation/terraform/modules/o1-testnet/scripts.tf deleted file mode 100644 index 8f66b0b9979..00000000000 --- a/automation/terraform/modules/o1-testnet/scripts.tf +++ /dev/null @@ -1,33 +0,0 @@ -# dynamic key and ledger generation is not used in production testnets, only for disposable integration tests - -# resource "null_resource" "block_producer_key_generation" { -# provisioner "local-exec" { -# working_dir = "${path.module}/../../.." -# command = "./scripts/generate-keys-and-ledger.sh --testnet=${var.testnet_name} --sc=${var.seed_count} --wu=${local.whale_count_unique} --wt=${local.whale_count_total} --fu=${local.fish_count_unique} --ft=${local.fish_count_total} --reset=false --artifact-path=${var.artifact_path}" -# } -# } - -resource "null_resource" "block_producer_uploads" { - provisioner "local-exec" { - working_dir = "${path.module}/../../.." - command = "./scripts/upload-keys-k8s-simplified.sh ${var.testnet_name}" - environment = { - CLUSTER = var.k8s_context - } - } - depends_on = [ - module.kubernetes_testnet.testnet_namespace, - # null_resource.block_producer_key_generation - ] -} - -resource "null_resource" "seed_list" { - provisioner "local-exec" { - working_dir = "${path.module}/../../.." - command = "./scripts/make-seeds-list.sh --testnet=${var.testnet_name} --artifact-path=${var.artifact_path}" - } - depends_on = [ - module.kubernetes_testnet.testnet_namespace, - # null_resource.block_producer_key_generation - ] -} diff --git a/automation/terraform/modules/o1-testnet/templates/default_ledger.json b/automation/terraform/modules/o1-testnet/templates/default_ledger.json deleted file mode 100644 index 9e26dfeeb6e..00000000000 --- a/automation/terraform/modules/o1-testnet/templates/default_ledger.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/automation/terraform/modules/o1-testnet/testnet.tf b/automation/terraform/modules/o1-testnet/testnet.tf deleted file mode 100644 index 733a8b4b1cd..00000000000 --- a/automation/terraform/modules/o1-testnet/testnet.tf +++ /dev/null @@ -1,123 +0,0 @@ -resource "google_compute_address" "seed_static_ip" { - count = var.seed_count - name = "${var.testnet_name}-seed-static-ip-${count.index + 1}" - address_type = "EXTERNAL" - region = var.cluster_region - project = "o1labs-192920" -} - -data "aws_route53_zone" "selected" { - name = "o1test.net." -} - -resource "aws_route53_record" "seed_record" { - count = var.seed_count - zone_id = data.aws_route53_zone.selected.zone_id - name = "seed-${count.index + 1}.${var.testnet_name}.${data.aws_route53_zone.selected.name}" - type = "A" - ttl = "300" - records = [google_compute_address.seed_static_ip[count.index].address] -} - -module "kubernetes_testnet" { - providers = { google = google.gke } - source = "../kubernetes/testnet" - - cluster_name = var.cluster_name - cluster_region = var.cluster_region - k8s_context = var.k8s_context - testnet_name = var.testnet_name - - use_local_charts = true - mina_image = var.mina_image - mina_archive_image = var.mina_archive_image - mina_agent_image = var.mina_agent_image - mina_bots_image = var.mina_bots_image - mina_points_image = var.mina_points_image - watchdog_image = var.watchdog_image - itn_orchestrator_image = var.itn_orchestrator_image - - mina_faucet_amount = var.mina_faucet_amount - mina_faucet_fee = var.mina_faucet_fee - - log_level = var.log_level - log_txn_pool_gossip = var.log_txn_pool_gossip - log_precomputed_blocks = var.log_precomputed_blocks - start_filtered_logs = var.start_filtered_logs - - agent_min_fee = var.agent_min_fee - agent_max_fee = var.agent_max_fee - agent_min_tx = var.agent_min_tx - agent_max_tx = var.agent_max_tx - agent_send_every_mins = var.agent_send_every_mins - - additional_peers = [for peer in local.static_peers : peer.full_peer] - runtime_config = var.use_embedded_runtime_config ? "" : "" - - seed_zone = var.seed_zone - seed_region = var.seed_region - - archive_configs = local.archive_node_configs - - mina_archive_schema = var.mina_archive_schema - mina_archive_schema_aux_files = var.mina_archive_schema_aux_files - - snark_coordinators = var.snark_coordinators - - # block_producer_key_pass = var.block_producer_key_pass - block_producer_configs = [for i, bp in local.block_producer_configs : - { - name = bp.name - class = bp.class - keypair_name = "${bp.class}-${bp.unique_node_index}-key" - privkey_password = "naughty blue worm" - external_port = bp.port - libp2p_secret = "" - enable_gossip_flooding = false - run_with_user_agent = bp.class == "whale" ? false : true - run_with_bots = false - enable_peer_exchange = true - isolated = false - enableArchive = false - archiveAddress = length(local.archive_node_configs) != 0 ? "${element(local.archive_node_configs, i % (length(local.archive_node_configs)))["name"]}:${element(local.archive_node_configs, i % (length(local.archive_node_configs)))["serverPort"]}" : "" - persist_working_dir = true - } - ] - - seed_external_port = 10001 - - seed_configs = [ - for i in range(var.seed_count) : { - name = local.seed_static_peers[i].name - class = "seed" - libp2p_secret = "seed-${i + 1}-key" - libp2p_secret_pw = "naughty blue worm" - external_ip = google_compute_address.seed_static_ip[i].address - enableArchive = length(local.archive_node_configs) > 0 - archiveAddress = length(local.archive_node_configs) > 0 ? "${element(local.archive_node_configs, i)["name"]}:${element(local.archive_node_configs, i)["serverPort"]}" : "" - persist_working_dir = true - } - ] - - plain_node_configs = [ - for i in range(var.plain_node_count) : { - name = "plain-node-${i + 1}" - } - ] - - cpu_request = var.cpu_request - mem_request = var.mem_request - worker_cpu_request = var.worker_cpu_request - worker_mem_request = var.worker_mem_request - - upload_blocks_to_gcloud = var.upload_blocks_to_gcloud - restart_nodes = var.restart_nodes - restart_nodes_every_mins = var.restart_nodes_every_mins - make_reports = var.make_reports - make_report_every_mins = var.make_report_every_mins - make_report_discord_webhook_url = var.make_report_discord_webhook_url - make_report_accounts = var.make_report_accounts - # seed_peers_url = var.seed_peers_url - - zkapps_dashboard_key = var.zkapps_dashboard_key -} diff --git a/automation/terraform/modules/services/daemon/README.md b/automation/terraform/modules/services/daemon/README.md deleted file mode 100644 index b55f6a78e18..00000000000 --- a/automation/terraform/modules/services/daemon/README.md +++ /dev/null @@ -1,71 +0,0 @@ -## mina Daemon Module - -This is a Terraform module that will deploy a mina Daemon container as a service in AWS ECS. - -## Variables - -`cluster_id`: The ECS cluster ID - -`environment`: The environment the service is running in - -`testnet`: The testnet that this daemon is connected to - -`daemon_number`: A unique value that is not shared with another deployed daemon in this environment - -`container_version`: The version of the container to be used when deploying the Daemon Service - -`mina_wallet_keys`: A space-delimited list of AWS Secrets Manager secret IDs - -`aws_access_key`: An Access Key granting read-only access to Testnet Secrets - -`aws_secret_key`: The corresponding AWS Secret Key - -`aws_default_region`: The region that the secrets are stored in - -`daemon_peer`: The initial peer to start the Daemon with - -`daemon_rest_port` (Default: 3085): The port that the GraphQL server will listen on - -`daemon_external_port` (Default: 10101): The port that the daemon will listen for RPC connections - -`daemon_metrics_port` (Default: 10000): The port that the daemon will expose prometheus metrics on - -`mina_privkey_pass`: The password for the installed keys - -## Deployment Considerations - -In order to deploy a "new" version of this module, you must ensure that you have rebuilt said container. - -The manual commands to release each container are the following: - -### Mina-Daemon Container - -*(From the root of the `MinaProtocol/mina` repository)* -`./scripts/docker/build.sh -s mina-daemon -v .. --deb_version= --deb_release="` - -and - -`./scripts/docker/release.sh -s mina-daemon -v .. - --deb_version= --deb_release="` - - -Example: -`./scripts/docker/build.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` - -`./scripts/docker/release.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` - -The `--extra-args` argument is for passing additional parameters directly to the `docker build` command. It is used here to pass the required Dockerfile variable `'deb_version` but can also be used to override Dockerfile variables with default values like so `--build-arg deb_repo=release` - -### daemon Container - -*(From the root of the `MinaProtocol/mina` repository)* -`./scripts/docker/build.sh -s mina-daemon -v .. --deb_version= --deb_release="` - -and - -`./scripts/docker/release.sh -s mina-daemon -v .. - --deb_version= --deb_release="` - - -Example: -`./scripts/docker/build.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` - -`./scripts/docker/release.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` diff --git a/automation/terraform/modules/services/daemon/main.tf b/automation/terraform/modules/services/daemon/main.tf deleted file mode 100644 index a0897bc7a72..00000000000 --- a/automation/terraform/modules/services/daemon/main.tf +++ /dev/null @@ -1,48 +0,0 @@ -locals { - service_name = "daemon-${var.environment}-${var.testnet}-${var.daemon_name}" -} - - -resource "aws_cloudwatch_log_group" "daemon" { - name = local.service_name - retention_in_days = 1 -} - -data "template_file" "container_definition" { - template = "${file("${path.module}/templates/container-definition.json.tpl")}" - - vars = { - log_group = local.service_name - region = "us-west-2" - coda_container_version=var.coda_container_version - coda_wallet_keys = var.coda_wallet_keys - aws_access_key = var.aws_access_key - aws_secret_key = var.aws_secret_key - aws_default_region = var.aws_default_region - daemon_peer = var.coda_peer - daemon_rest_port = var.coda_rest_port - daemon_external_port = var.coda_external_port - daemon_discovery_port = var.coda_discovery_port - daemon_metrics_port = var.coda_metrics_port - coda_privkey_pass = var.coda_privkey_pass - coda_snark_key = var.coda_snark_key - coda_propose_key = var.coda_propose_key - } -} - -resource "aws_ecs_task_definition" "daemon" { - family = local.service_name - network_mode = "host" - container_definitions = data.template_file.container_definition.rendered -} - -resource "aws_ecs_service" "daemon" { - name = local.service_name - cluster = var.ecs_cluster_id - task_definition = aws_ecs_task_definition.daemon.arn - - desired_count = 1 - - deployment_maximum_percent = 100 - deployment_minimum_healthy_percent = 0 -} \ No newline at end of file diff --git a/automation/terraform/modules/services/daemon/templates/container-definition.json.tpl b/automation/terraform/modules/services/daemon/templates/container-definition.json.tpl deleted file mode 100644 index 48555ca449c..00000000000 --- a/automation/terraform/modules/services/daemon/templates/container-definition.json.tpl +++ /dev/null @@ -1,30 +0,0 @@ -[ - { - "name": "coda-daemon", - "image": "codaprotocol/daemon:${coda_container_version}", - "cpu": 0, - "memory": 8000, - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "CODA_WALLET_KEYS", "value" : "${coda_wallet_keys}" }, - { "name" : "AWS_ACCESS_KEY_ID", "value" : "${aws_access_key}" }, - { "name" : "AWS_SECRET_ACCESS_KEY", "value" : "${aws_secret_key}" }, - { "name" : "AWS_DEFAULT_REGION", "value" : "${aws_default_region}" }, - { "name" : "DAEMON_PEER", "value" : "${daemon_peer}" }, - { "name" : "DAEMON_REST_PORT", "value" : "${daemon_rest_port}" }, - { "name" : "DAEMON_EXTERNAL_PORT", "value" : "${daemon_external_port}" }, - { "name" : "DAEMON_DISCOVERY_PORT", "value" : "${daemon_discovery_port}" }, - { "name" : "DAEMON_METRICS_PORT", "value" : "${daemon_metrics_port}" }, - { "name" : "MINA_PRIVKEY_PASS", "value" : "${coda_privkey_pass}" }, - { "name" : "CODA_SNARK_KEY", "value" : "${coda_snark_key}" }, - { "name" : "CODA_PROPOSE_KEY", "value" : "${coda_propose_key}" } - ] - } -] \ No newline at end of file diff --git a/automation/terraform/modules/services/daemon/variables.tf b/automation/terraform/modules/services/daemon/variables.tf deleted file mode 100644 index 159b5ce687b..00000000000 --- a/automation/terraform/modules/services/daemon/variables.tf +++ /dev/null @@ -1,91 +0,0 @@ -variable "ecs_cluster_id" { - description = "The ECS cluster ID" - type = string -} - -variable "environment" { - description = "The environment the service is running in" - type = string - default = "dev" -} - -variable "testnet" { - description = "The testnet that this daemon is connected to" - type = string -} - -variable "daemon_name" { - description = "A unique value that is not shared with another deployed daemon" - type = string - default = "dev-daemon" -} - -variable "coda_container_version" { - description = "The version of the container to be used when deploying the Daemon Service" - type = string - default = "0.0.8-fix" -} - -variable "coda_wallet_keys" { - description = "A space-delimited list of AWS Secrets Manager secret IDs" - type = string -} - -variable "aws_access_key" { - description = "An Access Key granting read-only access to Testnet Secrets" - type = string -} - -variable "aws_secret_key" { - description = "The corresponding AWS Secret Key" - type = string -} - -variable "aws_default_region" { - description = "The region that the secrets are stored in" - type = string -} - -variable "coda_snark_key" { - description = "A Public Key to use for SNARK Work, does not need to be installed on the daemon" - default = "" -} - -variable "coda_propose_key" { - description = "A Public Key to use for Block Producing, corresponding private key must be installed on the daemon" - default = "" -} - -variable "coda_peer" { - description = "The initial peer to start the Daemon with" - type = string -} - -variable "coda_rest_port" { - description = "The port that the GraphQL server will listen on" - type = string - default = "3085" -} - -variable "coda_external_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10101" -} - -variable "coda_discovery_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10102" -} - -variable "coda_metrics_port" { - description = "The port that the daemon will expose prometheus metrics on" - type = string - default = "10103" -} - -variable "coda_privkey_pass" { - description = "The password for the installed keys" - type = string -} \ No newline at end of file diff --git a/automation/terraform/modules/services/faucet/README.md b/automation/terraform/modules/services/faucet/README.md deleted file mode 100644 index f0dae0b88e0..00000000000 --- a/automation/terraform/modules/services/faucet/README.md +++ /dev/null @@ -1,92 +0,0 @@ -## Mina Faucet Module - -This is a Terraform module that will deploy a service containing two tasks, a Mina Daemon task and a Mina Faucet container. - -## Variables - -### Global Variables - -`ecs_cluster_id`: The ECS cluster ID - -`environment`: The environment the service is running in - -`testnet`: The testnet that this daemon is connected to - -### Faucet Variables - -`faucet_container_version`: The version of the container to be used when deploying the Daemon Service - -`discord_api_key`: A Discord Bot API Key - -`mina_graphql_host` (Default: "localhost"): The hostname of the Mina GraphQL Endpoint - -`mina_graphql_port` (Default: "3085"): The port the Mina GraphQL Endpoint is listening on - -`faucet_public_key`: The Public Key to be used by the Faucet Service, must be installed as a wallet on the Mina Daemon - -`faucet_password`: The password for the private key in use by the Faucet Service - -`echo_public_key`: The Public Key to be used by the Echo Service, must be installed as a wallet on the Mina Daemon - -`echo_password`: The password for the private key in use by the Echo Service - -`fee_amount`: The default fee to be used by the Faucet and Echo Services - -### Daemon Variables - -`mina_container_version`: The version of the container to be used when deploying the Faucet Service - -`mina_wallet_keys`: A space-delimited list of AWS Secrets Manager secret IDs - -`aws_access_key`: An Access Key granting read-only access to Testnet Secrets - -`aws_secret_key`: The corresponding AWS Secret Key - -`aws_default_region`: The region that the secrets are stored in - -`mina_peer`: The initial peer to start the Daemon with - -`mina_rest_port` (Default: 3085): The port that the GraphQL server will listen on - -`mina_external_port` (Default: 10101): The port that the daemon will listen for RPC connections - -`mina_metrics_port` (Default: 10000): The port that the daemon will expose prometheus metrics on - -`mina_privkey_pass`: The password for the installed keys - -## Deployment Considerations - -In order to deploy a "new" version of this module, you must ensure that you have rebuilt the Mina Daemon image and *(optionally)* the Faucet image if it has changed. - -The manual commands to release each container are the following: - -### Mina-Daemon Container - -*(From the root of the `MinaProtocol/mina` repository)* -`./scripts/docker/build.sh -s mina-daemon -v .. --deb_version= --deb_release="` - -and - -`./scripts/docker/release.sh -s mina-daemon -v .. - --deb_version= --deb_release="` - - -Example: -`./scripts/docker/build.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` - -`./scripts/docker/release.sh -s mina-daemon -v 0.0.10-beta4 --deb_version=0.0.10-beta4-fff3b856 --deb_release=alpha` - -The `--extra-args` argument is for passing additional parameters directly to the `docker build` command. It is used here to pass the required Dockerfile variable `base_image_tag` but can also be used to override Dockerfile variables with default values like so `--build-arg deb_repo=release` - -The Faucet Dockerfile lives in the `MinaProtocol/mina` repository [here](https://github.com/MinaProtocol/mina/blob/develop/frontend/bot/Dockerfile) and you can release it with the following: - -### Faucet Container - -*(From the root of the `MinaProtocol/mina` repository)* - -``` -./scripts/docker/build.sh -s bot -v .. -./scripts/docker/release.sh -s bot -v .. -``` - - - diff --git a/automation/terraform/modules/services/faucet/main.tf b/automation/terraform/modules/services/faucet/main.tf deleted file mode 100644 index 20af32ea116..00000000000 --- a/automation/terraform/modules/services/faucet/main.tf +++ /dev/null @@ -1,59 +0,0 @@ -locals { - service_name = "faucet-${var.testnet}" -} - - -resource "aws_cloudwatch_log_group" "faucet" { - name = local.service_name - retention_in_days = 1 -} - -data "template_file" "container_definition" { - template = "${file("${path.module}/templates/container-definition.json.tpl")}" - - vars = { - log_group = local.service_name - region = "us-west-2" - # Faucet Vars - faucet_container_version = var.faucet_container_version - discord_api_key = var.discord_api_key - coda_graphql_host = var.coda_graphql_host - coda_graphql_port = var.coda_rest_port - faucet_public_key = var.faucet_public_key - faucet_password = var.faucet_password - echo_public_key = var.echo_public_key - echo_password = var.echo_password - fee_amount = var.fee_amount - # Daemon Vars - coda_container_version = var.coda_container_version - coda_wallet_keys = var.coda_wallet_keys - aws_access_key = var.aws_access_key - aws_secret_key = var.aws_secret_key - aws_default_region = var.aws_default_region - coda_peer = var.coda_peer - coda_rest_port = var.coda_rest_port - coda_external_port = var.coda_external_port - coda_discovery_port = var.coda_discovery_port - coda_metrics_port = var.coda_metrics_port - coda_privkey_pass = var.coda_privkey_pass - coda_testnet = var.testnet - coda_client_port = var.coda_client_port - } -} - -resource "aws_ecs_task_definition" "faucet" { - family = local.service_name - network_mode = "host" - container_definitions = data.template_file.container_definition.rendered -} - -resource "aws_ecs_service" "faucet" { - name = local.service_name - cluster = var.ecs_cluster_id - task_definition = aws_ecs_task_definition.faucet.arn - - desired_count = 1 - - deployment_maximum_percent = 100 - deployment_minimum_healthy_percent = 0 -} \ No newline at end of file diff --git a/automation/terraform/modules/services/faucet/templates/container-definition.json.tpl b/automation/terraform/modules/services/faucet/templates/container-definition.json.tpl deleted file mode 100644 index 413d34048c7..00000000000 --- a/automation/terraform/modules/services/faucet/templates/container-definition.json.tpl +++ /dev/null @@ -1,54 +0,0 @@ -[ - { - "name": "faucet", - "image": "codaprotocol/bot:${faucet_container_version}", - "cpu": 0, - "memory": 512, - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "DISCORD_API_KEY", "value" : "${discord_api_key}" }, - { "name" : "MINA_GRAPHQL_HOST", "value" : "${coda_graphql_host}" }, - { "name" : "MINA_GRAPHQL_PORT", "value" : "${coda_graphql_port}" }, - { "name" : "FAUCET_PUBLICKEY", "value" : "${faucet_public_key}" }, - { "name" : "FAUCET_PASSWORD", "value" : "${faucet_password}" }, - { "name" : "ECHO_PUBLICKEY", "value" : "${echo_public_key}" }, - { "name" : "ECHO_PASSWORD", "value" : "${echo_password}" }, - { "name" : "FEE_AMOUNT", "value" : "${fee_amount}" } - ] - }, - { - "name": "coda-daemon", - "image": "codaprotocol/daemon:${coda_container_version}", - "cpu": 0, - "memory": 6500, - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "CODA_WALLET_KEYS", "value" : "${coda_wallet_keys}" }, - { "name" : "AWS_ACCESS_KEY_ID", "value" : "${aws_access_key}" }, - { "name" : "AWS_SECRET_ACCESS_KEY", "value" : "${aws_secret_key}" }, - { "name" : "AWS_DEFAULT_REGION", "value" : "${aws_default_region}" }, - { "name" : "DAEMON_PEER", "value" : "${coda_peer}" }, - { "name" : "DAEMON_REST_PORT", "value" : "${coda_graphql_port}" }, - { "name" : "DAEMON_EXTERNAL_PORT", "value" : "${coda_external_port}" }, - { "name" : "DAEMON_DISCOVERY_PORT", "value" : "${coda_discovery_port}" }, - { "name" : "DAEMON_METRICS_PORT", "value" : "${coda_metrics_port}" }, - { "name" : "DAEMON_CLIENT_PORT", "value" : "${coda_client_port}" }, - { "name" : "MINA_PRIVKEY_PASS", "value" : "${coda_privkey_pass}" }, - { "name" : "CODA_TESTNET", "value" : "${coda_testnet}" } - ] - } -] \ No newline at end of file diff --git a/automation/terraform/modules/services/faucet/variables.tf b/automation/terraform/modules/services/faucet/variables.tf deleted file mode 100644 index cf1b4f70a16..00000000000 --- a/automation/terraform/modules/services/faucet/variables.tf +++ /dev/null @@ -1,132 +0,0 @@ -# Global Vars - -variable "environment" { - description = "The environment the service is running in" - type = string - default = "dev" -} - -variable "testnet" { - description = "The testnet that this daemon is connected to" - type = string -} - -variable "ecs_cluster_id" { - description = "The ECS Cluster this service should be deployed to" - type = string -} - -# FAUCET VARIABLES -variable "faucet_container_version" { - description = "The version of the container to be used when deploying the Faucet Service" - type = string -} - -variable "discord_api_key" { - description = "A Discord Bot API Key" - type = string -} - -variable "coda_graphql_host" { - description = "The hostname of the Coda GraphQL Endpoint" - type = string - default = "localhost" -} - -variable "coda_graphql_port" { - description = "The port the Coda GraphQL Endpoint is listening on" - type = string - default = "3085" -} - -variable "faucet_public_key" { - description = "The Public Key to be used by the Faucet Service, must be installed as a wallet on the Coda Daemon" - type = string -} - -variable "faucet_password" { - description = "The password for the private key in use by the Faucet Service" - type = string -} - -variable "echo_public_key" { - description = "The Public Key to be used by the Echo Service, must be installed as a wallet on the Coda Daemon" - type = string -} - -variable "echo_password" { - description = "The password for the private key in use by the Echo Service" - type = string -} - -variable "fee_amount" { - description = "The default fee to be used by the Faucet and Echo Services" - type = string -} - -# DAEMON VARIABLES - -variable "coda_container_version" { - description = "The version of the container to be used when deploying the Faucet Service" - type = string -} - -variable "coda_wallet_keys" { - description = "A space-delimited list of AWS Secrets Manager secret IDs" - type = string -} - -variable "aws_access_key" { - description = "An Access Key granting read-only access to Testnet Secrets" - type = string -} - -variable "aws_secret_key" { - description = "The corresponding AWS Secret Key" - type = string -} - -variable "aws_default_region" { - description = "The region that the secrets are stored in" - type = string -} - -variable "coda_peer" { - description = "The initial peer to start the Daemon with" - type = string -} - -variable "coda_rest_port" { - description = "The port that the GraphQL server will listen on" - type = string - default = "3085" -} - -variable "coda_external_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10101" -} - -variable "coda_discovery_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10102" -} - -variable "coda_metrics_port" { - description = "The port that the daemon will expose prometheus metrics on" - type = string - default = "10000" -} - -variable "coda_client_port" { - description = "The port that the daemon will expose prometheus metrics on" - type = string - default = "10103" -} - -variable "coda_privkey_pass" { - description = "The password for the installed keys" - type = string -} \ No newline at end of file diff --git a/automation/terraform/modules/services/graphql-proxy/README.md b/automation/terraform/modules/services/graphql-proxy/README.md deleted file mode 100644 index 61ff6177c0b..00000000000 --- a/automation/terraform/modules/services/graphql-proxy/README.md +++ /dev/null @@ -1,78 +0,0 @@ -## Mina Faucet Module - -This is a Terraform module that will deploy a service containing two tasks, a Mina Daemon task and a GraphQL Proxy container. - -## Variables - -### Global Variables - -`ecs_cluster_id`: The ECS cluster ID - -`environment`: The environment the service is running in - -`testnet`: The testnet that this daemon is connected to - -### GraphQL Proxy Variables - -`proxy_container_version`: The version of the container to be used when deploying the Daemon Service - -`mina_graphql_host` (Default: "localhost"): The hostname of the Mina GraphQL Endpoint - -`mina_graphql_port` (Default: "3085"): The port the Mina GraphQL Endpoint is listening on - -### Daemon Variables - -`mina_container_version`: The version of the container to be used when deploying the Faucet Service - -`mina_wallet_keys`: A space-delimited list of AWS Secrets Manager secret IDs - -`aws_access_key`: An Access Key granting read-only access to Testnet Secrets - -`aws_secret_key`: The corresponding AWS Secret Key - -`aws_default_region`: The region that the secrets are stored in - -`mina_peer`: The initial peer to start the Daemon with - -`mina_rest_port` (Default: 3085): The port that the GraphQL server will listen on - -`mina_external_port` (Default: 10101): The port that the daemon will listen for RPC connections - -`mina_metrics_port` (Default: 10000): The port that the daemon will expose prometheus metrics on - -`mina_privkey_pass`: The password for the installed keys - -## Deployment Considerations - -In order to deploy a "new" version of this module, you must ensure that you have rebuilt the Mina Daemon image and *(optionally)* the Proxy image if it has changed. - -The Mina Daemon image build is a two-step process, with the base Mina dockerfile being [here](https://github.com/MinaProtocol/mina/blob/develop/dockerfiles/Dockerfile-mina-daemon) and the more deployment-specific Dockerfile [here](https://github.com/MinaProtocol/mina/automation/blob/master/services/daemon/Dockerfile). - -The manual commands to release each container are the following: - -### Mina-Daemon Container - -*(From the root of the `MinaProtocol/mina` repository)* - -`./scripts/docker/release.sh -s mina-daemon -v .. --deb_version="` - -and - -`./scripts/docker/release.sh -s mina-daemon -v .. - --deb_version= --deb_release="` - - -### daemon Container - -*(From the root of the `MinaProtocol/mina/automation` repository)* - -`./scripts/docker/release.sh -s daemon -v .. ` - -The `--extra-args` argument is for passing additional parameters directly to the `docker build` command. It is used here to pass the required Dockerfile variable `base_image_tag` but can also be used to override Dockerfile variables with default values like so `--build-arg deb_repo=release` - -The Faucet Dockerfile lives in the `MinaProtocol/mina` repository [here](https://github.com/MinaProtocol/mina/blob/develop/frontend/bot/Dockerfile) and you can release it with the following: - -### Faucet Container - -*(From the root of the `MinaProtocol/mina` repository)* - -`./scripts/docker/release.sh -s graphql-public-proxy -v ..` diff --git a/automation/terraform/modules/services/graphql-proxy/main.tf b/automation/terraform/modules/services/graphql-proxy/main.tf deleted file mode 100644 index da5416b5074..00000000000 --- a/automation/terraform/modules/services/graphql-proxy/main.tf +++ /dev/null @@ -1,64 +0,0 @@ -locals { - service_name = "graphql-proxy-${var.testnet}-${var.environment}" -} - - -resource "aws_cloudwatch_log_group" "graphql-proxy" { - name = local.service_name - retention_in_days = 1 -} - -data "template_file" "container_definition" { - template = "${file("${path.module}/templates/container-definition.json.tpl")}" - - vars = { - log_group = local.service_name - region = "us-west-2" - # graphql-proxy Vars - proxy_container_version = var.proxy_container_version - coda_graphql_host = var.coda_graphql_host - coda_graphql_port = var.coda_rest_port - proxy_external_port = var.proxy_external_port - # Daemon Vars - coda_container_version = var.coda_container_version - coda_wallet_keys = var.coda_wallet_keys - aws_access_key = var.aws_access_key - aws_secret_key = var.aws_secret_key - aws_default_region = var.aws_default_region - coda_peer = var.coda_peer - coda_rest_port = var.coda_rest_port - coda_discovery_port = var.coda_discovery_port - coda_external_port = var.coda_external_port - coda_metrics_port = var.coda_metrics_port - coda_privkey_pass = var.coda_privkey_pass - coda_testnet = var.testnet - coda_archive_node = var.coda_archive_node - coda_client_port = var.coda_client_port - } -} - -resource "aws_ecs_task_definition" "graphql-proxy" { - family = local.service_name - network_mode = "host" - container_definitions = data.template_file.container_definition.rendered - - volume { - name = "archive-node-storage" - - docker_volume_configuration { - scope = "shared" - autoprovision = "true" - } - } -} - -resource "aws_ecs_service" "graphql-proxy" { - name = local.service_name - cluster = var.ecs_cluster_id - task_definition = aws_ecs_task_definition.graphql-proxy.arn - - desired_count = 1 - - deployment_maximum_percent = 100 - deployment_minimum_healthy_percent = 0 -} \ No newline at end of file diff --git a/automation/terraform/modules/services/graphql-proxy/templates/container-definition.json.tpl b/automation/terraform/modules/services/graphql-proxy/templates/container-definition.json.tpl deleted file mode 100644 index 4cca0cfafed..00000000000 --- a/automation/terraform/modules/services/graphql-proxy/templates/container-definition.json.tpl +++ /dev/null @@ -1,62 +0,0 @@ -[ - { - "name": "graphql-proxy", - "image": "codaprotocol/graphql-public-proxy:${proxy_container_version}", - "cpu": 0, - "memory": 512, - "portMappings": [ - { - "containerPort": ${proxy_external_port}, - "hostPort": ${proxy_external_port} - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "MINA_GRAPHQL_HOST", "value" : "${coda_graphql_host}" }, - { "name" : "MINA_GRAPHQL_PORT", "value" : "${coda_graphql_port}" }, - { "name" : "EXTERNAL_PORT", "value" : "${proxy_external_port}" } - ] - }, - { - "name": "coda-daemon", - "image": "codaprotocol/daemon:${coda_container_version}", - "cpu": 0, - "memory": 6500, - "mountPoints" : [ - { - "containerPath" : "/mina-config", - "sourceVolume" : "archive-node-storage" - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "CODA_WALLET_KEYS", "value" : "${coda_wallet_keys}" }, - { "name" : "AWS_ACCESS_KEY_ID", "value" : "${aws_access_key}" }, - { "name" : "AWS_SECRET_ACCESS_KEY", "value" : "${aws_secret_key}" }, - { "name" : "AWS_DEFAULT_REGION", "value" : "${aws_default_region}" }, - { "name" : "DAEMON_PEER", "value" : "${coda_peer}" }, - { "name" : "DAEMON_REST_PORT", "value" : "${coda_graphql_port}" }, - { "name" : "DAEMON_EXTERNAL_PORT", "value" : "${coda_external_port}" }, - { "name" : "DAEMON_DISCOVERY_PORT", "value" : "${coda_discovery_port}" }, - { "name" : "DAEMON_METRICS_PORT", "value" : "${coda_metrics_port}" }, - { "name" : "DAEMON_CLIENT_PORT", "value" : "${coda_client_port}" }, - { "name" : "MINA_PRIVKEY_PASS", "value" : "${coda_privkey_pass}" }, - { "name" : "CODA_TESTNET", "value" : "${coda_testnet}" }, - { "name" : "CODA_ARCHIVE_NODE", "value" : "${coda_archive_node}" } - ] - } -] \ No newline at end of file diff --git a/automation/terraform/modules/services/graphql-proxy/variables.tf b/automation/terraform/modules/services/graphql-proxy/variables.tf deleted file mode 100644 index 790b46ef208..00000000000 --- a/automation/terraform/modules/services/graphql-proxy/variables.tf +++ /dev/null @@ -1,114 +0,0 @@ -# Global Vars - -variable "environment" { - description = "The environment the service is running in" - type = string - default = "dev" -} - -variable "testnet" { - description = "The testnet that this daemon is connected to" - type = string -} - -variable "ecs_cluster_id" { - description = "The ECS Cluster this service should be deployed to" - type = string -} - -# graphql-proxy VARIABLES -variable "proxy_container_version" { - description = "The version of the container to be used when deploying the graphql-proxy Service" - type = string -} - -variable "coda_graphql_host" { - description = "The hostname of the Coda GraphQL Endpoint" - type = string - default = "localhost" -} - -variable "coda_graphql_port" { - description = "The port the Coda GraphQL Endpoint is listening on" - type = string - default = "3085" -} - -variable "proxy_external_port" { - description = "The port the GraphQL Proxy is listening on" - type = string - default = "3000" -} - -# DAEMON VARIABLES - -variable "coda_container_version" { - description = "The version of the container to be used when deploying the Coda Daemon" - type = string -} - -variable "coda_wallet_keys" { - description = "A space-delimited list of AWS Secrets Manager secret IDs" - type = string -} - -variable "aws_access_key" { - description = "An Access Key granting read-only access to Testnet Secrets" - type = string -} - -variable "aws_secret_key" { - description = "The corresponding AWS Secret Key" - type = string -} - -variable "aws_default_region" { - description = "The region that the secrets are stored in" - type = string -} - -variable "coda_peer" { - description = "The initial peer to start the Daemon with" - type = string -} - -variable "coda_rest_port" { - description = "The port that the GraphQL server will listen on" - type = string - default = "3085" -} - -variable "coda_discovery_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10102" -} - -variable "coda_external_port" { - description = "The port that the daemon will listen for RPC connections" - type = string - default = "10101" -} - -variable "coda_metrics_port" { - description = "The port that the daemon will expose prometheus metrics on" - type = string - default = "10000" -} - -variable "coda_client_port" { - description = "The port that the daemon will expose prometheus metrics on" - type = string - default = "10103" -} - -variable "coda_privkey_pass" { - description = "The password for the installed keys" - type = string -} - -variable "coda_archive_node" { - description = "Should this be run as an archive node (set if yes, unset if not)" - type = string - default = "false" -} \ No newline at end of file diff --git a/automation/terraform/modules/services/prometheus/main.tf b/automation/terraform/modules/services/prometheus/main.tf deleted file mode 100644 index def65698fcd..00000000000 --- a/automation/terraform/modules/services/prometheus/main.tf +++ /dev/null @@ -1,40 +0,0 @@ -locals { - service_name = "prometheus-${var.environment}" -} - - -resource "aws_cloudwatch_log_group" "prometheus" { - name = local.service_name - retention_in_days = 1 -} - -data "template_file" "container_definition" { - template = "${file("${path.module}/templates/container-definition.json.tpl")}" - - vars = { - log_group = local.service_name - region = "us-west-2" - remote_write_uri = var.remote_write_uri - remote_write_username = var.remote_write_username - remote_write_password = var.remote_write_password - aws_access_key = var.aws_access_key - aws_secret_key = var.aws_secret_key - } -} - -resource "aws_ecs_task_definition" "prometheus" { - family = local.service_name - - container_definitions = data.template_file.container_definition.rendered -} - -resource "aws_ecs_service" "prometheus" { - name = local.service_name - cluster = var.cluster_id - task_definition = aws_ecs_task_definition.prometheus.arn - - desired_count = 1 - - deployment_maximum_percent = 100 - deployment_minimum_healthy_percent = 0 -} \ No newline at end of file diff --git a/automation/terraform/modules/services/prometheus/templates/container-definition.json.tpl b/automation/terraform/modules/services/prometheus/templates/container-definition.json.tpl deleted file mode 100644 index 6df97619559..00000000000 --- a/automation/terraform/modules/services/prometheus/templates/container-definition.json.tpl +++ /dev/null @@ -1,29 +0,0 @@ -[ - { - "name": "prometheus", - "image": "codaprotocol/prometheus:v2.11.1", - "cpu": 0, - "memory": 512, - "portMappings": [ - { - "containerPort": 9090, - "hostPort": 9090 - } - ], - "logConfiguration": { - "logDriver": "awslogs", - "options": { - "awslogs-region": "${region}", - "awslogs-group": "${log_group}", - "awslogs-stream-prefix": "${log_group}" - } - }, - "environment" : [ - { "name" : "REMOTE_WRITE_URI", "value" : "${remote_write_uri}" }, - { "name" : "REMOTE_WRITE_USERNAME", "value" : "${remote_write_username}" }, - { "name" : "REMOTE_WRITE_PASSWORD", "value" : "${remote_write_password}" }, - { "name" : "AWS_ACCESS_KEY", "value" : "${aws_access_key}" }, - { "name" : "AWS_SECRET_KEY", "value" : "${aws_secret_key}" } - ] - } -] \ No newline at end of file diff --git a/automation/terraform/modules/services/prometheus/variables.tf b/automation/terraform/modules/services/prometheus/variables.tf deleted file mode 100644 index 98a64bd90b1..00000000000 --- a/automation/terraform/modules/services/prometheus/variables.tf +++ /dev/null @@ -1,31 +0,0 @@ -variable "cluster_id" { - description = "The ECS cluster ID" - type = string -} - -variable "environment" { - description = "The ECS cluster ID" - type = string - default = "dev" -} - -variable "remote_write_uri" { - description = "Remote Write URI for forwarded metrics" -} - -variable "remote_write_username" { - description = "Remote Write Username for forwarded metrics" -} - - -variable "remote_write_password" { - description = "Remote Write Password for forwarded metrics" -} - -variable "aws_access_key" { - description = "Access Key for AWS - Read-only to EC2" -} - -variable "aws_secret_key" { - description = "Secret Key for AWS - Read-only to EC2" -} \ No newline at end of file diff --git a/automation/terraform/modules/testworld-logging/README.md b/automation/terraform/modules/testworld-logging/README.md deleted file mode 100644 index e62ad804d55..00000000000 --- a/automation/terraform/modules/testworld-logging/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# Mina Incentivized Testnet: Log Infra Stack - -This Terraform code deploys the logging stack used for the `testworld-2-0` testnet (also known as `ITN3`). - -The initial version of this deployment uses a static virtual machine running Docker compose to deploy the following containers: - -- postgres database -- logging front-end (GUI) -- logging backend (Log Consumer) - -## Hardware Requirements - -The most resource heavy portion of the deployment is the logging backend container. Sizing this container is determined by how much log traffic needs to be consumed. For an initial use, paired to the `testworld-2-0` testnet. The VM that hold the Docker Compose deployment is sized at `64vCPU` and `128Gi` RAM. - -## VM configuration with Terraform templates - -This deployment relies on Terraform templates to configure the final state on top of a VM running a vanilla Debian OS image. This is done because at the time of writing, Google Cloud does not offer a machine image with Docker preinstalled. A custom machine image can be created using a tool such as _Packer_ from Hashicorp, but Terraform templates have been chosen in this case to limit the number of tools and build steps in the deployment flow. - -> [!NOTE] -> More information about using Terraform templates can be found on the [Terraform website](https://registry.terraform.io/providers/hashicorp/template/latest/docs). - -Additional configuration can be layered on top of the VM OS by adding a new template to the `./templates` directory, declaring it as a `data` source within `vars.tf` file, and finally adding it to the `metadata` section of the VM configuration within the `main.tf` file. - -## Handling Secrets - -This deployment uses Google Secrets Manager to handle secrets. Secret values are not stored within the source code. If secrets are modified in Google Secrets Manager, note that the new values due not sync automatically and that a redeploy may be required to pull in the new values. - -## Terraform Outputs - -After deployment, the `output.tf` file is configured to print the public IP address that is assigned to the deployed virtual machine. This IP can be used to `ssh` to the machine. - -``` -Outputs: - -docker_vm_ip = "35.35.35.35" <--- example IP -``` diff --git a/automation/terraform/modules/testworld-logging/main.tf b/automation/terraform/modules/testworld-logging/main.tf deleted file mode 100644 index ade0f0e76ef..00000000000 --- a/automation/terraform/modules/testworld-logging/main.tf +++ /dev/null @@ -1,112 +0,0 @@ -terraform { - backend "gcs" { - bucket = "o1labs-terraform" - prefix = "itn3-logging" - } -} - -provider "google" { - project = var.gcp_project - region = var.gcp_region -} - -##################################### -# Google Cloud Secrets Imports -##################################### - -data "google_secret_manager_secret_version" "itn_secret_key" { - provider = google - secret = var.itn_secret_key -} - -data "google_secret_manager_secret_version" "itn_db_pass" { - provider = google - secret = var.db_pass -} - -data "google_secret_manager_secret_version" "aws_access_id" { - provider = google - secret = var.aws_id -} - -data "google_secret_manager_secret_version" "aws_access_key" { - provider = google - secret = var.aws_key -} - -##################################### -# Docker Compose VM Configuration -##################################### - -resource "random_id" "instance_id" { - byte_length = 4 -} - -resource "google_compute_instance" "default" { - name = "itn-logging-${random_id.instance_id.hex}" - machine_type = "n2-standard-32" # 32vCPU, 128GB RAM - zone = var.gcp_zone - - boot_disk { - initialize_params { - image = "debian-cloud/debian-11" - size = 500 # GB - } - } - - metadata = { - startup-script = <