Skip to content

Instantly share code, notes, and snippets.

@yildirima
Last active March 2, 2019 20:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yildirima/b6927c96bc5a5532992001395777c89c to your computer and use it in GitHub Desktop.
Save yildirima/b6927c96bc5a5532992001395777c89c to your computer and use it in GitHub Desktop.
Consul Service File
#cat /usr/lib/systemd/system/consulv1-bootstrap.service
[Unit]
Description=Consul Agent (BootStrap)
After=network.target
[Service]
Restart=on-failure
User=appuser
Group=appgroup
Environment=HOME=/appdata/consulv1
EnvironmentFile=/appdata/consulv1/env
WorkingDirectory=/appdata/consulv1
ExecStartPre=/bin/echo IP=`/bin/hostname --ip-address` > /appdata/consulv1/env
ExecStart=/appdata/consulv1/consul agent -ui -config-dir=/appdata/consulv1/config -client $IP -bind $IP
ExecReload=/bin/kill -USR1 $MAINPID
PermissionsStartOnly=true
[Install]
WantedBy=multi-user.target
#cat /usr/lib/systemd/system/consulv1-server.service
[Unit]
Description=Consul Agent (Server)
After=network.target
[Service]
Restart=on-failure
User=appuser
Group=appgroup
Environment=HOME=/appdata/consulv1
EnvironmentFile=/appdata/consulv1/env
WorkingDirectory=/appdata/consulv1
ExecStartPre=/bin/echo IP=`/bin/hostname --ip-address` > /appdata/consulv1/env
ExecStart=/appdata/consulv1/consul agent -ui -config-dir=/appdata/consulv1/config -client $IP -bind $IP
ExecReload=/bin/kill -USR1 $MAINPID
PermissionsStartOnly=true
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment