consul: add postinstall step

This commit is contained in:
Starbeamrainbowlabs 2022-04-30 15:03:28 +01:00
parent ea8365f4ee
commit 7e47d23a28
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
3 changed files with 58 additions and 0 deletions

View File

@ -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"
]

View File

@ -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"
]

View File

@ -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 "$?";