From 20a930b985fe9a3a6a7773d79e05508dc25c676d Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Tue, 7 Dec 2021 23:33:45 +0530 Subject: [PATCH] instead, use systemd and a conf file --- consul-bootstrap.sh | 68 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/consul-bootstrap.sh b/consul-bootstrap.sh index ee8956e..25a4869 100755 --- a/consul-bootstrap.sh +++ b/consul-bootstrap.sh @@ -5,32 +5,84 @@ # bind : bind interface address # server-ip : server ip address +# exit on error +set -e + # create directory if doesn't exist and set permissions -mkdir -p /opt/consul/{config,data} && chmod 700 /opt/consul +mkdir -p /etc/consul.d/ && chown -R consul:consul /etc/consul.d/ + +# write systemd conf +cat >>/etc/systemd/system/consul.service <> /etc/consul.d/consul.hcl <> /etc/consul.d/server.hcl <