Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ramsay <james@jramsay.com.au>2020-04-23 09:06:53 +0300
committerJames Ramsay <james@jramsay.com.au>2020-04-23 09:06:53 +0300
commitfe777ade5ac897967399150fb98de597b4ed7fb8 (patch)
treebe5eb455c087b6e097e717e6614c8edbd8a95a14 /_support/terraform
parent5a7280c223690cfff32a47f46930af57aa467c09 (diff)
Add load balancer and multiple Praefect nodes
Praefect now stores state in SQL so that multiple nodes can be run behind a load balancer. This updates the Terraform configuration to reflect this.
Diffstat (limited to '_support/terraform')
-rw-r--r--_support/terraform/main.tf50
1 files changed, 49 insertions, 1 deletions
diff --git a/_support/terraform/main.tf b/_support/terraform/main.tf
index f7ab4d52c..1f6afb127 100644
--- a/_support/terraform/main.tf
+++ b/_support/terraform/main.tf
@@ -104,7 +104,7 @@ output "gitlab_external_ip" {
}
resource "google_compute_instance" "praefect" {
- count = 1
+ count = 3
name = "${var.praefect_demo_cluster_name}-praefect-${count.index + 1}"
machine_type = var.praefect_machine_type
@@ -126,6 +126,54 @@ resource "google_compute_instance" "praefect" {
}
}
+resource "google_compute_instance_group" "praefect-cluster" {
+ name = "${var.praefect_demo_cluster_name}-praefect-cluster"
+
+ instances = google_compute_instance.praefect.*.self_link
+
+ named_port {
+ name = "praefect-transport"
+ port = "2305"
+ }
+}
+
+resource "google_compute_forwarding_rule" "praefect-forwarding-rule" {
+ name = "${var.praefect_demo_cluster_name}-praefect-lb"
+ load_balancing_scheme = "INTERNAL"
+ backend_service = google_compute_region_backend_service.praefect-lb.self_link
+ ports = ["2305"]
+}
+
+resource "google_compute_region_backend_service" "praefect-lb" {
+ name = "${var.praefect_demo_cluster_name}-praefect-lb"
+ protocol = "TCP"
+ timeout_sec = 10
+ session_affinity = "NONE"
+
+ backend {
+ group = google_compute_instance_group.praefect-cluster.self_link
+ }
+
+ health_checks = [
+ google_compute_health_check.praefect-healthcheck.self_link
+ ]
+}
+
+resource "google_compute_health_check" "praefect-healthcheck" {
+ name = "${var.praefect_demo_cluster_name}-praefect-healthcheck"
+
+ check_interval_sec = 5
+ timeout_sec = 5
+
+ tcp_health_check {
+ port = "2305"
+ }
+}
+
+output "praefect_loadbalancer_ip" {
+ value = google_compute_forwarding_rule.praefect-forwarding-rule.ip_address
+}
+
output "praefect_internal_ip" {
value = {
for instance in google_compute_instance.praefect: