Commit cbaf0ffc authored by Ahmad Sherif's avatar Ahmad Sherif

Provision a dedicated disk for /var/log

parent 707f15a2
......@@ -103,7 +103,7 @@ resource "google_compute_network_peering" "peering_ops" {
#################################
module "web" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-web]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -131,7 +131,7 @@ module "web" {
#################################
module "api" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-api]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -159,7 +159,7 @@ module "api" {
##################################
module "git" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-git]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -187,7 +187,7 @@ module "git" {
#################################
module "registry" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-registry]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -215,7 +215,7 @@ module "registry" {
#################################
module "postgres" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 5000
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -237,7 +237,7 @@ module "postgres" {
}
module "pg-bouncer" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-db-pgbouncer]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -260,7 +260,7 @@ module "pg-bouncer" {
}
module "geo-postgres" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 5000
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -288,7 +288,7 @@ module "geo-postgres" {
##################################
module "redis" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 100
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -309,7 +309,7 @@ module "redis" {
}
module "redis-cache" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
dns_zone_name = "${var.dns_zone_name}"
environment = "${var.environment}"
......@@ -341,7 +341,7 @@ module "redis-cache" {
##################################
module "sidekiq" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-be-sidekiq-besteffort]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -381,7 +381,7 @@ module "sidekiq" {
##################################
module "mailroom" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-be-mailroom]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -409,7 +409,7 @@ module "mailroom" {
##################################
module "file" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 16000
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -454,7 +454,7 @@ module "file" {
##################################
module "share" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 16000
data_disk_type = "pd-standard"
chef_provision = "${var.chef_provision}"
......@@ -476,7 +476,7 @@ module "share" {
}
module "lfs" {
bootstrap_version = 3
bootstrap_version = 5
data_disk_size = 16000
data_disk_type = "pd-standard"
chef_run_list = "\"role[${var.environment}-base-stor]\""
......@@ -499,7 +499,7 @@ module "lfs" {
}
module "pages" {
bootstrap_version = 3
bootstrap_version = 5
chef_run_list = "\"role[${var.environment}-base-stor]\""
data_disk_size = 16000
data_disk_type = "pd-standard"
......@@ -522,7 +522,7 @@ module "pages" {
}
module "artifacts" {
bootstrap_version = 3
bootstrap_version = 5
chef_run_list = "\"role[${var.environment}-base-stor]\""
data_disk_size = 32000
data_disk_type = "pd-standard"
......@@ -551,7 +551,7 @@ module "artifacts" {
##################################
module "fe-lb" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-fe]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -580,7 +580,7 @@ module "fe-lb" {
##################################
module "fe-lb-pages" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-pages]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -607,7 +607,7 @@ module "fe-lb-pages" {
##################################
module "fe-lb-altssh" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-altssh]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -752,7 +752,7 @@ module "gcp-tcp-lb-bastion" {
##################################
module "consul" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[gprd-infra-consul]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -787,7 +787,7 @@ module "consul" {
##################################
module "pubsubbeat" {
bootstrap_version = 3
bootstrap_version = 5
allow_stopping_for_update = true
names = "${var.pubsubbeats["names"]}"
machine_types = "${var.pubsubbeats["machine_types"]}"
......@@ -865,7 +865,7 @@ module "monitoring-lb" {
module "performance" {
attach_data_disk = true
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-private-grafana]\""
data_disk_size = 100
......@@ -891,7 +891,7 @@ module "performance" {
module "prometheus" {
attach_data_disk = true
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-prometheus]\""
data_disk_size = 1000
......@@ -917,7 +917,7 @@ module "prometheus" {
module "prometheus-app" {
attach_data_disk = true
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-prometheus-app]\""
data_disk_size = 1000
......@@ -943,7 +943,7 @@ module "prometheus-app" {
module "alerts" {
node_count = 1
bootstrap_version = 3
bootstrap_version = 5
subnetwork_name = "${google_compute_subnetwork.monitoring.name}"
attach_data_disk = true
data_disk_size = 100
......@@ -974,7 +974,7 @@ module "alerts" {
##################################
module "console" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-console-node]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -1002,7 +1002,7 @@ module "console" {
##################################
module "deploy" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-deploy-node]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -1030,7 +1030,7 @@ module "deploy" {
##################################
module "runner" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-runner]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -1079,7 +1079,7 @@ module "google-azure-vpn" {
##################################
module "bastion" {
bootstrap_version = 3
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-bastion]\""
dns_zone_name = "${var.dns_zone_name}"
......
......@@ -99,7 +99,7 @@ resource "google_compute_network_peering" "peering_ops" {
module "web" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-web]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -126,7 +126,7 @@ module "web" {
module "api" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-api]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -153,7 +153,7 @@ module "api" {
module "git" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-git]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -179,7 +179,7 @@ module "git" {
#################################
module "registry" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-fe-registry]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -206,7 +206,7 @@ module "registry" {
module "postgres" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 5000
data_disk_type = "pd-ssd"
chef_init_run_list = "\"role[${var.environment}-force-gitlab-ctl-reconfigure]\""
......@@ -228,7 +228,7 @@ module "postgres" {
}
module "pg-bouncer" {
bootstrap_version = 4
bootstrap_version = 5
chef_init_run_list = "\"role[${var.environment}-force-gitlab-ctl-reconfigure]\""
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-db-pgbouncer]\""
......@@ -249,7 +249,7 @@ module "pg-bouncer" {
}
module "geo-postgres" {
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 5000
data_disk_type = "pd-ssd"
chef_init_run_list = "\"role[${var.environment}-force-gitlab-ctl-reconfigure]\""
......@@ -278,7 +278,7 @@ module "geo-postgres" {
module "redis" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 100
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -304,7 +304,7 @@ module "redis" {
}
module "redis-cache" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
dns_zone_name = "${var.dns_zone_name}"
environment = "${var.environment}"
......@@ -342,7 +342,7 @@ module "redis-cache" {
module "sidekiq" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-be-sidekiq-besteffort]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -383,7 +383,7 @@ module "sidekiq" {
module "mailroom" {
allow_stopping_for_update = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-be-mailroom]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -409,7 +409,7 @@ module "mailroom" {
##################################
module "file" {
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 1000
data_disk_type = "pd-ssd"
chef_provision = "${var.chef_provision}"
......@@ -453,7 +453,7 @@ module "file" {
##################################
module "share" {
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 1000
data_disk_type = "pd-standard"
chef_provision = "${var.chef_provision}"
......@@ -474,7 +474,7 @@ module "share" {
}
module "lfs" {
bootstrap_version = 4
bootstrap_version = 5
data_disk_size = 1000
data_disk_type = "pd-standard"
chef_run_list = "\"role[${var.environment}-base-stor]\""
......@@ -495,7 +495,7 @@ module "lfs" {
}
module "pages" {
bootstrap_version = 4
bootstrap_version = 5
chef_run_list = "\"role[${var.environment}-base-stor]\""
data_disk_size = 1000
data_disk_type = "pd-standard"
......@@ -516,7 +516,7 @@ module "pages" {
}
module "artifacts" {
bootstrap_version = 4
bootstrap_version = 5
chef_run_list = "\"role[${var.environment}-base-stor]\""
data_disk_size = 1000
data_disk_type = "pd-standard"
......@@ -543,7 +543,7 @@ module "artifacts" {
##################################
module "fe-lb" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-fe]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -572,7 +572,7 @@ module "fe-lb" {
##################################
module "fe-lb-pages" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-pages]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -599,7 +599,7 @@ module "fe-lb-pages" {
##################################
module "fe-lb-altssh" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-lb-altssh]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -740,7 +740,7 @@ module "gcp-tcp-lb-bastion" {
##################################
module "consul" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-consul]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -774,7 +774,7 @@ module "consul" {
##################################
module "pubsubbeat" {
bootstrap_version = 4
bootstrap_version = 5
names = "${var.pubsubbeats["names"]}"
machine_types = "${var.pubsubbeats["machine_types"]}"
chef_provision = "${var.chef_provision}"
......@@ -849,7 +849,7 @@ module "monitoring-lb" {
module "performance" {
attach_data_disk = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-private-grafana]\""
data_disk_size = 100
......@@ -874,7 +874,7 @@ module "performance" {
module "prometheus" {
attach_data_disk = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-prometheus]\""
data_disk_size = 1000
......@@ -899,7 +899,7 @@ module "prometheus" {
module "prometheus-app" {
attach_data_disk = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-prometheus-app]\""
data_disk_size = 1000
......@@ -924,7 +924,7 @@ module "prometheus-app" {
module "alerts" {
attach_data_disk = true
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-infra-alerts]\""
data_disk_size = 100
......@@ -954,7 +954,7 @@ module "alerts" {
##################################
module "console" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-console-node]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -981,7 +981,7 @@ module "console" {
##################################
module "deploy" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-deploy-node]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -1007,7 +1007,7 @@ module "deploy" {
##################################
module "runner" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-runner]\""
dns_zone_name = "${var.dns_zone_name}"
......@@ -1054,7 +1054,7 @@ module "google-azure-vpn" {
##################################
module "bastion" {
bootstrap_version = 4
bootstrap_version = 5
chef_provision = "${var.chef_provision}"
chef_run_list = "\"role[${var.environment}-base-bastion]\""
dns_zone_name = "${var.dns_zone_name}"
......
......@@ -17,6 +17,19 @@ resource "google_compute_disk" "data_disk" {
}
}
resource "google_compute_disk" "log_disk" {
project = "${var.project}"
count = "${var.node_count}"
name = "${format("%v-%02d-%v-%v-log", var.name, count.index + 1, var.tier, var.environment)}"
zone = "${var.zone != "" ? var.zone : data.google_compute_zones.available.names[(count.index + 1) % length(data.google_compute_zones.available.names)]}"
size = "${var.log_disk_size}"
type = "${var.log_disk_type}"
labels {
environment = "${var.environment}"
}
}
resource "google_compute_instance" "instance_with_attached_disk" {
count = "${var.node_count}"
name = "${format("%v-%02d-%v-%v", var.name, count.index + 1, var.tier, var.environment)}"
......@@ -81,6 +94,11 @@ resource "google_compute_instance" "instance_with_attached_disk" {
source = "${google_compute_disk.data_disk.*.self_link[count.index]}"
}
attached_disk {
source = "${google_compute_disk.log_disk.*.self_link[count.index]}"
device_name = "log"
}
network_interface {
subnetwork = "${google_compute_subnetwork.subnetwork.name}"
access_config = {}
......
......@@ -56,6 +56,18 @@ variable "environment" {
description = "The environment name"
}
variable "log_disk_size" {
type = "string"
description = "The size of the log disk"
default = 50
}
variable "log_disk_type" {
type = "string"
description = "The type of the log disk"
default = "pd-standard"
}
variable "format_data_disk" {
type = "string"
description = "Force formatting of the persistent disk."
......
......@@ -26,6 +26,19 @@ resource "google_compute_disk" "data_disk" {
}
}
resource "google_compute_disk" "redis_log_disk" {
project = "${var.project}"
count = "${var.redis_count}"
name = "${format("%v-%02d-%v-%v-log", var.name, count.index + 1, var.tier, var.environment)}"
zone = "${var.zone != "" ? var.zone : data.google_compute_zones.available.names[(count.index + 1) % length(data.google_compute_zones.available.names)]}"
size = "${var.log_disk_size}"
type = "${var.log_disk_type}"
labels {
environment = "${var.environment}"
}
}
resource "google_compute_instance" "instance_with_attached_disk" {
count = "${var.redis_count}"
name = "${format("%v-%02d-%v-%v", var.name, count.index + 1, var.tier, var.environment)}"
......@@ -91,6 +104,11 @@ resource "google_compute_instance" "instance_with_attached_disk" {
source = "${google_compute_disk.data_disk.*.self_link[count.index]}"
}
attached_disk {
source = "${google_compute_disk.redis_log_disk.*.self_link[count.index]}"
device_name = "log"
}
network_interface {
subnetwork = "${google_compute_subnetwork.subnetwork.name}"
address = "${google_compute_address.static-ip-address.*.address[count.index]}"
......
......@@ -25,6 +25,19 @@ resource "google_compute_disk" "sentinel_data_disk" {
}
}
resource "google_compute_disk" "sentinel_log_disk" {
project = "${var.project}"
count = "${var.sentinel_count}"
name = "${format("%v-sentinel-%02d-%v-%v-log", var.name, count.index + 1, var.tier, var.environment)}"
zone = "${var.zone != "" ? var.zone : data.google_compute_zones.available.names[(count.index + 1) % length(data.google_compute_zones.available.names)]}"
size = "${var.log_disk_size}"
type = "${var.log_disk_type}"
labels {
environment = "${var.environment}"
}
}
resource "google_compute_instance" "sentinel_instance_with_attached_disk" {
count = "${var.sentinel_count}"
name = "${format("%v-sentinel-%02d-%v-%v", var.name, count.index + 1, var.tier, var.environment)}"
......@@ -90,6 +103,11 @@ resource "google_compute_instance" "sentinel_instance_with_attached_disk" {
source = "${google_compute_disk.sentinel_data_disk.*.self_link[count.index]}"
}
attached_disk {
source = "${google_compute_disk.sentinel_log_disk.*.self_link[count.index]}"
device_name = "log"
}
network_interface {
subnetwork = "${google_compute_subnetwork.subnetwork.name}"
address = "${google_compute_address.sentinel-static-ip-address.*.address[count.index]}"
......
......@@ -45,6 +45,18 @@ variable "environment" {
description = "The environment name"
}
variable "log_disk_size" {
type = "string"
description = "The size of the log disk"
default = 50
}
variable "log_disk_type" {
type = "string"
description = "The type of the log disk"
default = "pd-standard"
}
variable "format_data_disk" {
type = "string"
description = "Force formatting of the persistent disk."
......
......@@ -26,6 +26,19 @@ resource "google_compute_disk" "data_disk" {
}
}
resource "google_compute_disk" "log_disk" {
project = "${var.project}"