Skip to content

Instantly share code, notes, and snippets.

@gnh1201
Created June 12, 2023 07:44
Show Gist options
  • Save gnh1201/a1543a06b37fbbd30df5640db2966aa4 to your computer and use it in GitHub Desktop.
Save gnh1201/a1543a06b37fbbd30df5640db2966aa4 to your computer and use it in GitHub Desktop.
rqlite with systemd
INTERFACE=venet0
NODE_ID=1
HTTP_PORT=2001
RAFT_PORT=2002
JOIN=
[Unit]
Description=rqlite cluster
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
EnvironmentFile=/etc/rqlite.env
ExecStartPre=/bin/bash -c "/bin/systemctl set-environment ip=$(/sbin/ip -o -4 addr list $INTERFACE | grep -v 127.0.0.1 | awk '{print $4}' | cut -d/ -f1)"
ExecStart=/usr/bin/rqlited -node-id ${NODE_ID} -http-addr ${ip}:${HTTP_PORT} -raft-addr ${ip}:${RAFT_PORT} -join ${JOIN} ${HOME}/node.${NODE_ID}
User=root
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
Restart=always
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment