From 5dead9cf4c9bf088ec69aa5ecfeb7db524586635 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 25 Dec 2021 21:32:23 +0100 Subject: [PATCH] deploy yugabytedb --- app/yugabyte/deploy/yugabyte.hcl | 202 +++++++++++++++++++++++++++++++ configuration.nix | 6 + 2 files changed, 208 insertions(+) create mode 100644 app/yugabyte/deploy/yugabyte.hcl diff --git a/app/yugabyte/deploy/yugabyte.hcl b/app/yugabyte/deploy/yugabyte.hcl new file mode 100644 index 0000000..534d7c7 --- /dev/null +++ b/app/yugabyte/deploy/yugabyte.hcl @@ -0,0 +1,202 @@ +job "yugabytedb" { + type = "service" + datacenters = [ "neptune", "pluton" ] + + priority = 80 + + constraint { + attribute = "${attr.cpu.arch}" + value = "amd64" + } + + group "master" { + count = 3 + + constraint { + attribute = "${attr.unique.hostname}" + operator = "regexp" + value = "(caribou|cariacou|carcajou)" + } + + network { + port "admin" { static = 7000 } + port "master-rpc" { static = 7100 } + } + + update { + max_parallel = 1 + min_healthy_time = "30s" + healthy_deadline = "5m" + } + + task "master" { + driver = "docker" + + config { + image = "yugabytedb/yugabyte:2.11.1.0-b305" + command = "/home/yugabyte/bin/yb-master" + args = [ + "--fs_data_dirs=/mnt/master", + "--replication_factor=3", + "--master_addresses=10.42.0.21:7100,10.42.0.22:7100,10.42.0.23:7100", + "--rpc_bind_addresses=0.0.0.0:7100", + "--placement_cloud=deuxfleurs", + "--placement_region=staging", + "--placement_zone=neptune", + ] + volumes = [ + "/mnt/ssd/yugabyte/master:/mnt/master", + ] + network_mode = "host" + logging { + type = "journald" + } + } + + resources { + memory = 1000 + cpu = 1000 + } + + kill_signal = "SIGINT" + kill_timeout = "20s" + + service { + tags = ["yugabyte-master-rpc"] + port = 7100 + address_mode = "driver" + name = "yugabyte-master-rpc" + check { + type = "tcp" + port = 7100 + address_mode = "driver" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + } + + service { + tags = ["yugabyte-admin"] + port = 7000 + address_mode = "driver" + name = "yugabyte-admin" + check { + type = "tcp" + port = 7000 + address_mode = "driver" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + } + + restart { + interval = "30m" + attempts = 10 + delay = "15s" + mode = "delay" + } + } + } + + group "tserver" { + count = 3 + + constraint { + attribute = "${attr.unique.hostname}" + operator = "!=" + value = "spoutnik" + } + + network { + port "ysql" { static = 5433 } + port "tserver-rpc" { static = 9100 } + } + + update { + max_parallel = 1 + min_healthy_time = "30s" + healthy_deadline = "5m" + } + + task "tserver" { + driver = "docker" + + config { + image = "yugabytedb/yugabyte:2.11.1.0-b305" + command = "/home/yugabyte/bin/yb-tserver" + args = [ + "--fs_data_dirs=/mnt/tserver", + "--start_pgsql_proxy", + "--tserver_master_addrs=10.42.0.21:7100,10.42.0.22:7100,10.42.0.23:7100", + "--rpc_bind_addresses=0.0.0.0:9100", + "--placement_cloud=deuxfleurs", + "--placement_region=staging", + "--placement_zone=neptune", + ] + volumes = [ + "/mnt/ssd/yugabyte/tserver:/mnt/tserver", + ] + network_mode = "host" + logging { + type = "journald" + } + } + + resources { + memory = 1000 + cpu = 1000 + } + + kill_signal = "SIGINT" + kill_timeout = "20s" + + service { + tags = ["yugabyte-tserver-rpc"] + port = 9100 + address_mode = "driver" + name = "yugabyte-tserver-rpc" + check { + type = "tcp" + port = 9100 + address_mode = "driver" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + } + + service { + tags = [ "yugabyte-ysql" ] + port = 5433 + address_mode = "driver" + name = "yugabyte-ysql" + check { + type = "tcp" + port = 5433 + address_mode = "driver" + interval = "60s" + timeout = "5s" + check_restart { + limit = 3 + grace = "90s" + ignore_warnings = false + } + } + } + } + } +} diff --git a/configuration.nix b/configuration.nix index 67b4ff5..98ae874 100644 --- a/configuration.nix +++ b/configuration.nix @@ -302,6 +302,12 @@ in iptables -A VPN -p tcp --dport 3991 -j ACCEPT iptables -A VPN -p tcp --dport 3992 -j ACCEPT + # Yugabyte DB + iptables -A VPN -p tcp --dport 5433 -j ACCEPT + iptables -A VPN -p tcp --dport 7000 -j ACCEPT + iptables -A VPN -p tcp --dport 7100 -j ACCEPT + iptables -A VPN -p tcp --dport 9100 -j ACCEPT + # Netdata monitoring iptables -A VPN -p tcp --dport 19999 -j ACCEPT '';