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 <