diff --git a/src/configs/consul-client.hcl b/src/configs/consul-client.hcl new file mode 100644 index 0000000..4de382f --- /dev/null +++ b/src/configs/consul-client.hcl @@ -0,0 +1,17 @@ +bind_addr = "{{ GetInterfaceIP \"wgoverlay\" }}" + +bootstrap = false +server = false + +domain = "mooncarrot.space." + +client_addr = "127.0.0.1 {{ GetInterfaceIP \"docker0\" }}" + +data_dir = "/srv/consul" +log_level = "INFO" + +retry_join = [ + "wopplefox", + "spatterling", + "sycadil" +] diff --git a/src/configs/consul-server.hcl b/src/configs/consul-server.hcl new file mode 100644 index 0000000..41a8c88 --- /dev/null +++ b/src/configs/consul-server.hcl @@ -0,0 +1,24 @@ +bind_addr = "{{ GetInterfaceIP \"wgoverlay\" }}" + +# When we have this many servers in the cluster, automatically run the first leadership election +# Remember that the Hashicorp stack uses the Raft consensus algorithm. +bootstrap_expect = 3 +server = true +ui_config { + enabled = true +} + +client_addr = "127.0.0.1 {{ GetInterfaceIP \"docker0\" }} {{ GetInterfaceIP \"wgoverlay\" }}" + +data_dir = "/srv/consul" +log_level = "INFO" + +domain = "mooncarrot.space." + + +retry_join = [ + // "172.16.230.100" + "wopplefox", + "spatterling", + "sycadil" +] diff --git a/src/steps-postinstall/75-consul.sh b/src/steps-postinstall/75-consul.sh new file mode 100755 index 0000000..6603c5c --- /dev/null +++ b/src/steps-postinstall/75-consul.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + + +task_begin "Installing Consul configuration"; +# /etc/consul is created by the apt postinstall script + +subtask_begin "Copying configuration files"; +cp "configs/consul-client.hcl" "/etc/consul/client.hcl"; +cp "configs/consul-server.hcl" "/etc/consul/server.hcl"; +subtask_end "$?"; + +subtask_begin "Starting Consul and enabling on boot"; +systemctl consul; +subtask_end "$?"; + + +task_end "$?";