diff --git a/tf/env/local/config-map.tf b/tf/env/local/config-map.tf index f62f73a45..140bf12b4 100644 --- a/tf/env/local/config-map.tf +++ b/tf/env/local/config-map.tf @@ -1,5 +1,5 @@ module "wbaas-config" { source = "./../../modules/config-map/wbaas-ui-config" - + cname_record = "sites-1.dyna.wbaas.localhost." } \ No newline at end of file diff --git a/tf/env/local/providers.tf b/tf/env/local/providers.tf index 3dc9734d5..41593f062 100644 --- a/tf/env/local/providers.tf +++ b/tf/env/local/providers.tf @@ -1,11 +1,11 @@ provider "kubernetes" { config_path = "~/.kube/config" - config_context = "minikube-wbaas" + config_context = "minikube-wbaas" } provider "helm" { kubernetes { - config_path = "~/.kube/config" + config_path = "~/.kube/config" config_context = "minikube" } } diff --git a/tf/env/local/secrets-backups.tf b/tf/env/local/secrets-backups.tf index cf7d9e020..cd9eba72f 100644 --- a/tf/env/local/secrets-backups.tf +++ b/tf/env/local/secrets-backups.tf @@ -1,7 +1,7 @@ # Used by the wbaas-backup pod/job resource "kubernetes_secret" "backup-openssl-key" { metadata { - name = "backup-openssl-key" + name = "backup-openssl-key" namespace = "default" } diff --git a/tf/env/local/secrets-recapcha.tf b/tf/env/local/secrets-recapcha.tf index a6e44e1f1..9f91e6db4 100644 --- a/tf/env/local/secrets-recapcha.tf +++ b/tf/env/local/secrets-recapcha.tf @@ -7,7 +7,7 @@ resource "kubernetes_secret" "recaptcha-v3-dev-secrets" { } data = { - "site_key" = var.recaptcha_v3_dev_site_key, + "site_key" = var.recaptcha_v3_dev_site_key, "secret_key" = var.recaptcha_v3_dev_secret } } @@ -26,7 +26,7 @@ resource "kubernetes_secret" "recaptcha-v2-dev-secrets" { } data = { - "site_key" = var.recaptcha_v2_dev_site_key, + "site_key" = var.recaptcha_v2_dev_site_key, "secret_key" = var.recaptcha_v2_dev_secret } } diff --git a/tf/env/local/variables.tf b/tf/env/local/variables.tf index 09e4dffd0..1e8371d62 100644 --- a/tf/env/local/variables.tf +++ b/tf/env/local/variables.tf @@ -1,34 +1,34 @@ variable "sql-passwords" { - type = set(string) + type = set(string) description = "SQL passwords to create and send to k8s as secrets" default = [ - "root", - "replication", - "api", - "mediawiki-db-manager", - "backup-manager", - ] + "root", + "replication", + "api", + "mediawiki-db-manager", + "backup-manager", + ] } variable "recaptcha_v3_dev_site_key" { - type = string + type = string description = "Site key to access recaptcha v3" - sensitive = true + sensitive = true } variable "recaptcha_v3_dev_secret" { - type = string + type = string description = "Secret key to access recaptcha v3" - sensitive = true + sensitive = true } variable "recaptcha_v2_dev_site_key" { - type = string + type = string description = "Site key to access recaptcha v2" - sensitive = true + sensitive = true } variable "recaptcha_v2_dev_secret" { - type = string + type = string description = "Secret key to access recaptcha v2" - sensitive = true + sensitive = true } diff --git a/tf/env/production/buckets.tf b/tf/env/production/buckets.tf index 69b391e8b..6f971565d 100644 --- a/tf/env/production/buckets.tf +++ b/tf/env/production/buckets.tf @@ -3,8 +3,8 @@ module "production-buckets" { providers = { kubernetes = kubernetes.wbaas-3 } - project_prefix = "wikibase-cloud" + project_prefix = "wikibase-cloud" static_bucket_writer_account = google_service_account.api.email - user_object_admins = var.terraformers + user_object_admins = var.terraformers } diff --git a/tf/env/production/cluster.tf b/tf/env/production/cluster.tf index 759fbb8ec..ac9865e18 100644 --- a/tf/env/production/cluster.tf +++ b/tf/env/production/cluster.tf @@ -1,9 +1,9 @@ resource "google_container_cluster" "wbaas-3" { - name = "wbaas-3" + name = "wbaas-3" remove_default_node_pool = true initial_node_count = 1 monitoring_config { - enable_components = [ "SYSTEM_COMPONENTS" ] + enable_components = ["SYSTEM_COMPONENTS"] managed_prometheus { enabled = true } @@ -24,38 +24,38 @@ resource "google_container_cluster" "wbaas-3" { # when there are no nodes in the pool. You may wish to create a new node pool first and then # delete the old one. resource "google_container_node_pool" "wbaas-3_highmem-16" { - cluster = "wbaas-3" - name = "n2-highmem-16-pool" - node_count = 3 - node_locations = [ - "europe-west3-a", + cluster = "wbaas-3" + name = "n2-highmem-16-pool" + node_count = 3 + node_locations = [ + "europe-west3-a", + ] + node_config { + disk_size_gb = 64 + disk_type = "pd-standard" + machine_type = "n2-highmem-16" + metadata = { + "disable-legacy-endpoints" = "true" + } + oauth_scopes = [ + "https://www.googleapis.com/auth/devstorage.read_only", + "https://www.googleapis.com/auth/logging.write", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/service.management.readonly", + "https://www.googleapis.com/auth/servicecontrol", + "https://www.googleapis.com/auth/trace.append", ] - node_config { - disk_size_gb = 64 - disk_type = "pd-standard" - machine_type = "n2-highmem-16" - metadata = { - "disable-legacy-endpoints" = "true" - } - oauth_scopes = [ - "https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/trace.append", - ] - preemptible = false - service_account = "default" - shielded_instance_config { - enable_integrity_monitoring = true - enable_secure_boot = false - } - logging_variant = "MAX_THROUGHPUT" + preemptible = false + service_account = "default" + shielded_instance_config { + enable_integrity_monitoring = true + enable_secure_boot = false } + logging_variant = "MAX_THROUGHPUT" + } - upgrade_settings { - max_surge = 1 - max_unavailable = 0 - } + upgrade_settings { + max_surge = 1 + max_unavailable = 0 + } } diff --git a/tf/env/production/dns.tf b/tf/env/production/dns.tf index 950535f7a..bd8bad9c8 100644 --- a/tf/env/production/dns.tf +++ b/tf/env/production/dns.tf @@ -1,69 +1,69 @@ resource "google_dns_managed_zone" "cloud" { - description = "Zone for wikibase.cloud" - dns_name = "wikibase.cloud." # TODO: Make this a variable. - name = "wikibase-cloud-zone" - visibility = "public" + description = "Zone for wikibase.cloud" + dns_name = "wikibase.cloud." # TODO: Make this a variable. + name = "wikibase-cloud-zone" + visibility = "public" } resource "google_dns_record_set" "cloud-NS" { - managed_zone = google_dns_managed_zone.cloud.name - name = google_dns_managed_zone.cloud.dns_name - rrdatas = [ - "ns-cloud-b1.googledomains.com.", - "ns-cloud-b2.googledomains.com.", - "ns-cloud-b3.googledomains.com.", - "ns-cloud-b4.googledomains.com.", - ] - ttl = 21600 - type = "NS" + managed_zone = google_dns_managed_zone.cloud.name + name = google_dns_managed_zone.cloud.dns_name + rrdatas = [ + "ns-cloud-b1.googledomains.com.", + "ns-cloud-b2.googledomains.com.", + "ns-cloud-b3.googledomains.com.", + "ns-cloud-b4.googledomains.com.", + ] + ttl = 21600 + type = "NS" } resource "google_dns_record_set" "cloud-SOA" { - managed_zone = google_dns_managed_zone.cloud.name - name = google_dns_managed_zone.cloud.dns_name - rrdatas = [ - "ns-cloud-b1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300", - ] - ttl = 21600 - type = "SOA" + managed_zone = google_dns_managed_zone.cloud.name + name = google_dns_managed_zone.cloud.dns_name + rrdatas = [ + "ns-cloud-b1.googledomains.com. cloud-dns-hostmaster.google.com. 1 21600 3600 259200 300", + ] + ttl = 21600 + type = "SOA" } resource "google_dns_record_set" "cloud-A" { - managed_zone = google_dns_managed_zone.cloud.name - name = google_dns_managed_zone.cloud.dns_name - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.cloud.name + name = google_dns_managed_zone.cloud.dns_name + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } resource "google_dns_record_set" "cloud-wildcard-A" { - managed_zone = google_dns_managed_zone.cloud.name - name = "*.wikibase.cloud." # TODO: Make this a variable. - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.cloud.name + name = "*.wikibase.cloud." # TODO: Make this a variable. + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } resource "google_dns_record_set" "cloud-MailGun-record" { - for_each = { - for index, record in mailgun_domain.default.sending_records: - index => record - } - name = "${each.value.name}." - managed_zone = google_dns_managed_zone.cloud.name - type = each.value.record_type - rrdatas = [ replace("\"${each.value.value}\"", "/^\"eu.mailgun.org\"$/", "eu.mailgun.org." ) ] + for_each = { + for index, record in mailgun_domain.default.sending_records : + index => record + } + name = "${each.value.name}." + managed_zone = google_dns_managed_zone.cloud.name + type = each.value.record_type + rrdatas = [replace("\"${each.value.value}\"", "/^\"eu.mailgun.org\"$/", "eu.mailgun.org.")] } resource "google_dns_record_set" "cloud-dyna-A" { - managed_zone = google_dns_managed_zone.cloud.name - name = "sites-1.dyna.wikibase.cloud." - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.cloud.name + name = "sites-1.dyna.wikibase.cloud." + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } diff --git a/tf/env/production/error-rate-dashboard.tf b/tf/env/production/error-rate-dashboard.tf index 997757971..409a02cc4 100644 --- a/tf/env/production/error-rate-dashboard.tf +++ b/tf/env/production/error-rate-dashboard.tf @@ -1,325 +1,325 @@ resource "google_monitoring_dashboard" "error-rate" { - dashboard_json = jsonencode( - { - displayName = "Error Rate (Production)" - labels = { - production = "" - } - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 4 - widget = { - title = "api error-rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"container_name\"=monitoring.regex.full_match(\"api-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + dashboard_json = jsonencode( + { + displayName = "Error Rate (Production)" + labels = { + production = "" + } + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 4 + widget = { + title = "api error-rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "mediawiki pod error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"container_name\"=monitoring.regex.full_match(\"api-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "mediawiki pod error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "mediawiki error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metadata.user_labels.\"app.kubernetes.io/component\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "mediawiki error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metadata.user_labels.\"app.kubernetes.io/component\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "queryservice error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_AREA" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"queryservice-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "queryservice error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_AREA" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "ingress-nginx-controller error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ingress-nginx-controller-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"queryservice-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "ingress-nginx-controller error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "platform-nginx error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"platform-nginx-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ingress-nginx-controller-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "platform-nginx error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "mariadb error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"sql-mariadb.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"platform-nginx-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "mariadb error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 16 - }, - { - height = 4 - widget = { - title = "tool pod error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"tool-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"sql-mariadb.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 16 + }, + { + height = 4 + widget = { + title = "tool pod error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 16 - }, - { - height = 4 - widget = { - logsPanel = { - filter = <<-EOT + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"tool-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 16 + }, + { + height = 4 + widget = { + logsPanel = { + filter = <<-EOT resource.labels.cluster_name="wbaas-3" severity=ERROR -"cert-manager" EOT - resourceNames = [ - "projects/658442145969", - ] - } - title = "Error logs (filtered)" - } - width = 12 - }, - { - height = 4 - widget = { - title = "ui pod error rate" - xyChart = { - dataSets = [ - { - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesQueryLanguage = <<-EOT + resourceNames = [ + "projects/658442145969", + ] + } + title = "Error logs (filtered)" + } + width = 12 + }, + { + height = 4 + widget = { + title = "ui pod error rate" + xyChart = { + dataSets = [ + { + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesQueryLanguage = <<-EOT fetch k8s_container | metric 'logging.googleapis.com/log_entry_count' | filter @@ -330,25 +330,25 @@ resource "google_monitoring_dashboard" "error-rate" { | group_by [resource.pod_name], [value_log_entry_count_aggregate: aggregate(value.log_entry_count)] EOT - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } - } - width = 6 - yPos = 20 - }, + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/31b6e1c0-7d85-4ae3-b277-2ff3cb085875" - } - ) - project = "wikibase-cloud" + width = 6 + yPos = 20 + }, + ] + } + name = "projects/658442145969/dashboards/31b6e1c0-7d85-4ae3-b277-2ff3cb085875" + } + ) + project = "wikibase-cloud" - timeouts {} + timeouts {} } diff --git a/tf/env/production/es-prometheus-dashoard.tf b/tf/env/production/es-prometheus-dashoard.tf index fee058b2b..06d816dea 100644 --- a/tf/env/production/es-prometheus-dashoard.tf +++ b/tf/env/production/es-prometheus-dashoard.tf @@ -1,353 +1,353 @@ # google_monitoring_dashboard.elasticsearch-prometheus: resource "google_monitoring_dashboard" "elasticsearch-prometheus" { - dashboard_json = jsonencode( + dashboard_json = jsonencode( + { + dashboardFilters = [ { - dashboardFilters = [ - { - filterType = "RESOURCE_LABEL" - labelKey = "cluster" - stringValue = "wbaas-3" - templateVariable = "Cluster" - }, - { - filterType = "RESOURCE_LABEL" - labelKey = "location" - templateVariable = "Location" - }, - { - filterType = "RESOURCE_LABEL" - labelKey = "namespace" - templateVariable = "Namespace" - }, - ] - displayName = "Elasticsearch Prometheus Overview – Cluster filtering hardcoded" - etag = "c011e864ee38f669856ee1575ec41939" - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 3 - widget = { - timeSeriesTable = { - dataSets = [ - { - minAlignmentPeriod = "0s" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_cluster_health_status{$${Cluster},$${Location},$${Namespace}}" - } - }, - ] - metricVisualization = "NUMBER" - } - title = "Cluster Health" - } - width = 6 - yPos = 2 - }, - { - height = 2 - widget = { - scorecard = { - gaugeView = { - upperBound = 100 - } - thresholds = [ - { - color = "RED" - direction = "ABOVE" - value = 50 - }, - { - color = "YELLOW" - direction = "ABOVE" - value = 30 - }, - ] - timeSeriesQuery = { - prometheusQuery = "count(elasticsearch_breakers_tripped{$${Cluster},$${Location},$${Namespace}})" - } - } - title = "Tripped Breakers" - } - width = 2 - }, - { - height = 2 - widget = { - scorecard = { - gaugeView = { - upperBound = 100 - } - thresholds = [ - { - color = "RED" - direction = "ABOVE" - value = 80 - }, - { - color = "YELLOW" - direction = "ABOVE" - value = 50 - }, - ] - timeSeriesQuery = { - prometheusQuery = "sum (elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}} ) / count (elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}} )" - } - } - title = "CPU Avg Usage %" - } - width = 2 - xPos = 2 - }, - { - height = 2 - widget = { - scorecard = { - gaugeView = { - upperBound = 100 - } - thresholds = [ - { - color = "RED" - direction = "ABOVE" - value = 80 - }, - { - color = "YELLOW" - direction = "ABOVE" - value = 50 - }, - ] - timeSeriesQuery = { - prometheusQuery = "avg(elasticsearch_jvm_memory_used_bytes{$${Cluster},$${Location},$${Namespace}} / elasticsearch_jvm_memory_max_bytes{$${Cluster},$${Location},$${Namespace}} * 100)" - } - } - title = "JVM Memory Avg Usage %" - } - width = 2 - xPos = 4 - }, - { - height = 2 - widget = { - scorecard = { - timeSeriesQuery = { - prometheusQuery = "sum(elasticsearch_cluster_health_number_of_nodes{$${Cluster},$${Location},$${Namespace}})" - } - } - title = "ES Nodes" - } - width = 2 - xPos = 6 - }, - { - height = 2 - widget = { - scorecard = { - timeSeriesQuery = { - prometheusQuery = "sum(elasticsearch_cluster_health_number_of_data_nodes{$${Cluster},$${Location},$${Namespace}})" - } - } - title = "ES Data Nodes" - } - width = 2 - xPos = 8 - }, - { - height = 2 - widget = { - scorecard = { - timeSeriesQuery = { - prometheusQuery = "sum(elasticsearch_cluster_health_number_of_pending_tasks{$${Cluster},$${Location},$${Namespace}})" - } - } - title = "Pending Tasks" - } - width = 2 - xPos = 10 - }, - { - height = 3 - widget = { - timeSeriesTable = { - dataSets = [ - { - minAlignmentPeriod = "0s" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_process_open_files_count{$${Cluster},$${Location},$${Namespace}}" - } - }, - ] - metricVisualization = "NUMBER" - } - title = "Open file descriptors" - } - width = 6 - xPos = 6 - yPos = 2 - }, - { - height = 4 - widget = { - title = "OS Load Average over 15min" - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_os_load15{$${Cluster},$${Location},$${Namespace}}" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - yPos = 5 - }, - { - height = 4 - widget = { - title = "CPU Usage % " - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}}" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - xPos = 4 - yPos = 5 - }, - { - height = 4 - widget = { - title = "JVM Memory Pool Peak Used Bytes" - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_jvm_memory_pool_peak_used_bytes{$${Cluster},$${Location},$${Namespace}}" - } - }, - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "elasticsearch_jvm_memory_max_bytes{$${Cluster},$${Location},$${Namespace}}" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - xPos = 8 - yPos = 5 - }, - { - height = 4 - widget = { - title = "Disk Usage %" - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "100 * (1-(elasticsearch_filesystem_data_available_bytes{$${Cluster},$${Location},$${Namespace}}/elasticsearch_filesystem_data_size_bytes{$${Cluster},$${Location},$${Namespace}}))" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - yPos = 9 - }, - { - height = 4 - widget = { - title = "Network Usage" - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "irate(elasticsearch_transport_rx_size_bytes_total{$${Cluster},$${Location},$${Namespace}}[5m])" - } - }, - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "irate(elasticsearch_transport_tx_size_bytes_total{$${Cluster},$${Location},$${Namespace}}[5m])" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - xPos = 4 - yPos = 9 - }, - { - height = 4 - widget = { - title = "Thread Pool Operations Rejected" - xyChart = { - dataSets = [ - { - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - prometheusQuery = "irate(elasticsearch_thread_pool_rejected_count{$${Cluster},$${Location},$${Namespace}}[5m])" - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - scale = "LINEAR" - } - } - } - width = 4 - xPos = 8 - yPos = 9 - }, + filterType = "RESOURCE_LABEL" + labelKey = "cluster" + stringValue = "wbaas-3" + templateVariable = "Cluster" + }, + { + filterType = "RESOURCE_LABEL" + labelKey = "location" + templateVariable = "Location" + }, + { + filterType = "RESOURCE_LABEL" + labelKey = "namespace" + templateVariable = "Namespace" + }, + ] + displayName = "Elasticsearch Prometheus Overview – Cluster filtering hardcoded" + etag = "c011e864ee38f669856ee1575ec41939" + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 3 + widget = { + timeSeriesTable = { + dataSets = [ + { + minAlignmentPeriod = "0s" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_cluster_health_status{$${Cluster},$${Location},$${Namespace}}" + } + }, + ] + metricVisualization = "NUMBER" + } + title = "Cluster Health" + } + width = 6 + yPos = 2 + }, + { + height = 2 + widget = { + scorecard = { + gaugeView = { + upperBound = 100 + } + thresholds = [ + { + color = "RED" + direction = "ABOVE" + value = 50 + }, + { + color = "YELLOW" + direction = "ABOVE" + value = 30 + }, + ] + timeSeriesQuery = { + prometheusQuery = "count(elasticsearch_breakers_tripped{$${Cluster},$${Location},$${Namespace}})" + } + } + title = "Tripped Breakers" + } + width = 2 + }, + { + height = 2 + widget = { + scorecard = { + gaugeView = { + upperBound = 100 + } + thresholds = [ + { + color = "RED" + direction = "ABOVE" + value = 80 + }, + { + color = "YELLOW" + direction = "ABOVE" + value = 50 + }, + ] + timeSeriesQuery = { + prometheusQuery = "sum (elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}} ) / count (elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}} )" + } + } + title = "CPU Avg Usage %" + } + width = 2 + xPos = 2 + }, + { + height = 2 + widget = { + scorecard = { + gaugeView = { + upperBound = 100 + } + thresholds = [ + { + color = "RED" + direction = "ABOVE" + value = 80 + }, + { + color = "YELLOW" + direction = "ABOVE" + value = 50 + }, + ] + timeSeriesQuery = { + prometheusQuery = "avg(elasticsearch_jvm_memory_used_bytes{$${Cluster},$${Location},$${Namespace}} / elasticsearch_jvm_memory_max_bytes{$${Cluster},$${Location},$${Namespace}} * 100)" + } + } + title = "JVM Memory Avg Usage %" + } + width = 2 + xPos = 4 + }, + { + height = 2 + widget = { + scorecard = { + timeSeriesQuery = { + prometheusQuery = "sum(elasticsearch_cluster_health_number_of_nodes{$${Cluster},$${Location},$${Namespace}})" + } + } + title = "ES Nodes" + } + width = 2 + xPos = 6 + }, + { + height = 2 + widget = { + scorecard = { + timeSeriesQuery = { + prometheusQuery = "sum(elasticsearch_cluster_health_number_of_data_nodes{$${Cluster},$${Location},$${Namespace}})" + } + } + title = "ES Data Nodes" + } + width = 2 + xPos = 8 + }, + { + height = 2 + widget = { + scorecard = { + timeSeriesQuery = { + prometheusQuery = "sum(elasticsearch_cluster_health_number_of_pending_tasks{$${Cluster},$${Location},$${Namespace}})" + } + } + title = "Pending Tasks" + } + width = 2 + xPos = 10 + }, + { + height = 3 + widget = { + timeSeriesTable = { + dataSets = [ + { + minAlignmentPeriod = "0s" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_process_open_files_count{$${Cluster},$${Location},$${Namespace}}" + } + }, + ] + metricVisualization = "NUMBER" + } + title = "Open file descriptors" + } + width = 6 + xPos = 6 + yPos = 2 + }, + { + height = 4 + widget = { + title = "OS Load Average over 15min" + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_os_load15{$${Cluster},$${Location},$${Namespace}}" + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } + } + width = 4 + yPos = 5 + }, + { + height = 4 + widget = { + title = "CPU Usage % " + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_process_cpu_percent{$${Cluster},$${Location},$${Namespace}}" + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } + } + width = 4 + xPos = 4 + yPos = 5 + }, + { + height = 4 + widget = { + title = "JVM Memory Pool Peak Used Bytes" + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_jvm_memory_pool_peak_used_bytes{$${Cluster},$${Location},$${Namespace}}" + } + }, + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "elasticsearch_jvm_memory_max_bytes{$${Cluster},$${Location},$${Namespace}}" + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } + } + width = 4 + xPos = 8 + yPos = 5 + }, + { + height = 4 + widget = { + title = "Disk Usage %" + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "100 * (1-(elasticsearch_filesystem_data_available_bytes{$${Cluster},$${Location},$${Namespace}}/elasticsearch_filesystem_data_size_bytes{$${Cluster},$${Location},$${Namespace}}))" + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } + } + width = 4 + yPos = 9 + }, + { + height = 4 + widget = { + title = "Network Usage" + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "irate(elasticsearch_transport_rx_size_bytes_total{$${Cluster},$${Location},$${Namespace}}[5m])" + } + }, + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "irate(elasticsearch_transport_tx_size_bytes_total{$${Cluster},$${Location},$${Namespace}}[5m])" + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } + } + width = 4 + xPos = 4 + yPos = 9 + }, + { + height = 4 + widget = { + title = "Thread Pool Operations Rejected" + xyChart = { + dataSets = [ + { + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + prometheusQuery = "irate(elasticsearch_thread_pool_rejected_count{$${Cluster},$${Location},$${Namespace}}[5m])" + } + }, ] + timeshiftDuration = "0s" + yAxis = { + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/e771ea98-5c12-4b10-9c85-47d4abceaec7" - } - ) - project = "658442145969" + width = 4 + xPos = 8 + yPos = 9 + }, + ] + } + name = "projects/658442145969/dashboards/e771ea98-5c12-4b10-9c85-47d4abceaec7" + } + ) + project = "658442145969" - timeouts {} + timeouts {} } diff --git a/tf/env/production/incoming-traffic-dashboard.tf b/tf/env/production/incoming-traffic-dashboard.tf index d34a27d64..064215943 100644 --- a/tf/env/production/incoming-traffic-dashboard.tf +++ b/tf/env/production/incoming-traffic-dashboard.tf @@ -1,152 +1,152 @@ resource "google_monitoring_dashboard" "incoming-traffic" { - dashboard_json = jsonencode( - { - displayName = "Incoming Traffic" - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 4 - widget = { - title = "Incoming Requests" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + dashboard_json = jsonencode( + { + displayName = "Incoming Traffic" + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 4 + widget = { + title = "Incoming Requests" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + perSeriesAligner = "ALIGN_RATE" } - width = 6 - }, - { - height = 4 - widget = { - title = "Incoming requests by domain" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metric.label.\"domain\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + }, + { + height = 4 + widget = { + title = "Incoming requests by domain" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metric.label.\"domain\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - }, - { - height = 4 - widget = { - title = "Incoming requests by httpMethod" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metric.label.\"httpMethod\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + }, + { + height = 4 + widget = { + title = "Incoming requests by httpMethod" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metric.label.\"httpMethod\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "internal server error (5XX) response count" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_AREA" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metric.label.\"statuscode\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\" metric.label.\"statuscode\"=monitoring.regex.full_match(\"5\\\\d+\")" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "internal server error (5XX) response count" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_AREA" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metric.label.\"statuscode\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 4 - }, + filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\" metric.label.\"statuscode\"=monitoring.regex.full_match(\"5\\\\d+\")" + } + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/3f8a9d3f-bd6a-450d-ab75-b3c6361bc321" - } - ) - project = "wikibase-cloud" + width = 6 + xPos = 6 + yPos = 4 + }, + ] + } + name = "projects/658442145969/dashboards/3f8a9d3f-bd6a-450d-ab75-b3c6361bc321" + } + ) + project = "wikibase-cloud" - timeouts {} + timeouts {} } diff --git a/tf/env/production/ip.tf b/tf/env/production/ip.tf index 608ac49c9..af480dcb9 100644 --- a/tf/env/production/ip.tf +++ b/tf/env/production/ip.tf @@ -1,5 +1,5 @@ resource "google_compute_address" "default" { - name = "wikibase-cloud-ip-01" + name = "wikibase-cloud-ip-01" address_type = "EXTERNAL" network_tier = "PREMIUM" } \ No newline at end of file diff --git a/tf/env/production/kubernetes-secrets.tf b/tf/env/production/kubernetes-secrets.tf index 7362677c2..5b446d936 100644 --- a/tf/env/production/kubernetes-secrets.tf +++ b/tf/env/production/kubernetes-secrets.tf @@ -26,6 +26,6 @@ module "wbaas-k8s-secrets" { kubernetes_namespace.api-job-namespace.metadata[0].name, kubernetes_namespace.adhoc-job-namespace.metadata[0].name ] - logical_backup_openssl_secret = random_password.logical_backup_random_password.result + logical_backup_openssl_secret = random_password.logical_backup_random_password.result } diff --git a/tf/env/production/mailgun.tf b/tf/env/production/mailgun.tf index 1f5fcd6d5..0cd0cc670 100644 --- a/tf/env/production/mailgun.tf +++ b/tf/env/production/mailgun.tf @@ -2,9 +2,9 @@ resource "mailgun_domain" "default" { name = "wikibase.cloud" region = "eu" spam_action = "disabled" - dkim_key_size = 1024 + dkim_key_size = 1024 smtp_password = random_password.smtp-password.result lifecycle { - ignore_changes = [ smtp_password ] + ignore_changes = [smtp_password] } } diff --git a/tf/env/production/namespaces.tf b/tf/env/production/namespaces.tf index b6e440055..089f0aebf 100644 --- a/tf/env/production/namespaces.tf +++ b/tf/env/production/namespaces.tf @@ -8,7 +8,7 @@ resource "kubernetes_namespace" "api-job-namespace" { resource "kubernetes_resource_quota" "api-jobs-podquota" { provider = kubernetes.wbaas-3 - + metadata { name = "api-jobs-podquota" namespace = kubernetes_namespace.api-job-namespace.metadata[0].name diff --git a/tf/env/production/platform-summary-dashboard.tf b/tf/env/production/platform-summary-dashboard.tf index 94860c8af..a1206b75c 100644 --- a/tf/env/production/platform-summary-dashboard.tf +++ b/tf/env/production/platform-summary-dashboard.tf @@ -223,7 +223,7 @@ resource "google_monitoring_dashboard" "platform-summary" { number of users created in the last 24 hours EOT format = "MARKDOWN" - style = {} + style = {} } title = "Legend" } diff --git a/tf/env/production/providers.tf b/tf/env/production/providers.tf index e253e83d3..2fa83a7a7 100644 --- a/tf/env/production/providers.tf +++ b/tf/env/production/providers.tf @@ -1,21 +1,21 @@ provider "google" { - project = "wikibase-cloud" - region = "europe-west3" - zone = "europe-west3-a" + project = "wikibase-cloud" + region = "europe-west3" + zone = "europe-west3-a" } terraform { required_providers { kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } mailgun = { - source = "wgebis/mailgun" + source = "wgebis/mailgun" version = "0.6.1" } google = { - source = "hashicorp/google" + source = "hashicorp/google" version = "4.74.0" } } @@ -40,5 +40,5 @@ provider "kubernetes" { } provider "mailgun" { - api_key = "${var.mailgun_api_key}" -} + api_key = var.mailgun_api_key +} diff --git a/tf/env/production/remote-state/main.tf b/tf/env/production/remote-state/main.tf index 2cb206835..2a0046bc7 100644 --- a/tf/env/production/remote-state/main.tf +++ b/tf/env/production/remote-state/main.tf @@ -1,23 +1,23 @@ provider "google" { - project = "wikibase-cloud" - region = "europe-west3" - zone = "europe-west3-a" + project = "wikibase-cloud" + region = "europe-west3" + zone = "europe-west3-a" } # A non public bucket for storing shared terraform state resource "google_storage_bucket" "tf-state" { - name = "wikibase-cloud-tf-state-production" - location = "EU" - force_destroy = false + name = "wikibase-cloud-tf-state-production" + location = "EU" + force_destroy = false uniform_bucket_level_access = true versioning { - enabled = true + enabled = true } } # Give adam (or someone) initial access resource "google_storage_bucket_iam_member" "tf-state-iam-member" { bucket = google_storage_bucket.tf-state.name - role = "roles/storage.objectAdmin" + role = "roles/storage.objectAdmin" member = "user:thomas.arrow@wikimedia.de" } \ No newline at end of file diff --git a/tf/env/production/secrets-backups.tf b/tf/env/production/secrets-backups.tf index fd03794ef..ed571aa78 100644 --- a/tf/env/production/secrets-backups.tf +++ b/tf/env/production/secrets-backups.tf @@ -3,6 +3,6 @@ resource "random_password" "logical_backup_random_password" { special = true override_special = "_%@" keepers = { - rotate = 1 + rotate = 1 } } \ No newline at end of file diff --git a/tf/env/production/secrets-sql.tf b/tf/env/production/secrets-sql.tf index 35df9490c..4ca0638ff 100644 --- a/tf/env/production/secrets-sql.tf +++ b/tf/env/production/secrets-sql.tf @@ -1,12 +1,12 @@ # Use for sql dbs resource "random_password" "sql-passwords" { - for_each = var.sql-passwords + for_each = var.sql-passwords length = 32 special = true override_special = "_%@" keepers = { - rotate = 1 + rotate = 1 } } diff --git a/tf/env/production/serviceaccount.tf b/tf/env/production/serviceaccount.tf index d2ec4e2d3..65d3eb167 100644 --- a/tf/env/production/serviceaccount.tf +++ b/tf/env/production/serviceaccount.tf @@ -5,32 +5,32 @@ resource "google_project_iam_member" "certman-dns-cloud-solver" { } resource "google_service_account" "certman-dns-cloud-solver" { - account_id = "certman-dns-cloud-solver" - description = "change dns settings for certman" - disabled = false - display_name = "certman-dns-cloud-solver" + account_id = "certman-dns-cloud-solver" + description = "change dns settings for certman" + disabled = false + display_name = "certman-dns-cloud-solver" } # TODO future regular rotation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key#example-usage-creating-and-regularly-rotating-a-key resource "google_service_account_key" "certman-dns-cloud-solver" { - service_account_id = google_service_account.certman-dns-cloud-solver.name + service_account_id = google_service_account.certman-dns-cloud-solver.name - keepers = { - rotate = 1 - } + keepers = { + rotate = 1 + } } resource "google_service_account" "api" { - account_id = "wikibase-cloud-api" - disabled = false - display_name = "Service Account" + account_id = "wikibase-cloud-api" + disabled = false + display_name = "Service Account" } # TODO future regular rotation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key#example-usage-creating-and-regularly-rotating-a-key resource "google_service_account_key" "api" { - service_account_id = google_service_account.api.name + service_account_id = google_service_account.api.name - keepers = { - rotate = 1 - } + keepers = { + rotate = 1 + } } diff --git a/tf/env/production/terraform.tf b/tf/env/production/terraform.tf index 554c344bb..9e33b740b 100644 --- a/tf/env/production/terraform.tf +++ b/tf/env/production/terraform.tf @@ -1,24 +1,24 @@ terraform { backend "gcs" { - bucket = "wikibase-cloud-tf-state-production" - prefix = "terraform/state" + bucket = "wikibase-cloud-tf-state-production" + prefix = "terraform/state" } } resource "google_storage_bucket" "tf-state-production" { - name = "wikibase-cloud-tf-state-production" - location = "EU" - force_destroy = false + name = "wikibase-cloud-tf-state-production" + location = "EU" + force_destroy = false uniform_bucket_level_access = true versioning { - enabled = true + enabled = true } } # Give everyone access to the state bucket resource "google_storage_bucket_iam_member" "tf-state-production-iam-member" { for_each = var.terraformers - bucket = google_storage_bucket.tf-state-production.name - role = "roles/storage.objectAdmin" - member = "user:${each.value}" + bucket = google_storage_bucket.tf-state-production.name + role = "roles/storage.objectAdmin" + member = "user:${each.value}" } diff --git a/tf/env/production/uptime-latency-dashboard.tf b/tf/env/production/uptime-latency-dashboard.tf index 23a678389..c8ae4ab07 100644 --- a/tf/env/production/uptime-latency-dashboard.tf +++ b/tf/env/production/uptime-latency-dashboard.tf @@ -1,382 +1,382 @@ resource "google_monitoring_dashboard" "uptime-latency" { - dashboard_json = jsonencode( - { - displayName = "Uptime and Latency (Production)" - labels = { - production = "" - } - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 4 - widget = { - title = "Request Latency of the platform API health endpoint" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-www-wikibase-cloud-api-health\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + dashboard_json = jsonencode( + { + displayName = "Uptime and Latency (Production)" + labels = { + production = "" + } + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 4 + widget = { + title = "Request Latency of the platform API health endpoint" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - xPos = 6 - }, - { - height = 4 - widget = { - title = "Request Latency of Mediawiki API" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-wbgetentities\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-www-wikibase-cloud-api-health\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + }, + { + height = 4 + widget = { + title = "Request Latency of Mediawiki API" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - }, - { - height = 4 - widget = { - title = "Request latency of Queryservice" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-query-sparql\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-wbgetentities\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + }, + { + height = 4 + widget = { + title = "Request latency of Queryservice" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "Request latency of Mediawiki Web Pod - Item" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-itempage\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-query-sparql\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "Request latency of Mediawiki Web Pod - Item" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - xPos = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "Request latency of Mediawiki Web Pod - Special:Version" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-itempage\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "Request latency of Mediawiki Web Pod - Special:Version" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "Count of \"down\" checks of Mediawiki API" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_NEXT_OLDER" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-wbgetentities\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "Count of \"down\" checks of Mediawiki API" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_COUNT_FALSE" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_NEXT_OLDER" } - width = 6 - xPos = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "Count of \"down\" checks of The platform API health endpoint" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_NEXT_OLDER" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-www-wikibase-cloud-api-health\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-wbgetentities\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "Count of \"down\" checks of The platform API health endpoint" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_COUNT_FALSE" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_NEXT_OLDER" } - width = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "Count of \"down\" checks of Queryservice" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_NEXT_OLDER" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-query-sparql\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-www-wikibase-cloud-api-health\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "Count of \"down\" checks of Queryservice" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_COUNT_FALSE" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_NEXT_OLDER" } - width = 6 - xPos = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "Count of \"down\" checks of Mediawiki Web Pod - Item" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_NEXT_OLDER" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-itempage\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-query-sparql\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "Count of \"down\" checks of Mediawiki Web Pod - Item" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_COUNT_FALSE" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_NEXT_OLDER" } - width = 6 - yPos = 16 - }, - { - height = 4 - widget = { - title = "Count of \"down\" checks of Mediawiki Web Pod - Special:Version" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ - "metric.label.\"check_id\"", - "metric.label.\"checker_location\"", - ] - perSeriesAligner = "ALIGN_NEXT_OLDER" - } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud-wikibase-itempage\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 16 + }, + { + height = 4 + widget = { + title = "Count of \"down\" checks of Mediawiki Web Pod - Special:Version" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_COUNT_FALSE" + groupByFields = [ + "metric.label.\"check_id\"", + "metric.label.\"checker_location\"", + ] + perSeriesAligner = "ALIGN_NEXT_OLDER" } - width = 6 - xPos = 6 - yPos = 16 - }, + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-cloud-coffeebase-wikibase-cloud\"" + } + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/90f60aaf-56da-447b-b1ca-43520e5e07ee" - } - ) - project = "wikibase-cloud" + width = 6 + xPos = 6 + yPos = 16 + }, + ] + } + name = "projects/658442145969/dashboards/90f60aaf-56da-447b-b1ca-43520e5e07ee" + } + ) + project = "wikibase-cloud" - timeouts {} + timeouts {} } diff --git a/tf/env/production/uptime.tf b/tf/env/production/uptime.tf index 61683b682..ca8ecb399 100644 --- a/tf/env/production/uptime.tf +++ b/tf/env/production/uptime.tf @@ -3,12 +3,12 @@ module "uptime-checks" { providers = { kubernetes = kubernetes.wbaas-3 } - target_wiki = "cloud-coffeebase.wikibase.cloud" + target_wiki = "cloud-coffeebase.wikibase.cloud" target_wbaas_hostname = "wikibase.cloud" - wikibase_itempage_item = "Q1" + wikibase_itempage_item = "Q1" wikibase_itempage_content = "I like coffee" - project_id = local.project_id + project_id = local.project_id monitoring_email_group_name = google_monitoring_notification_channel.monitoring_email_group.name } \ No newline at end of file diff --git a/tf/env/production/variables.tf b/tf/env/production/variables.tf index 31ea88616..e25e7f557 100644 --- a/tf/env/production/variables.tf +++ b/tf/env/production/variables.tf @@ -1,71 +1,71 @@ variable "terraformers" { - type = set(string) + type = set(string) description = "People with access to Terraform state" default = [ - "thomas.arrow@wikimedia.de", - "perside.rosalie@wikimedia.de", - "jakob.warkotsch@wikimedia.de", - "deniz.erdogan@wikimedia.de", - "oliver.shotton@wikimedia.de", - "dat.nguyen@wikimedia.de", - "leszek.manicki@wikimedia.de", - "conny.kawohl@wikimedia.de", - "andrew.kostka@wikimedia.de", - "frederik.ring@wikimedia.de" - ] + "thomas.arrow@wikimedia.de", + "perside.rosalie@wikimedia.de", + "jakob.warkotsch@wikimedia.de", + "deniz.erdogan@wikimedia.de", + "oliver.shotton@wikimedia.de", + "dat.nguyen@wikimedia.de", + "leszek.manicki@wikimedia.de", + "conny.kawohl@wikimedia.de", + "andrew.kostka@wikimedia.de", + "frederik.ring@wikimedia.de" + ] } # TODO: Actually use this throughout locals { production_cluster_name = "wbaas-3" - project_id = "wikibase-cloud" - email_group = "wb-cloud-monitoring@wikimedia.de" + project_id = "wikibase-cloud" + email_group = "wb-cloud-monitoring@wikimedia.de" } variable "mailgun_api_key" { - type = string + type = string description = "User API key to access Mailgun" - sensitive = true + sensitive = true } variable "sql-passwords" { - type = set(string) + type = set(string) description = "SQL passwords to create and send to k8s as secrets" default = [ - "production-replication", - "production-api", - "production-mediawiki-db-manager", - "production-backup-manager", - ] + "production-replication", + "production-api", + "production-mediawiki-db-manager", + "production-backup-manager", + ] } variable "recaptcha_v3_site_key" { - type = string + type = string description = "Site key to access recaptcha v3" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v3_secret" { - type = string + type = string description = "Secret key to access recaptcha v3" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v2_site_key" { - type = string + type = string description = "Site key to access recaptcha v2" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v2_secret" { - type = string + type = string description = "Secret key to access recaptcha v2" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } diff --git a/tf/env/production/volume-utilisation-dashboard.tf b/tf/env/production/volume-utilisation-dashboard.tf index 1eb007149..bdcc22d0a 100644 --- a/tf/env/production/volume-utilisation-dashboard.tf +++ b/tf/env/production/volume-utilisation-dashboard.tf @@ -1,152 +1,152 @@ resource "google_monitoring_dashboard" "volume-utilisation" { - dashboard_json = jsonencode( - { - displayName = "Volume Utilisation" - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 4 - widget = { - title = "Production QueryService" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "300s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "300s" - crossSeriesReducer = "REDUCE_MEAN" - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" metadata.user_labels.\"app.kubernetes.io/instance\"=\"queryservice\" metric.label.\"volume_name\"=\"data\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + dashboard_json = jsonencode( + { + displayName = "Volume Utilisation" + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 4 + widget = { + title = "Production QueryService" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "300s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "300s" + crossSeriesReducer = "REDUCE_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - }, - { - height = 4 - widget = { - title = "production sql" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "300s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "300s" - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" metadata.user_labels.\"app.kubernetes.io/instance\"=\"sql\" metric.label.\"volume_name\"=\"data\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" metadata.user_labels.\"app.kubernetes.io/instance\"=\"queryservice\" metric.label.\"volume_name\"=\"data\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + }, + { + height = 4 + widget = { + title = "production sql" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "300s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "300s" + perSeriesAligner = "ALIGN_MEAN" } - width = 6 - xPos = 6 - }, - { - height = 4 - widget = { - title = "Production Elasticsearch" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "300s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "300s" - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"elasticsearch-master-.+\") metric.label.\"volume_name\"=\"elasticsearch-master\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" metadata.user_labels.\"app.kubernetes.io/instance\"=\"sql\" metric.label.\"volume_name\"=\"data\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + }, + { + height = 4 + widget = { + title = "Production Elasticsearch" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "300s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "300s" + perSeriesAligner = "ALIGN_MEAN" + } + filter = "metric.type=\"kubernetes.io/pod/volume/utilization\" resource.type=\"k8s_pod\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"elasticsearch-master-.+\") metric.label.\"volume_name\"=\"elasticsearch-master\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "sql-logic-backup scratch-disk space" + xyChart = { + dataSets = [ + { + legendTemplate = "Used" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilterRatio = { + denominator = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + perSeriesAligner = "ALIGN_MEAN" + } + filter = "metric.type=\"kubernetes.io/pod/volume/total_bytes\" resource.type=\"k8s_pod\" resource.label.\"location\"=\"europe-west3-a\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"namespace_name\"=\"default\" metadata.system_labels.\"top_level_controller_type\"=\"CronJob\" metadata.system_labels.\"top_level_controller_name\"=\"sql-logic-backup\"" } - width = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "sql-logic-backup scratch-disk space" - xyChart = { - dataSets = [ - { - legendTemplate = "Used" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilterRatio = { - denominator = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"kubernetes.io/pod/volume/total_bytes\" resource.type=\"k8s_pod\" resource.label.\"location\"=\"europe-west3-a\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"namespace_name\"=\"default\" metadata.system_labels.\"top_level_controller_type\"=\"CronJob\" metadata.system_labels.\"top_level_controller_name\"=\"sql-logic-backup\"" - } - numerator = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"kubernetes.io/pod/volume/used_bytes\" resource.type=\"k8s_pod\" resource.label.\"location\"=\"europe-west3-a\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"namespace_name\"=\"default\" metadata.system_labels.\"top_level_controller_type\"=\"CronJob\" metadata.system_labels.\"top_level_controller_name\"=\"sql-logic-backup\"" - } - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + numerator = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + perSeriesAligner = "ALIGN_MEAN" + } + filter = "metric.type=\"kubernetes.io/pod/volume/used_bytes\" resource.type=\"k8s_pod\" resource.label.\"location\"=\"europe-west3-a\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"namespace_name\"=\"default\" metadata.system_labels.\"top_level_controller_type\"=\"CronJob\" metadata.system_labels.\"top_level_controller_name\"=\"sql-logic-backup\"" } - width = 6 - xPos = 6 - yPos = 4 - }, + } + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/fd1bf4b9-3b5b-4cd0-9529-3f1f75c3bdbd" - } - ) - project = "wikibase-cloud" + width = 6 + xPos = 6 + yPos = 4 + }, + ] + } + name = "projects/658442145969/dashboards/fd1bf4b9-3b5b-4cd0-9529-3f1f75c3bdbd" + } + ) + project = "wikibase-cloud" - timeouts {} + timeouts {} } diff --git a/tf/env/production/workload-technical-metrics-dashboard.tf b/tf/env/production/workload-technical-metrics-dashboard.tf index 808af2c72..64e3f8b31 100644 --- a/tf/env/production/workload-technical-metrics-dashboard.tf +++ b/tf/env/production/workload-technical-metrics-dashboard.tf @@ -1,269 +1,269 @@ resource "google_monitoring_dashboard" "workload-technical-metrics" { - dashboard_json = jsonencode( - { - displayName = "Workload technical metrics (Production)" - labels = { - production = "" + dashboard_json = jsonencode( + { + displayName = "Workload technical metrics (Production)" + labels = { + production = "" + } + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 3 + widget = { + title = "Mediawiki - Max CPU Limit Utilization" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MAX" + groupByFields = [ + "metadata.user_labels.\"app.kubernetes.io/component\"", + ] + perSeriesAligner = "ALIGN_MAX" + } + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"container_name\"=\"mediawiki\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 3 - widget = { - title = "Mediawiki - Max CPU Limit Utilization" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ - "metadata.user_labels.\"app.kubernetes.io/component\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"container_name\"=\"mediawiki\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + width = 6 + yPos = 4 + }, + { + height = 3 + widget = { + title = "API - Memory Limit Utilization " + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MEAN" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_MAX" } - width = 6 - yPos = 4 - }, - { - height = 3 - widget = { - title = "API - Memory Limit Utilization " - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 7 + }, + { + height = 3 + widget = { + title = "SQL/Redis/ElasticSearch/Queryservice - Max Memory Limit Utilization " + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MAX" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_MAX" } - width = 6 - xPos = 6 - yPos = 7 - }, - { - height = 3 - widget = { - title = "SQL/Redis/ElasticSearch/Queryservice - Max Memory Limit Utilization " - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"cluster_name\"=\"wbaas-3\"" - secondaryAggregation = { - alignmentPeriod = "60s" - } - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"cluster_name\"=\"wbaas-3\"" + secondaryAggregation = { + alignmentPeriod = "60s" } - width = 6 - xPos = 6 - yPos = 10 - }, - { - height = 3 - widget = { - title = "SQL/Redis/ElasticSearch/Queryservice - Max Cpu Limit Utilization " - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 10 + }, + { + height = 3 + widget = { + title = "SQL/Redis/ElasticSearch/Queryservice - Max Cpu Limit Utilization " + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MAX" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_MAX" } - width = 6 - yPos = 10 - }, - { - height = 4 - widget = { - title = "logging/user/production-site-request-count (filtered) [SUM]" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metric.label.\"domain\"", - ] - perSeriesAligner = "ALIGN_MEAN" - } - filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\" metric.label.\"domain\"!=monitoring.regex.full_match(\".+.wikibase.dev\")" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 10 + }, + { + height = 4 + widget = { + title = "logging/user/production-site-request-count (filtered) [SUM]" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metric.label.\"domain\"", + ] + perSeriesAligner = "ALIGN_MEAN" } - width = 12 - }, - { - height = 3 - widget = { - title = "Mediawiki - Max Memory Limit Utilization" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ - "metadata.user_labels.\"app.kubernetes.io/component\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"container_name\"=\"mediawiki\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/user/production-site-request-count\" metric.label.\"domain\"!=monitoring.regex.full_match(\".+.wikibase.dev\")" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 12 + }, + { + height = 3 + widget = { + title = "Mediawiki - Max Memory Limit Utilization" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MAX" + groupByFields = [ + "metadata.user_labels.\"app.kubernetes.io/component\"", + ] + perSeriesAligner = "ALIGN_MAX" } - width = 6 - xPos = 6 - yPos = 4 - }, - { - height = 3 - widget = { - title = "API - Max CPU Limit Utilization " - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "LINE" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_MAX" - } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\") resource.label.\"cluster_name\"=\"wbaas-3\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-3\" resource.label.\"container_name\"=\"mediawiki\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 4 + }, + { + height = 3 + widget = { + title = "API - Max CPU Limit Utilization " + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "LINE" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_MAX" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_MAX" } - width = 6 - yPos = 7 - }, + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\") resource.label.\"cluster_name\"=\"wbaas-3\"" + } + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/97f8c476-bedc-448e-b118-4916197dab0d" - } - ) - project = "wikibase-cloud" + width = 6 + yPos = 7 + }, + ] + } + name = "projects/658442145969/dashboards/97f8c476-bedc-448e-b118-4916197dab0d" + } + ) + project = "wikibase-cloud" - timeouts {} + timeouts {} } diff --git a/tf/env/staging/buckets.tf b/tf/env/staging/buckets.tf index 24428e067..49675dcce 100644 --- a/tf/env/staging/buckets.tf +++ b/tf/env/staging/buckets.tf @@ -3,8 +3,8 @@ module "staging-buckets" { providers = { kubernetes = kubernetes.wbaas-2 } - project_prefix = "wikibase-dev" + project_prefix = "wikibase-dev" static_bucket_writer_account = google_service_account.dev-api.email - user_object_admins = var.terraformers + user_object_admins = var.terraformers } diff --git a/tf/env/staging/cluster.tf b/tf/env/staging/cluster.tf index c11a1b9b7..61680ea89 100644 --- a/tf/env/staging/cluster.tf +++ b/tf/env/staging/cluster.tf @@ -1,58 +1,58 @@ resource "google_container_cluster" "wbaas-2" { - name = "wbaas-2" + name = "wbaas-2" remove_default_node_pool = true initial_node_count = 1 monitoring_config { - enable_components = [ "SYSTEM_COMPONENTS" ] + enable_components = ["SYSTEM_COMPONENTS"] managed_prometheus { - enabled = true + enabled = true } } maintenance_policy { recurring_window { - # timezone: UTC - # "Every monday between 04.00 and 16.00 Berlin time" - start_time = "1970-01-01T02:00:00Z" - end_time = "1970-01-01T14:00:00Z" - recurrence = "FREQ=WEEKLY;BYDAY=MO" + # timezone: UTC + # "Every monday between 04.00 and 16.00 Berlin time" + start_time = "1970-01-01T02:00:00Z" + end_time = "1970-01-01T14:00:00Z" + recurrence = "FREQ=WEEKLY;BYDAY=MO" } } } resource "google_container_node_pool" "wbaas-2_large" { - cluster = "wbaas-2" - name = "large-pool" - node_count = 3 - node_locations = [ - "europe-west3-a", + cluster = "wbaas-2" + name = "large-pool" + node_count = 3 + node_locations = [ + "europe-west3-a", + ] + node_config { + disk_size_gb = 32 + disk_type = "pd-standard" + machine_type = "n2-standard-8" + metadata = { + "disable-legacy-endpoints" = "true" + } + oauth_scopes = [ + "https://www.googleapis.com/auth/devstorage.read_only", + "https://www.googleapis.com/auth/logging.write", + "https://www.googleapis.com/auth/monitoring", + "https://www.googleapis.com/auth/service.management.readonly", + "https://www.googleapis.com/auth/servicecontrol", + "https://www.googleapis.com/auth/trace.append", ] - node_config { - disk_size_gb = 32 - disk_type = "pd-standard" - machine_type = "n2-standard-8" - metadata = { - "disable-legacy-endpoints" = "true" - } - oauth_scopes = [ - "https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/trace.append", - ] - preemptible = false - service_account = "default" - shielded_instance_config { - enable_integrity_monitoring = true - enable_secure_boot = false - } - logging_variant = "MAX_THROUGHPUT" + preemptible = false + service_account = "default" + shielded_instance_config { + enable_integrity_monitoring = true + enable_secure_boot = false } + logging_variant = "MAX_THROUGHPUT" + } - upgrade_settings { - max_surge = 1 - max_unavailable = 0 - } + upgrade_settings { + max_surge = 1 + max_unavailable = 0 + } } diff --git a/tf/env/staging/dns.tf b/tf/env/staging/dns.tf index bb0284ae7..9e7842ae9 100644 --- a/tf/env/staging/dns.tf +++ b/tf/env/staging/dns.tf @@ -1,89 +1,89 @@ resource "google_dns_managed_zone" "dev" { - description = "DNS zone for domain: wikibase.dev" - dns_name = "wikibase.dev." - name = "wikibase-dev" - visibility = "public" + description = "DNS zone for domain: wikibase.dev" + dns_name = "wikibase.dev." + name = "wikibase-dev" + visibility = "public" - dnssec_config { - kind = "dns#managedZoneDnsSecConfig" - non_existence = "nsec3" - state = "on" + dnssec_config { + kind = "dns#managedZoneDnsSecConfig" + non_existence = "nsec3" + state = "on" - default_key_specs { - algorithm = "rsasha256" - key_length = 2048 - key_type = "keySigning" - kind = "dns#dnsKeySpec" - } - default_key_specs { - algorithm = "rsasha256" - key_length = 1024 - key_type = "zoneSigning" - kind = "dns#dnsKeySpec" - } + default_key_specs { + algorithm = "rsasha256" + key_length = 2048 + key_type = "keySigning" + kind = "dns#dnsKeySpec" } + default_key_specs { + algorithm = "rsasha256" + key_length = 1024 + key_type = "zoneSigning" + kind = "dns#dnsKeySpec" + } + } } resource "google_dns_record_set" "dev-NS" { - managed_zone = google_dns_managed_zone.dev.name - name = google_dns_managed_zone.dev.dns_name - rrdatas = [ - "ns-cloud-d1.googledomains.com.", - "ns-cloud-d2.googledomains.com.", - "ns-cloud-d3.googledomains.com.", - "ns-cloud-d4.googledomains.com.", - ] - ttl = 21600 - type = "NS" + managed_zone = google_dns_managed_zone.dev.name + name = google_dns_managed_zone.dev.dns_name + rrdatas = [ + "ns-cloud-d1.googledomains.com.", + "ns-cloud-d2.googledomains.com.", + "ns-cloud-d3.googledomains.com.", + "ns-cloud-d4.googledomains.com.", + ] + ttl = 21600 + type = "NS" } resource "google_dns_record_set" "dev-SOA" { - managed_zone = google_dns_managed_zone.dev.name - name = google_dns_managed_zone.dev.dns_name - rrdatas = [ - "ns-cloud-d1.googledomains.com. cloud-dns-hostmaster.google.com. 3 21600 3600 259200 300", - ] - ttl = 21600 - type = "SOA" + managed_zone = google_dns_managed_zone.dev.name + name = google_dns_managed_zone.dev.dns_name + rrdatas = [ + "ns-cloud-d1.googledomains.com. cloud-dns-hostmaster.google.com. 3 21600 3600 259200 300", + ] + ttl = 21600 + type = "SOA" } resource "google_dns_record_set" "dev-A" { - managed_zone = google_dns_managed_zone.dev.name - name = google_dns_managed_zone.dev.dns_name - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.dev.name + name = google_dns_managed_zone.dev.dns_name + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } resource "google_dns_record_set" "dev-wildcard-A" { - managed_zone = google_dns_managed_zone.dev.name - name = "*.wikibase.dev." # TODO: Make this a variable. - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.dev.name + name = "*.wikibase.dev." # TODO: Make this a variable. + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } resource "google_dns_record_set" "dev-MailGun-record" { - for_each = { - for index, record in mailgun_domain.default.sending_records: - index => record - } - name = "${each.value.name}." - managed_zone = google_dns_managed_zone.dev.name - type = each.value.record_type - rrdatas = [ replace("\"${each.value.value}\"", "/^\"eu.mailgun.org\"$/", "eu.mailgun.org." ) ] + for_each = { + for index, record in mailgun_domain.default.sending_records : + index => record + } + name = "${each.value.name}." + managed_zone = google_dns_managed_zone.dev.name + type = each.value.record_type + rrdatas = [replace("\"${each.value.value}\"", "/^\"eu.mailgun.org\"$/", "eu.mailgun.org.")] } resource "google_dns_record_set" "dev-dyna-A" { - managed_zone = google_dns_managed_zone.dev.name - name = "sites-1.dyna.wikibase.dev." - rrdatas = [ - google_compute_address.default.address, - ] - ttl = 300 - type = "A" + managed_zone = google_dns_managed_zone.dev.name + name = "sites-1.dyna.wikibase.dev." + rrdatas = [ + google_compute_address.default.address, + ] + ttl = 300 + type = "A" } diff --git a/tf/env/staging/error-rate-dashboard.tf b/tf/env/staging/error-rate-dashboard.tf index 1bdf48714..82b1cace2 100644 --- a/tf/env/staging/error-rate-dashboard.tf +++ b/tf/env/staging/error-rate-dashboard.tf @@ -1,354 +1,354 @@ resource "google_monitoring_dashboard" "error-rate" { - dashboard_json = jsonencode( - { - displayName = "Error Rate (Staging)" - labels = { - staging = "" - } - mosaicLayout = { - columns = 12 - tiles = [ - { - height = 4 - widget = { - title = "api error-rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"container_name\"=monitoring.regex.full_match(\"api-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + dashboard_json = jsonencode( + { + displayName = "Error Rate (Staging)" + labels = { + staging = "" + } + mosaicLayout = { + columns = 12 + tiles = [ + { + height = 4 + widget = { + title = "api error-rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "mediawiki pod error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"container_name\"=monitoring.regex.full_match(\"api-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "mediawiki pod error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "mediawiki error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "metadata.user_labels.\"app.kubernetes.io/component\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "mediawiki error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "metadata.user_labels.\"app.kubernetes.io/component\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 4 - }, - { - height = 4 - widget = { - title = "queryservice error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_AREA" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"container_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"queryservice-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"mediawiki-\\\\w+-\\\\w+-\\\\w+-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 4 + }, + { + height = 4 + widget = { + title = "queryservice error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_AREA" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"container_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 8 - }, - { - height = 4 - widget = { - title = "ingress-nginx-controller error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ingress-nginx-controller-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"queryservice-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 8 + }, + { + height = 4 + widget = { + title = "ingress-nginx-controller error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "platform-nginx error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"platform-nginx-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ingress-nginx-controller-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "platform-nginx error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 12 - }, - { - height = 4 - widget = { - title = "mariadb error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"sql-mariadb.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"platform-nginx-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 12 + }, + { + height = 4 + widget = { + title = "mariadb error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 16 - }, - { - height = 4 - widget = { - title = "tool pod error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"tool-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"sql-mariadb.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + yPos = 16 + }, + { + height = 4 + widget = { + title = "tool pod error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - xPos = 6 - yPos = 16 - }, - { - height = 4 - widget = { - logsPanel = { - filter = <<-EOT + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"tool-\\\\w+-.+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, + ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } + } + width = 6 + xPos = 6 + yPos = 16 + }, + { + height = 4 + widget = { + logsPanel = { + filter = <<-EOT resource.labels.cluster_name="wbaas-2" severity=ERROR -"cert-manager" EOT - resourceNames = [ - "projects/658442145969", - ] - } - title = "Error logs (filtered)" - } - width = 12 - }, - { - height = 4 - widget = { - title = "ui pod error rate" - xyChart = { - dataSets = [ - { - minAlignmentPeriod = "60s" - plotType = "STACKED_BAR" - targetAxis = "Y1" - timeSeriesQuery = { - timeSeriesFilter = { - aggregation = { - alignmentPeriod = "60s" - crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ - "resource.label.\"pod_name\"", - ] - perSeriesAligner = "ALIGN_RATE" - } - filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ui-\\\\w+-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-2\"" - } - } - }, - ] - timeshiftDuration = "0s" - yAxis = { - label = "y1Axis" - scale = "LINEAR" - } - } + resourceNames = [ + "projects/658442145969", + ] + } + title = "Error logs (filtered)" + } + width = 12 + }, + { + height = 4 + widget = { + title = "ui pod error rate" + xyChart = { + dataSets = [ + { + minAlignmentPeriod = "60s" + plotType = "STACKED_BAR" + targetAxis = "Y1" + timeSeriesQuery = { + timeSeriesFilter = { + aggregation = { + alignmentPeriod = "60s" + crossSeriesReducer = "REDUCE_SUM" + groupByFields = [ + "resource.label.\"pod_name\"", + ] + perSeriesAligner = "ALIGN_RATE" } - width = 6 - yPos = 20 - }, + filter = "metric.type=\"logging.googleapis.com/log_entry_count\" resource.type=\"k8s_container\" metric.label.\"severity\"=\"ERROR\" resource.label.\"pod_name\"=monitoring.regex.full_match(\"ui-\\\\w+-\\\\w+\") resource.label.\"cluster_name\"=\"wbaas-2\"" + } + } + }, ] + timeshiftDuration = "0s" + yAxis = { + label = "y1Axis" + scale = "LINEAR" + } + } } - name = "projects/658442145969/dashboards/92e20d9b-3948-4469-bef3-b567edd6d223" - } - ) - project = "wikibase-cloud" - timeouts {} + width = 6 + yPos = 20 + }, + ] + } + name = "projects/658442145969/dashboards/92e20d9b-3948-4469-bef3-b567edd6d223" + } + ) + project = "wikibase-cloud" + timeouts {} } diff --git a/tf/env/staging/ip.tf b/tf/env/staging/ip.tf index 1613a2b12..26cd0aa3f 100644 --- a/tf/env/staging/ip.tf +++ b/tf/env/staging/ip.tf @@ -1,5 +1,5 @@ resource "google_compute_address" "default" { - name = "wbaas-1-cluster-ip" + name = "wbaas-1-cluster-ip" address_type = "EXTERNAL" network_tier = "PREMIUM" } \ No newline at end of file diff --git a/tf/env/staging/kubernetes-secrets.tf b/tf/env/staging/kubernetes-secrets.tf index 5dec99223..2464eea42 100644 --- a/tf/env/staging/kubernetes-secrets.tf +++ b/tf/env/staging/kubernetes-secrets.tf @@ -22,9 +22,9 @@ module "wbaas2-k8s-secrets" { api_app_key = random_password.api-app-key.result api_app_jwt_secret = random_password.api-app-jwt-secret.result mediawiki_secret_namespaces = [ - "default", + "default", kubernetes_namespace.api-job-namespace.metadata[0].name, - kubernetes_namespace.adhoc-job-namespace.metadata[0].name + kubernetes_namespace.adhoc-job-namespace.metadata[0].name ] logical_backup_openssl_secret = random_password.logical_backup_random_password.result } diff --git a/tf/env/staging/mailgun.tf b/tf/env/staging/mailgun.tf index e03977bbb..aa5027c90 100644 --- a/tf/env/staging/mailgun.tf +++ b/tf/env/staging/mailgun.tf @@ -2,9 +2,9 @@ resource "mailgun_domain" "default" { name = "wikibase.dev" region = "eu" spam_action = "disabled" - dkim_key_size = 1024 + dkim_key_size = 1024 smtp_password = random_password.smtp-password.result lifecycle { - ignore_changes = [ smtp_password ] - } + ignore_changes = [smtp_password] + } } diff --git a/tf/env/staging/namespaces.tf b/tf/env/staging/namespaces.tf index 1c4e5da90..3ff7b99eb 100644 --- a/tf/env/staging/namespaces.tf +++ b/tf/env/staging/namespaces.tf @@ -8,7 +8,7 @@ resource "kubernetes_namespace" "api-job-namespace" { resource "kubernetes_resource_quota" "api-jobs-podquota" { provider = kubernetes.wbaas-2 - + metadata { name = "api-jobs-podquota" namespace = kubernetes_namespace.api-job-namespace.metadata[0].name diff --git a/tf/env/staging/platform-summary-dashboard.tf b/tf/env/staging/platform-summary-dashboard.tf index 5bbe474bf..8757cd195 100644 --- a/tf/env/staging/platform-summary-dashboard.tf +++ b/tf/env/staging/platform-summary-dashboard.tf @@ -223,7 +223,7 @@ resource "google_monitoring_dashboard" "platform-summary" { number of users created in the last 24 hours EOT format = "MARKDOWN" - style = {} + style = {} } title = "Legend" } diff --git a/tf/env/staging/providers.tf b/tf/env/staging/providers.tf index ab1577c91..3f4748b50 100644 --- a/tf/env/staging/providers.tf +++ b/tf/env/staging/providers.tf @@ -1,21 +1,21 @@ provider "google" { - project = "wikibase-cloud" - region = "europe-west3" - zone = "europe-west3-a" + project = "wikibase-cloud" + region = "europe-west3" + zone = "europe-west3-a" } terraform { required_providers { kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } mailgun = { - source = "wgebis/mailgun" + source = "wgebis/mailgun" version = "0.6.1" } google = { - source = "hashicorp/google" + source = "hashicorp/google" version = "4.74.0" } } @@ -40,5 +40,5 @@ provider "kubernetes" { } provider "mailgun" { - api_key = "${var.mailgun_api_key}" -} + api_key = var.mailgun_api_key +} diff --git a/tf/env/staging/remote-state/main.tf b/tf/env/staging/remote-state/main.tf index 442096acc..34175d7ab 100644 --- a/tf/env/staging/remote-state/main.tf +++ b/tf/env/staging/remote-state/main.tf @@ -1,23 +1,23 @@ provider "google" { - project = "wikibase-cloud" - region = "europe-west3" - zone = "europe-west3-a" + project = "wikibase-cloud" + region = "europe-west3" + zone = "europe-west3-a" } # A non public bucket for storing shared terraform state resource "google_storage_bucket" "tf-state" { - name = "wikibase-cloud-tf-state-staging" - location = "EU" - force_destroy = false + name = "wikibase-cloud-tf-state-staging" + location = "EU" + force_destroy = false uniform_bucket_level_access = true versioning { - enabled = true + enabled = true } } # Give someone initial access resource "google_storage_bucket_iam_member" "tf-state-iam-member" { bucket = google_storage_bucket.tf-state.name - role = "roles/storage.objectAdmin" + role = "roles/storage.objectAdmin" member = "user:thomas.arrow@wikimedia.de" } diff --git a/tf/env/staging/secrets-backups.tf b/tf/env/staging/secrets-backups.tf index 4d2c6cd4b..ed571aa78 100644 --- a/tf/env/staging/secrets-backups.tf +++ b/tf/env/staging/secrets-backups.tf @@ -3,6 +3,6 @@ resource "random_password" "logical_backup_random_password" { special = true override_special = "_%@" keepers = { - rotate = 1 - } + rotate = 1 + } } \ No newline at end of file diff --git a/tf/env/staging/secrets-sql.tf b/tf/env/staging/secrets-sql.tf index e1be1d3cc..00e148666 100644 --- a/tf/env/staging/secrets-sql.tf +++ b/tf/env/staging/secrets-sql.tf @@ -1,12 +1,12 @@ # Use for sql dbs resource "random_password" "sql-passwords" { - for_each = var.sql-passwords + for_each = var.sql-passwords length = 32 special = true override_special = "_%@" keepers = { - rotate = 2 - } + rotate = 2 + } } resource "random_password" "sql-root-password" { length = 32 diff --git a/tf/env/staging/serviceaccount.tf b/tf/env/staging/serviceaccount.tf index 421e3c42e..50b29a5fe 100644 --- a/tf/env/staging/serviceaccount.tf +++ b/tf/env/staging/serviceaccount.tf @@ -5,31 +5,31 @@ resource "google_project_iam_member" "certman-dns01-solver" { } resource "google_service_account" "certman-dns01-solver" { - account_id = "certman-dns01-solver" - description = "change dns settings for certman" - disabled = false - display_name = "certman-dns01-solver" + account_id = "certman-dns01-solver" + description = "change dns settings for certman" + disabled = false + display_name = "certman-dns01-solver" } # TODO future regular rotation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key#example-usage-creating-and-regularly-rotating-a-key resource "google_service_account_key" "certman-dns01-solver" { - service_account_id = google_service_account.certman-dns01-solver.name + service_account_id = google_service_account.certman-dns01-solver.name - keepers = { - rotate = 1 - } + keepers = { + rotate = 1 + } } resource "google_service_account" "dev-api" { - account_id = "wikibase-dev-api" - disabled = false - display_name = "Service Account" + account_id = "wikibase-dev-api" + disabled = false + display_name = "Service Account" } # TODO future regular rotation https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_key#example-usage-creating-and-regularly-rotating-a-key resource "google_service_account_key" "dev-api" { - service_account_id = google_service_account.dev-api.name - keepers = { - rotate = 1 - } + service_account_id = google_service_account.dev-api.name + keepers = { + rotate = 1 + } } diff --git a/tf/env/staging/terraform.tf b/tf/env/staging/terraform.tf index 7fb782f3d..6ccbf268c 100644 --- a/tf/env/staging/terraform.tf +++ b/tf/env/staging/terraform.tf @@ -1,24 +1,24 @@ terraform { backend "gcs" { - bucket = "wikibase-cloud-tf-state-staging" - prefix = "terraform/state" + bucket = "wikibase-cloud-tf-state-staging" + prefix = "terraform/state" } } resource "google_storage_bucket" "tf-state-staging" { - name = "wikibase-cloud-tf-state-staging" - location = "EU" - force_destroy = false + name = "wikibase-cloud-tf-state-staging" + location = "EU" + force_destroy = false uniform_bucket_level_access = true versioning { - enabled = true + enabled = true } } # Give everyone access to the state bucket resource "google_storage_bucket_iam_member" "tf-state-staging-iam-member" { for_each = var.terraformers - bucket = google_storage_bucket.tf-state-staging.name - role = "roles/storage.objectAdmin" - member = "user:${each.value}" + bucket = google_storage_bucket.tf-state-staging.name + role = "roles/storage.objectAdmin" + member = "user:${each.value}" } diff --git a/tf/env/staging/uptime-latency-dashboard.tf b/tf/env/staging/uptime-latency-dashboard.tf index bce5d2aa2..3a05b0f80 100644 --- a/tf/env/staging/uptime-latency-dashboard.tf +++ b/tf/env/staging/uptime-latency-dashboard.tf @@ -1,382 +1,382 @@ resource "google_monitoring_dashboard" "uptime-latency" { dashboard_json = jsonencode( { - displayName = "Uptime and Latency (Staging)" - labels = { + displayName = "Uptime and Latency (Staging)" + labels = { staging = "" } mosaicLayout = { columns = 12 - tiles = [ + tiles = [ { height = 4 widget = { - title = "Request latency of the platform API health" + title = "Request latency of the platform API health" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-www-wikibase-dev-api-health-HJMz2B61RxQ\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-www-wikibase-dev-api-health-HJMz2B61RxQ\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 + width = 6 + xPos = 6 }, { height = 4 widget = { - title = "Request Latency of Queryservice" + title = "Request Latency of Queryservice" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-query-sparql-ckVjQhmXqDg\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-query-sparql-ckVjQhmXqDg\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 4 + width = 6 + yPos = 4 }, { height = 4 widget = { - title = "Request latency of Mediawiki API" + title = "Request latency of Mediawiki API" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-wbgetentities-ADerz9_UmdY\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-wbgetentities-ADerz9_UmdY\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 + width = 6 }, { height = 4 widget = { - title = "Request latency of Mediawiki Web Pod - Item" + title = "Request latency of Mediawiki Web Pod - Item" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-itempage-NRffch1fFzI\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-itempage-NRffch1fFzI\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 4 + width = 6 + xPos = 6 + yPos = 4 }, { height = 4 widget = { - title = "Request latency of Special Version" + title = "Request latency of Special Version" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MEAN" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_MEAN" + perSeriesAligner = "ALIGN_MEAN" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-7AbaoNv-B3U\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/request_latency\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-7AbaoNv-B3U\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 8 + width = 6 + yPos = 8 }, { height = 4 widget = { - title = "Count of \"down\" checks of Mediawiki API" + title = "Count of \"down\" checks of Mediawiki API" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_NEXT_OLDER" + perSeriesAligner = "ALIGN_NEXT_OLDER" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-wbgetentities-ADerz9_UmdY\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-wbgetentities-ADerz9_UmdY\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 8 + width = 6 + xPos = 6 + yPos = 8 }, { height = 4 widget = { - title = "Count of \"down\" checks of The platform API health endpoint" + title = "Count of \"down\" checks of The platform API health endpoint" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_NEXT_OLDER" + perSeriesAligner = "ALIGN_NEXT_OLDER" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-www-wikibase-dev-api-health-HJMz2B61RxQ\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-www-wikibase-dev-api-health-HJMz2B61RxQ\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 12 + width = 6 + yPos = 12 }, { height = 4 widget = { - title = "Count of \"down\" checks of Queryservice" + title = "Count of \"down\" checks of Queryservice" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_NEXT_OLDER" + perSeriesAligner = "ALIGN_NEXT_OLDER" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-query-sparql-ckVjQhmXqDg\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-query-sparql-ckVjQhmXqDg\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 12 + width = 6 + xPos = 6 + yPos = 12 }, { height = 4 widget = { - title = "Count of \"down\" checks of Mediawiki Web Pod - Item" + title = "Count of \"down\" checks of Mediawiki Web Pod - Item" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_NEXT_OLDER" + perSeriesAligner = "ALIGN_NEXT_OLDER" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-itempage-NRffch1fFzI\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-wikibase-itempage-NRffch1fFzI\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 16 + width = 6 + yPos = 16 }, { height = 4 widget = { - title = "Count of \"down\" checks of Mediawiki Web Pod - Special:Version" + title = "Count of \"down\" checks of Mediawiki Web Pod - Special:Version" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_COUNT_FALSE" - groupByFields = [ + groupByFields = [ "metric.label.\"check_id\"", "metric.label.\"checker_location\"", ] - perSeriesAligner = "ALIGN_NEXT_OLDER" + perSeriesAligner = "ALIGN_NEXT_OLDER" } - filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-7AbaoNv-B3U\"" + filter = "metric.type=\"monitoring.googleapis.com/uptime_check/check_passed\" resource.type=\"uptime_url\" metric.label.\"check_id\"=\"https-coffeebase-wikibase-dev-7AbaoNv-B3U\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 16 + width = 6 + xPos = 6 + yPos = 16 }, ] } - name = "projects/658442145969/dashboards/fe72f469-1cf6-40bd-a539-78488f9547b6" + name = "projects/658442145969/dashboards/fe72f469-1cf6-40bd-a539-78488f9547b6" } ) - project = "wikibase-cloud" + project = "wikibase-cloud" timeouts {} } diff --git a/tf/env/staging/uptime.tf b/tf/env/staging/uptime.tf index 54f86e28d..74b923f4e 100644 --- a/tf/env/staging/uptime.tf +++ b/tf/env/staging/uptime.tf @@ -3,12 +3,12 @@ module "uptime-checks" { providers = { kubernetes = kubernetes.wbaas-2 } - target_wiki = "coffeebase.wikibase.dev" + target_wiki = "coffeebase.wikibase.dev" target_wbaas_hostname = "wikibase.dev" - wikibase_itempage_item = "Q1" + wikibase_itempage_item = "Q1" wikibase_itempage_content = "Arabica" - project_id = local.project_id + project_id = local.project_id monitoring_email_group_name = google_monitoring_notification_channel.monitoring_email_group.name } \ No newline at end of file diff --git a/tf/env/staging/variables.tf b/tf/env/staging/variables.tf index d6e40c0d7..10ca543c0 100644 --- a/tf/env/staging/variables.tf +++ b/tf/env/staging/variables.tf @@ -1,70 +1,70 @@ variable "terraformers" { - type = set(string) + type = set(string) description = "People with access to Terraform state" default = [ - "thomas.arrow@wikimedia.de", - "perside.rosalie@wikimedia.de", - "jakob.warkotsch@wikimedia.de", - "deniz.erdogan@wikimedia.de", - "oliver.shotton@wikimedia.de", - "dat.nguyen@wikimedia.de", - "leszek.manicki@wikimedia.de", - "conny.kawohl@wikimedia.de", - "andrew.kostka@wikimedia.de", - "frederik.ring@wikimedia.de" - ] + "thomas.arrow@wikimedia.de", + "perside.rosalie@wikimedia.de", + "jakob.warkotsch@wikimedia.de", + "deniz.erdogan@wikimedia.de", + "oliver.shotton@wikimedia.de", + "dat.nguyen@wikimedia.de", + "leszek.manicki@wikimedia.de", + "conny.kawohl@wikimedia.de", + "andrew.kostka@wikimedia.de", + "frederik.ring@wikimedia.de" + ] } locals { staging_cluster_name = "wbaas-2" - project_id = "wikibase-cloud" - email_group = "wb-cloud-monitoring@wikimedia.de" + project_id = "wikibase-cloud" + email_group = "wb-cloud-monitoring@wikimedia.de" } variable "mailgun_api_key" { - type = string + type = string description = "User API key to access Mailgun" - sensitive = true + sensitive = true } variable "sql-passwords" { - type = set(string) + type = set(string) description = "SQL passwords to create and send to k8s as secrets" default = [ - "staging-replication", - "staging-api", - "staging-mediawiki-db-manager", - "staging-backup-manager", - ] + "staging-replication", + "staging-api", + "staging-mediawiki-db-manager", + "staging-backup-manager", + ] } variable "recaptcha_v3_site_key" { - type = string + type = string description = "Site key to access recaptcha v3" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v3_secret" { - type = string + type = string description = "Secret key to access recaptcha v3" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v2_site_key" { - type = string + type = string description = "Site key to access recaptcha v2" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } variable "recaptcha_v2_secret" { - type = string + type = string description = "Secret key to access recaptcha v2" - sensitive = true - default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user + sensitive = true + default = "" # apparently this doesn't mean default is empty string but rather default is not defined. This means it won't prompt the user # but also won't override the value that is in the state } diff --git a/tf/env/staging/workload-technical-metric.tf b/tf/env/staging/workload-technical-metric.tf index 5a66d173a..c60079925 100644 --- a/tf/env/staging/workload-technical-metric.tf +++ b/tf/env/staging/workload-technical-metric.tf @@ -1,34 +1,34 @@ resource "google_monitoring_dashboard" "workload-technical-metrics" { dashboard_json = jsonencode( { - displayName = "Workload technical metrics (Staging)" - labels = { + displayName = "Workload technical metrics (Staging)" + labels = { staging = "" } mosaicLayout = { columns = 12 - tiles = [ + tiles = [ { height = 4 widget = { - title = "logging/user/staging-site-request-count (filtered) by label.domain [SUM]" + title = "logging/user/staging-site-request-count (filtered) by label.domain [SUM]" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { - aggregation = { + aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_SUM" - groupByFields = [ + groupByFields = [ "metric.label.\"domain\"", ] - perSeriesAligner = "ALIGN_RATE" + perSeriesAligner = "ALIGN_RATE" } - filter = "metric.type=\"logging.googleapis.com/user/staging-site-request-count\" metric.label.\"domain\"!=monitoring.regex.full_match(\".+.wikibase.cloud\")" + filter = "metric.type=\"logging.googleapis.com/user/staging-site-request-count\" metric.label.\"domain\"!=monitoring.regex.full_match(\".+.wikibase.cloud\")" secondaryAggregation = { alignmentPeriod = "60s" perSeriesAligner = "ALIGN_MEAN" @@ -38,233 +38,233 @@ resource "google_monitoring_dashboard" "workload-technical-metrics" { }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 12 + width = 12 }, { height = 4 widget = { - title = "Mediawiki - Max CPU limit utilization " + title = "Mediawiki - Max CPU limit utilization " xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "metadata.user_labels.\"app.kubernetes.io/component\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=\"mediawiki\"" + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=\"mediawiki\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 4 + width = 6 + xPos = 6 + yPos = 4 }, { height = 4 widget = { - title = "Mediawiki - Max Memory limit utilization " + title = "Mediawiki - Max Memory limit utilization " xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "metadata.user_labels.\"app.kubernetes.io/component\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=\"mediawiki\"" + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=\"mediawiki\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 4 + width = 6 + yPos = 4 }, { height = 4 widget = { - title = "API - Max CPU limit utilization" + title = "API - Max CPU limit utilization" xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "resource.label.\"container_name\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\")" + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\")" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 8 + width = 6 + xPos = 6 + yPos = 8 }, { height = 4 widget = { - title = "APi - Memory limit utilization " + title = "APi - Memory limit utilization " xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "resource.label.\"container_name\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\")" + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"namespace_name\"=\"default\" resource.label.\"container_name\"=monitoring.regex.full_match(\"(api-\\\\w+)\")" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 8 + width = 6 + yPos = 8 }, { height = 4 widget = { - title = "SQL/Redis/ElasticSearch/Queryservice - Max CPU limit utilization " + title = "SQL/Redis/ElasticSearch/Queryservice - Max CPU limit utilization " xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "resource.label.\"pod_name\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"namespace_name\"=\"default\"" + filter = "metric.type=\"kubernetes.io/container/cpu/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\") resource.label.\"namespace_name\"=\"default\"" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - xPos = 6 - yPos = 12 + width = 6 + xPos = 6 + yPos = 12 }, { height = 4 widget = { - title = "SQL/Redis/ElasticSearch/Queryservice - Max Memory Limit Utilization " + title = "SQL/Redis/ElasticSearch/Queryservice - Max Memory Limit Utilization " xyChart = { - dataSets = [ + dataSets = [ { minAlignmentPeriod = "60s" plotType = "LINE" targetAxis = "Y1" - timeSeriesQuery = { + timeSeriesQuery = { timeSeriesFilter = { aggregation = { alignmentPeriod = "60s" crossSeriesReducer = "REDUCE_MAX" - groupByFields = [ + groupByFields = [ "resource.label.\"pod_name\"", ] - perSeriesAligner = "ALIGN_MAX" + perSeriesAligner = "ALIGN_MAX" } - filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\")" + filter = "metric.type=\"kubernetes.io/container/memory/limit_utilization\" resource.type=\"k8s_container\" resource.label.\"namespace_name\"=\"default\" resource.label.\"cluster_name\"=\"wbaas-2\" resource.label.\"container_name\"=monitoring.regex.full_match(\"mariadb|elasticsearch|redis|queryservice\")" } } }, ] timeshiftDuration = "0s" - yAxis = { + yAxis = { label = "y1Axis" scale = "LINEAR" } } } - width = 6 - yPos = 12 + width = 6 + yPos = 12 }, ] } - name = "projects/658442145969/dashboards/2d52c0cf-9699-4758-a013-d25bfe771213" + name = "projects/658442145969/dashboards/2d52c0cf-9699-4758-a013-d25bfe771213" } ) - project = "wikibase-cloud" + project = "wikibase-cloud" timeouts {} } diff --git a/tf/modules/buckets/locals.tf b/tf/modules/buckets/locals.tf index c218d17e4..5f67a2136 100644 --- a/tf/modules/buckets/locals.tf +++ b/tf/modules/buckets/locals.tf @@ -1,8 +1,8 @@ data "google_project" "project" {} locals { - gcs_api_static_bucket_name = "${var.project_prefix}-static" - gcs_api_static_bucket_backup_name = "${var.project_prefix}-static-backup" - gcs_sql_bucket_backup_name = "${var.project_prefix}-sql-backup" - transfer_service_id = "project-${data.google_project.project.number}@storage-transfer-service.iam.gserviceaccount.com" + gcs_api_static_bucket_name = "${var.project_prefix}-static" + gcs_api_static_bucket_backup_name = "${var.project_prefix}-static-backup" + gcs_sql_bucket_backup_name = "${var.project_prefix}-sql-backup" + transfer_service_id = "project-${data.google_project.project.number}@storage-transfer-service.iam.gserviceaccount.com" } diff --git a/tf/modules/buckets/main.tf b/tf/modules/buckets/main.tf index 4c2f7f8b0..6e861e417 100644 --- a/tf/modules/buckets/main.tf +++ b/tf/modules/buckets/main.tf @@ -1,7 +1,7 @@ locals { - sql_backup_bucket_service_admins = ["serviceAccount:${var.static_bucket_writer_account}"] - static_backup_bucket_service_admins = [ "serviceAccount:${local.transfer_service_id}" ] - user_admins = [for i, username in var.user_object_admins : "user:${username}"] + sql_backup_bucket_service_admins = ["serviceAccount:${var.static_bucket_writer_account}"] + static_backup_bucket_service_admins = ["serviceAccount:${local.transfer_service_id}"] + user_admins = [for i, username in var.user_object_admins : "user:${username}"] } @@ -26,12 +26,12 @@ resource "google_storage_bucket" "sql-backup" { # SQL Backup bucket IAM Policy data "google_iam_policy" "sql-backup-policy" { binding { - role = "roles/storage.objectAdmin" + role = "roles/storage.objectAdmin" members = local.sql_backup_bucket_service_admins } binding { - role = "roles/storage.admin" + role = "roles/storage.admin" members = local.user_admins } } @@ -69,12 +69,12 @@ resource "google_storage_bucket" "static-backup" { # Backup bucket IAM Policy data "google_iam_policy" "transfer_job" { binding { - role = "roles/storage.objectAdmin" - members = local.static_backup_bucket_service_admins - } + role = "roles/storage.objectAdmin" + members = local.static_backup_bucket_service_admins + } binding { - role = "roles/storage.admin" + role = "roles/storage.admin" members = local.user_admins } } @@ -91,7 +91,7 @@ resource "google_storage_transfer_job" "static-bucket-nightly-backup" { transfer_spec { gcs_data_source { bucket_name = local.gcs_api_static_bucket_name - path = "sites/" + path = "sites/" } gcs_data_sink { bucket_name = local.gcs_api_static_bucket_backup_name diff --git a/tf/modules/buckets/providers.tf b/tf/modules/buckets/providers.tf index 694cc27c4..50ec87410 100644 --- a/tf/modules/buckets/providers.tf +++ b/tf/modules/buckets/providers.tf @@ -1,10 +1,10 @@ terraform { required_providers { google = { - + } kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } } diff --git a/tf/modules/buckets/variables.tf b/tf/modules/buckets/variables.tf index b71553a10..72b5e4015 100644 --- a/tf/modules/buckets/variables.tf +++ b/tf/modules/buckets/variables.tf @@ -1,14 +1,14 @@ variable "project_prefix" { - type = string + type = string description = "User provided prefix for created buckets" } variable "static_bucket_writer_account" { - type = string + type = string description = "Google service account that should be granted write access to bucket" } variable "user_object_admins" { - type = set(string) + type = set(string) description = "Users who have access to the backup buckets" } \ No newline at end of file diff --git a/tf/modules/config-map/wbaas-ui-config/main.tf b/tf/modules/config-map/wbaas-ui-config/main.tf index a298da73d..48fa31574 100644 --- a/tf/modules/config-map/wbaas-ui-config/main.tf +++ b/tf/modules/config-map/wbaas-ui-config/main.tf @@ -9,4 +9,4 @@ resource "kubernetes_config_map" "wbaas" { } -output "cname_record" { value = var.cname_record } \ No newline at end of file +output "cname_record" { value = var.cname_record } \ No newline at end of file diff --git a/tf/modules/config-map/wbaas-ui-config/variables.tf b/tf/modules/config-map/wbaas-ui-config/variables.tf index 805c97e50..3bf6222c4 100644 --- a/tf/modules/config-map/wbaas-ui-config/variables.tf +++ b/tf/modules/config-map/wbaas-ui-config/variables.tf @@ -1,4 +1,4 @@ variable "cname_record" { - type = string + type = string description = "CNAME_RECORD to be used for custom domains" } \ No newline at end of file diff --git a/tf/modules/k8s-secrets/providers.tf b/tf/modules/k8s-secrets/providers.tf index f6333c077..ab3ee109a 100644 --- a/tf/modules/k8s-secrets/providers.tf +++ b/tf/modules/k8s-secrets/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } } diff --git a/tf/modules/monitoring/elasticsearch.tf b/tf/modules/monitoring/elasticsearch.tf index f75439e21..b59a41c8d 100644 --- a/tf/modules/monitoring/elasticsearch.tf +++ b/tf/modules/monitoring/elasticsearch.tf @@ -1,38 +1,38 @@ resource "google_logging_metric" "elasticsearch-metrics" { - for_each = var.elasticsearch_metrics + for_each = var.elasticsearch_metrics - filter = <<-EOT + filter = <<-EOT resource.type="k8s_container" resource.labels.cluster_name="${var.cluster_name}" resource.labels.namespace_name="default" labels.k8s-pod/job-name:"stats-cron-" severity>=DEFAULT EOT - label_extractors = { - "Node" = "EXTRACT(jsonPayload.name)" - } - name = "${var.cluster_name}-elasticsearch-metrics-${each.value}" - value_extractor = "REGEXP_EXTRACT(jsonPayload.\"${each.value}\", \"(\\\\d+)\")" + label_extractors = { + "Node" = "EXTRACT(jsonPayload.name)" + } + name = "${var.cluster_name}-elasticsearch-metrics-${each.value}" + value_extractor = "REGEXP_EXTRACT(jsonPayload.\"${each.value}\", \"(\\\\d+)\")" - bucket_options { + bucket_options { - exponential_buckets { - growth_factor = 2 - num_finite_buckets = 64 - scale = 0.01 - } + exponential_buckets { + growth_factor = 2 + num_finite_buckets = 64 + scale = 0.01 } + } - metric_descriptor { - metric_kind = "DELTA" - unit = "1" - value_type = "DISTRIBUTION" + metric_descriptor { + metric_kind = "DELTA" + unit = "1" + value_type = "DISTRIBUTION" - labels { - key = "Node" - value_type = "STRING" - } + labels { + key = "Node" + value_type = "STRING" } + } - timeouts {} + timeouts {} } \ No newline at end of file diff --git a/tf/modules/monitoring/main.tf b/tf/modules/monitoring/main.tf index 2b40fc797..10f4bf4f2 100644 --- a/tf/modules/monitoring/main.tf +++ b/tf/modules/monitoring/main.tf @@ -1,17 +1,17 @@ #https://www.percona.com/blog/2014/10/08/mysql-replication-got-fatal-error-1236-causes-and-cures/ resource "google_logging_metric" "mariadb-server_errno-1236" { - name = "${var.cluster_name}-mariadb-sql-errno-1236-error-count" - filter = "resource.labels.cluster_name=\"${var.cluster_name}\" AND resource.labels.container_name=\"mariadb\" AND textPayload:\"server_errno=1236\"" - metric_descriptor { - metric_kind = "DELTA" - value_type = "INT64" - } + name = "${var.cluster_name}-mariadb-sql-errno-1236-error-count" + filter = "resource.labels.cluster_name=\"${var.cluster_name}\" AND resource.labels.container_name=\"mariadb\" AND textPayload:\"server_errno=1236\"" + metric_descriptor { + metric_kind = "DELTA" + value_type = "INT64" + } } - + resource "google_monitoring_alert_policy" "alert_policy_replica_failure" { display_name = "(${var.cluster_name}): SQL replica error 1236 alert policy" combiner = "OR" - notification_channels = [ + notification_channels = [ "${var.monitoring_email_group_name}" ] documentation { @@ -20,18 +20,18 @@ resource "google_monitoring_alert_policy" "alert_policy_replica_failure" { conditions { display_name = "(${var.cluster_name}): SQL replica errorno 1236" condition_threshold { - # resource.type needed because of https://github.com/hashicorp/terraform-provider-google/issues/4165 - filter = "metric.type=\"logging.googleapis.com/user/${google_logging_metric.mariadb-server_errno-1236.name}\" AND resource.type=\"k8s_container\"" - duration = "60s" - comparison = "COMPARISON_GT" - aggregations { - alignment_period = "1200s" - per_series_aligner = "ALIGN_RATE" - cross_series_reducer = "REDUCE_SUM" - } - trigger { - count = 1 + # resource.type needed because of https://github.com/hashicorp/terraform-provider-google/issues/4165 + filter = "metric.type=\"logging.googleapis.com/user/${google_logging_metric.mariadb-server_errno-1236.name}\" AND resource.type=\"k8s_container\"" + duration = "60s" + comparison = "COMPARISON_GT" + aggregations { + alignment_period = "1200s" + per_series_aligner = "ALIGN_RATE" + cross_series_reducer = "REDUCE_SUM" + } + trigger { + count = 1 + } } } - } } diff --git a/tf/modules/monitoring/metric-alarms.tf b/tf/modules/monitoring/metric-alarms.tf index 79444ce8a..7bbb74f2b 100644 --- a/tf/modules/monitoring/metric-alarms.tf +++ b/tf/modules/monitoring/metric-alarms.tf @@ -35,12 +35,12 @@ resource "google_monitoring_alert_policy" "alert_policy_prometheus_metric" { } threshold_value = each.value.threshold_value aggregations { - alignment_period = "300s" - cross_series_reducer = "REDUCE_MIN" - group_by_fields = [ - each.value.min_group_by, - ] - per_series_aligner = "ALIGN_MEAN" + alignment_period = "300s" + cross_series_reducer = "REDUCE_MIN" + group_by_fields = [ + each.value.min_group_by, + ] + per_series_aligner = "ALIGN_MEAN" } } } @@ -50,12 +50,12 @@ resource "google_monitoring_alert_policy" "alert_policy_prometheus_metric" { duration = each.value.condition_absent filter = "resource.type = \"prometheus_target\" AND resource.labels.cluster = \"${var.cluster_name}\" AND ${each.value.filter}" aggregations { - alignment_period = "300s" - cross_series_reducer = "REDUCE_MIN" - group_by_fields = [ - each.value.min_group_by, - ] - per_series_aligner = "ALIGN_MEAN" + alignment_period = "300s" + cross_series_reducer = "REDUCE_MIN" + group_by_fields = [ + each.value.min_group_by, + ] + per_series_aligner = "ALIGN_MEAN" } } } diff --git a/tf/modules/monitoring/platform-summary.tf b/tf/modules/monitoring/platform-summary.tf index 7b6907821..cf9027b01 100644 --- a/tf/modules/monitoring/platform-summary.tf +++ b/tf/modules/monitoring/platform-summary.tf @@ -1,7 +1,7 @@ resource "google_logging_metric" "platform-summary-metrics" { - for_each = var.platform_summary_metrics + for_each = var.platform_summary_metrics - filter = <<-EOT + filter = <<-EOT resource.type="k8s_container" resource.labels.cluster_name="${var.cluster_name}" resource.labels.namespace_name="default" @@ -10,24 +10,24 @@ resource "google_logging_metric" "platform-summary-metrics" { labels.k8s-pod/app_kubernetes_io/name="api" severity>=DEFAULT jsonPayload.platform_summary_version="v1" EOT - name = "${var.cluster_name}-platform-summary-${each.value}" - value_extractor = "REGEXP_EXTRACT(jsonPayload.\"${each.value}\", \"(\\\\d+)\")" + name = "${var.cluster_name}-platform-summary-${each.value}" + value_extractor = "REGEXP_EXTRACT(jsonPayload.\"${each.value}\", \"(\\\\d+)\")" - bucket_options { + bucket_options { - exponential_buckets { - growth_factor = 2 - num_finite_buckets = 64 - scale = 0.01 - } + exponential_buckets { + growth_factor = 2 + num_finite_buckets = 64 + scale = 0.01 } + } - metric_descriptor { - metric_kind = "DELTA" - unit = "1" - value_type = "DISTRIBUTION" + metric_descriptor { + metric_kind = "DELTA" + unit = "1" + value_type = "DISTRIBUTION" - } + } - timeouts {} + timeouts {} } \ No newline at end of file diff --git a/tf/modules/monitoring/providers.tf b/tf/modules/monitoring/providers.tf index 694cc27c4..50ec87410 100644 --- a/tf/modules/monitoring/providers.tf +++ b/tf/modules/monitoring/providers.tf @@ -1,10 +1,10 @@ terraform { required_providers { google = { - + } kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } } diff --git a/tf/modules/monitoring/sql-backup-failure-alert.tf b/tf/modules/monitoring/sql-backup-failure-alert.tf index e4890bf99..e2234af90 100644 --- a/tf/modules/monitoring/sql-backup-failure-alert.tf +++ b/tf/modules/monitoring/sql-backup-failure-alert.tf @@ -22,8 +22,8 @@ resource "google_monitoring_alert_policy" "alert_policy_sql_logical_backup_failu conditions { display_name = "(${var.cluster_name}): SQL logical backup failure" condition_absent { - filter = "metric.type=\"logging.googleapis.com/user/${google_logging_metric.sql_logical_backup_success.name}\" AND resource.type=\"k8s_container\"" - duration = "88200s" + filter = "metric.type=\"logging.googleapis.com/user/${google_logging_metric.sql_logical_backup_success.name}\" AND resource.type=\"k8s_container\"" + duration = "88200s" trigger { count = 1 } diff --git a/tf/modules/snapshots/policies.tf b/tf/modules/snapshots/policies.tf index 5d89e63ed..c423f28af 100644 --- a/tf/modules/snapshots/policies.tf +++ b/tf/modules/snapshots/policies.tf @@ -1,16 +1,16 @@ resource "google_compute_resource_policy" "snapshot-nightly" { - name = "${var.cluster_name}-nightly-west-to-north-7d-1" + name = "${var.cluster_name}-nightly-west-to-north-7d-1" description = "A nightly snapshot that is retained for 7 days from europe-west3 to the europe-north1. Snapshots kept on disk deletion." - region = "europe-west3" + region = "europe-west3" snapshot_schedule_policy { schedule { daily_schedule { - days_in_cycle = 1 - start_time = "03:00" + days_in_cycle = 1 + start_time = "03:00" } } - + retention_policy { max_retention_days = 7 on_source_disk_delete = "KEEP_AUTO_SNAPSHOTS" @@ -18,7 +18,7 @@ resource "google_compute_resource_policy" "snapshot-nightly" { snapshot_properties { storage_locations = ["europe-north1"] - labels = {} + labels = {} } } } diff --git a/tf/modules/snapshots/providers.tf b/tf/modules/snapshots/providers.tf index f6333c077..ab3ee109a 100644 --- a/tf/modules/snapshots/providers.tf +++ b/tf/modules/snapshots/providers.tf @@ -1,7 +1,7 @@ terraform { required_providers { kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } } diff --git a/tf/modules/snapshots/variables.tf b/tf/modules/snapshots/variables.tf index 85f028b02..465730d0e 100644 --- a/tf/modules/snapshots/variables.tf +++ b/tf/modules/snapshots/variables.tf @@ -1,4 +1,4 @@ variable "cluster_name" { - type = string + type = string description = "Name of the cluster" } diff --git a/tf/modules/uptime/main.tf b/tf/modules/uptime/main.tf index 3ed6372cd..b2655c055 100644 --- a/tf/modules/uptime/main.tf +++ b/tf/modules/uptime/main.tf @@ -1,21 +1,21 @@ resource "google_monitoring_uptime_check_config" "https-content-uptime-check" { for_each = local.checks - display_name = each.value.name - timeout = "60s" + display_name = each.value.name + timeout = "60s" selected_regions = [] http_check { - path = each.value.path - port = "443" - use_ssl = true + path = each.value.path + port = "443" + use_ssl = true validate_ssl = true } monitored_resource { type = "uptime_url" labels = { - host = each.value.host + host = each.value.host project_id = var.project_id } } @@ -26,14 +26,14 @@ resource "google_monitoring_uptime_check_config" "https-content-uptime-check" { dynamic "json_path_matcher" { for_each = each.value.matcher == "NOT_MATCHES_JSON_PATH" ? toset([1]) : toset([]) content { - json_matcher = each.value.json_matcher - json_path = each.value.json_path + json_matcher = each.value.json_matcher + json_path = each.value.json_path } } } } -resource "google_monitoring_alert_policy" "alert_policy_https-content-uptime-check"{ +resource "google_monitoring_alert_policy" "alert_policy_https-content-uptime-check" { for_each = google_monitoring_uptime_check_config.https-content-uptime-check display_name = "Uptime Health Check: ${each.value.display_name}" @@ -45,20 +45,20 @@ resource "google_monitoring_alert_policy" "alert_policy_https-content-uptime-che condition_threshold { filter = "resource.type = \"uptime_url\" AND metric.type = \"monitoring.googleapis.com/uptime_check/check_passed\" AND metric.labels.check_id = ${each.value.uptime_check_id}" aggregations { - alignment_period = "18000s" # 5hours - cross_series_reducer = "REDUCE_COUNT_FALSE" - group_by_fields = [ - "resource.label.project_id", - "resource.label.host" - ] - per_series_aligner = "ALIGN_NEXT_OLDER" + alignment_period = "18000s" # 5hours + cross_series_reducer = "REDUCE_COUNT_FALSE" + group_by_fields = [ + "resource.label.project_id", + "resource.label.host" + ] + per_series_aligner = "ALIGN_NEXT_OLDER" } - comparison = "COMPARISON_GT" - duration = "300s" - trigger { - count = 1 - } - threshold_value = 1 + comparison = "COMPARISON_GT" + duration = "300s" + trigger { + count = 1 + } + threshold_value = 1 } } combiner = "OR" diff --git a/tf/modules/uptime/providers.tf b/tf/modules/uptime/providers.tf index 694cc27c4..50ec87410 100644 --- a/tf/modules/uptime/providers.tf +++ b/tf/modules/uptime/providers.tf @@ -1,10 +1,10 @@ terraform { required_providers { google = { - + } kubernetes = { - source = "hashicorp/kubernetes" + source = "hashicorp/kubernetes" version = "2.5.0" } } diff --git a/tf/modules/uptime/variables.tf b/tf/modules/uptime/variables.tf index 6a9ee3466..e5f208ca0 100644 --- a/tf/modules/uptime/variables.tf +++ b/tf/modules/uptime/variables.tf @@ -1,120 +1,120 @@ variable "project_id" { - type = string + type = string description = "Google project id. Example: wikibase-cloud" } variable "target_wiki" { - type = string + type = string description = "The wiki we do uptime checks against. Manually created. Example: coffeebase.wikibase.dev" } variable "target_wbaas_hostname" { - type = string + type = string description = "The target wbaas service we check uptime against. Example: wikibase.dev" } variable "monitoring_email_group_name" { - type = string + type = string description = "Name of the monitoring resource that will receive alerts" } variable "wikibase_itempage_item" { - type = string + type = string description = "The target item we will check. Example: Q1" - default = "Q1" + default = "Q1" } variable "wikibase_itempage_content" { - type = string + type = string description = "The content we look for rendered when visiting `wikibase_itempage_item_id`." } locals { - target_name = replace(var.target_wiki, ".", "-") + target_name = replace(var.target_wiki, ".", "-") target_wbaas_name = replace(var.target_wbaas_hostname, ".", "-") checks = { /* API CHECKS */ "https-www-${local.target_wbaas_name}" = { - name = "https-www-${local.target_wbaas_name}" - host = "www.${var.target_wbaas_hostname}" - path = "/" - content = "doesn't work properly without JavaScript enabled" + name = "https-www-${local.target_wbaas_name}" + host = "www.${var.target_wbaas_hostname}" + path = "/" + content = "doesn't work properly without JavaScript enabled" matcher = "CONTAINS_STRING" }, "https-www-${local.target_wbaas_name}-api-health" = { - name = "https-www-${local.target_wbaas_name}-api-health" - host = "api.${var.target_wbaas_hostname}" - path = "/healthz" - content = "It's Alive" + name = "https-www-${local.target_wbaas_name}-api-health" + host = "api.${var.target_wbaas_hostname}" + path = "/healthz" + content = "It's Alive" matcher = "CONTAINS_STRING" }, /* WIKI CHECKS */ "https-${local.target_name}" = { - name = "https-${local.target_name}" - host = var.target_wiki - path = "/wiki/Special:Version" - content = "Adam Shorland" + name = "https-${local.target_name}" + host = var.target_wiki + path = "/wiki/Special:Version" + content = "Adam Shorland" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-query" = { - name = "https-${local.target_name}-query" - host = var.target_wiki - path = "/query" - content = "Special:MyLanguage/Wikidata:SPARQL_query_service" + name = "https-${local.target_name}-query" + host = var.target_wiki + path = "/query" + content = "Special:MyLanguage/Wikidata:SPARQL_query_service" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-query-sparql" = { - name = "https-${local.target_name}-query-sparql" - host = var.target_wiki - path = "/query/sparql" - content = "http://www.w3.org/1999/02/22-rdf-syntax-ns" + name = "https-${local.target_name}-query-sparql" + host = var.target_wiki + path = "/query/sparql" + content = "http://www.w3.org/1999/02/22-rdf-syntax-ns" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-cradle" = { - name = "https-${local.target_name}-cradle" - host = var.target_wiki - path = "/tools/cradle" - content = "" + name = "https-${local.target_name}-cradle" + host = var.target_wiki + path = "/tools/cradle" + content = "" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-quickstatements" = { - name = "https-${local.target_name}-quickstatements" - host = var.target_wiki - path = "/tools/quickstatements" - content = "magnusmanske" + name = "https-${local.target_name}-quickstatements" + host = var.target_wiki + path = "/tools/quickstatements" + content = "magnusmanske" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-widar" = { - name = "https-${local.target_name}-widar" - host = var.target_wiki - path = "/tools/widar" - content = "You have not authorized Widar" + name = "https-${local.target_name}-widar" + host = var.target_wiki + path = "/tools/widar" + content = "You have not authorized Widar" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-wikibase-wbgetentities" = { - name = "https-${local.target_name}-wikibase-wbgetentities" - host = var.target_wiki - path = "/w/api.php?action=wbgetentities&format=json&errorformat=plaintext&uselang=en&ids=${var.wikibase_itempage_item}" - content = "${var.wikibase_itempage_content}" + name = "https-${local.target_name}-wikibase-wbgetentities" + host = var.target_wiki + path = "/w/api.php?action=wbgetentities&format=json&errorformat=plaintext&uselang=en&ids=${var.wikibase_itempage_item}" + content = "${var.wikibase_itempage_content}" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-wikibase-itempage" = { - name = "https-${local.target_name}-wikibase-itempage" - host = var.target_wiki - path = "/wiki/Item:${var.wikibase_itempage_item}" - content = "${var.wikibase_itempage_content}" + name = "https-${local.target_name}-wikibase-itempage" + host = var.target_wiki + path = "/wiki/Item:${var.wikibase_itempage_item}" + content = "${var.wikibase_itempage_content}" matcher = "CONTAINS_STRING" }, "https-${local.target_name}-wikibase-cirrussearch" = { - name = "https-${local.target_name}-wikibase-cirrussearch" - host = var.target_wiki - path = "/w/api.php?action=cirrus-mapping-dump&format=json" - matcher = "NOT_MATCHES_JSON_PATH" - json_matcher = "REGEX_MATCH" - json_path = "$.error" - content = ".*" + name = "https-${local.target_name}-wikibase-cirrussearch" + host = var.target_wiki + path = "/w/api.php?action=cirrus-mapping-dump&format=json" + matcher = "NOT_MATCHES_JSON_PATH" + json_matcher = "REGEX_MATCH" + json_path = "$.error" + content = ".*" }, } } \ No newline at end of file