diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0a790ea..89b242e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -89,6 +89,7 @@ plan_misc: -var "onion_host=$ONION_HOST" -var "prom_allowed_source_ip=$PROMETHEUS_ALLOWED_SOURCE_IP" -var "prom_service_acct=$PROM_SA" + -var "opsgenie_key=$OPSGENIE_KEY" -var "satellite_lb=$SATELLITE_LB" -var "satellite_api_lb=$SATELLITE_API_LB" -var "satellite_api_lb_staging=$SATELLITE_API_LB_STAGING" @@ -160,6 +161,7 @@ deploy_misc: -var "onion_host=$ONION_HOST" -var "prom_allowed_source_ip=$PROMETHEUS_ALLOWED_SOURCE_IP" -var "prom_service_acct=$PROM_SA" + -var "opsgenie_key=$OPSGENIE_KEY" -var "satellite_lb=$SATELLITE_LB" -var "satellite_api_lb=$SATELLITE_API_LB" -var "satellite_api_lb_staging=$SATELLITE_API_LB_STAGING" diff --git a/terraform/main.tf b/terraform/main.tf index 9a101c8..3176b81 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -38,6 +38,7 @@ module "blc" { zone = "${var.zone}" instance_type = "${var.instance_type[0]}" host = ["${var.host}"] + space_host = "${var.space_host}" ssl_cert = ["${var.ssl_cert}"] timeout = "${var.timeout}" prom_service_acct = "${var.prom_service_acct}" @@ -62,7 +63,7 @@ module "tor" { create_resources = "${local.create_misc}" - #CI vars + # CI vars region = "${var.region}" zone = "${var.zone}" instance_type = "${var.instance_type[1]}" @@ -81,7 +82,7 @@ module "prometheus" { create_resources = "${local.create_misc}" - #CI vars + # CI vars region = "${var.region}" zone = "${var.zone}" instance_type = "${var.instance_type[2]}" @@ -89,3 +90,16 @@ module "prometheus" { opsgenie_key = "${var.opsgenie_key}" prom_service_acct = "${var.prom_service_acct}" } + +module "dns" { + source = "modules/dns" + + project = "${var.project}" + + create_resources = "${local.create_misc}" + + # CI vars + satellite_lb = "${var.satellite_lb}" + satellite_api_lb = "${var.satellite_api_lb}" + satellite_api_lb_staging = "${var.satellite_api_lb_staging}" +} diff --git a/terraform/modules/blc/cloud-init/blc.yaml b/terraform/modules/blc/cloud-init/blc.yaml index ccd129e..667c812 100644 --- a/terraform/modules/blc/cloud-init/blc.yaml +++ b/terraform/modules/blc/cloud-init/blc.yaml @@ -44,7 +44,7 @@ write_files: access_log /var/log/nginx/access.log withtime; error_log /var/log/nginx/error.log; - server_name ${host}; + server_name ${host} ${space_host}; listen 80 default_server; server_tokens off; diff --git a/terraform/modules/blc/data.tf b/terraform/modules/blc/data.tf index 2cd1bdb..a9cc9e5 100644 --- a/terraform/modules/blc/data.tf +++ b/terraform/modules/blc/data.tf @@ -29,7 +29,8 @@ data "template_file" "blc" { ionosphere_sse_docker = "${var.ionosphere_sse_docker}" node_exporter_docker = "${var.node_exporter_docker}" opsgenie_key = "${var.opsgenie_key}" - host = ["${var.host}"] + host = "${var.host[0]}" + space_host = "${var.host[1]}" } } diff --git a/terraform/modules/blc/variables.tf b/terraform/modules/blc/variables.tf index e02ac41..0e3b514 100644 --- a/terraform/modules/blc/variables.tf +++ b/terraform/modules/blc/variables.tf @@ -56,6 +56,10 @@ variable "host" { type = "list" } +variable "space_host" { + type = "string" +} + variable "timeout" { type = "string" } diff --git a/terraform/blockstream-space.tf b/terraform/modules/dns/blockstream-space.tf similarity index 88% rename from terraform/blockstream-space.tf rename to terraform/modules/dns/blockstream-space.tf index f2c86b2..b056c0a 100644 --- a/terraform/blockstream-space.tf +++ b/terraform/modules/dns/blockstream-space.tf @@ -3,6 +3,7 @@ resource "google_dns_managed_zone" "blockstream-space" { dns_name = "blockstream.space." description = "A long time ago, in a galaxy far, far away... P.S. Don't edit directly in Gcloud, but rather in the Satellite API repo (Otherwise, things break and Chase gets really mad)." project = "${var.project}" + count = "${var.create_resources}" labels = { managed-by = "terraform" @@ -14,6 +15,7 @@ resource "google_dns_record_set" "a-satellite" { managed_zone = "${google_dns_managed_zone.blockstream-space.name}" type = "A" ttl = 300 + count = "${var.create_resources}" rrdatas = ["${var.satellite_lb}"] } @@ -23,6 +25,7 @@ resource "google_dns_record_set" "a-satellite-api" { managed_zone = "${google_dns_managed_zone.blockstream-space.name}" type = "A" ttl = 300 + count = "${var.create_resources}" rrdatas = ["${var.satellite_api_lb}"] } @@ -32,6 +35,7 @@ resource "google_dns_record_set" "a-satellite-api-staging" { managed_zone = "${google_dns_managed_zone.blockstream-space.name}" type = "A" ttl = 300 + count = "${var.create_resources}" rrdatas = ["${var.satellite_api_lb_staging}"] } diff --git a/terraform/modules/dns/variables.tf b/terraform/modules/dns/variables.tf new file mode 100644 index 0000000..6f89845 --- /dev/null +++ b/terraform/modules/dns/variables.tf @@ -0,0 +1,19 @@ +variable "project" { + type = "string" +} + +variable "satellite_lb" { + type = "string" +} + +variable "satellite_api_lb" { + type = "string" +} + +variable "satellite_api_lb_staging" { + type = "string" +} + +variable "create_resources" { + type = "string" +} diff --git a/terraform/modules/prometheus/cloud-init/prometheus.yml b/terraform/modules/prometheus/cloud-init/prometheus.yml index 2a99e67..d1a91d3 100644 --- a/terraform/modules/prometheus/cloud-init/prometheus.yml +++ b/terraform/modules/prometheus/cloud-init/prometheus.yml @@ -2,7 +2,7 @@ bootcmd: - blkid /dev/disk/by-id/google-data || mkfs.ext4 -L data -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/disk/by-id/google-data mounts: - - [ /dev/disk/by-label/google-data, /mnt/disks/data, auto, defaults ] + - [ /dev/disk/by-label/data, /mnt/disks/data, auto, defaults ] users: - name: bs @@ -18,9 +18,6 @@ write_files: # If an alert isn't caught by a route, send it to the pager. receiver: noc-pager routes: - - match: - severity: warning - receiver: noc-email - match: severity: page receiver: noc-pager diff --git a/terraform/modules/tor/variables.tf b/terraform/modules/tor/variables.tf index 5004c84..eeb8e50 100644 --- a/terraform/modules/tor/variables.tf +++ b/terraform/modules/tor/variables.tf @@ -67,4 +67,4 @@ variable "node_exporter_docker" { variable "gcloud_docker" { type = "string" -} \ No newline at end of file +} diff --git a/terraform/variables.tf b/terraform/variables.tf index 0b7e2a1..a47c38b 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -70,6 +70,11 @@ variable "host" { default = ["", ""] } +variable "space_host" { + type = "string" + default = "" +} + variable "onion_host" { type = "string" default = "" @@ -111,17 +116,17 @@ variable "opsgenie_key" { } variable "satellite_lb" { - type = "string" + type = "string" default = "" } variable "satellite_api_lb" { - type = "string" + type = "string" default = "" } variable "satellite_api_lb_staging" { - type = "string" + type = "string" default = "" }