Created
December 2, 2017 08:54
-
-
Save udomsak/7f14145a4d7b8fc987b5e5b06b2ff10a to your computer and use it in GitHub Desktop.
systemd unit for consul for zerotier auto DNS , dynamic Zerotier service-discovery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=consul agent | |
Requires=network-online.target | |
After=network-online.target | |
[Service] | |
EnvironmentFile=-/etc/default/consul | |
Environment=GOMAXPROCS=2 | |
Restart=on-failure | |
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment ZEROTIER_IP=$(nmcli connection show zt0 |grep IP4.ADDRESS |awk '{print $ | |
2}'|cut -f1 -d/)" | |
#ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d | |
ExecStart=/usr/local/bin/consul agent -server -bootstrap-expect=1 -bind $ZEROTIER_IP -data-dir=/tmp/consul -recursor 8.8.8.8 -ui -dns-port | |
53 -datacenter bangna -domain softsq.com -config-dir=/etc/consul.d | |
ExecReload=/bin/kill -HUP $MAINPID | |
KillSignal=SIGINT | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment