I’m trying to start the snapshot agent at boot, with systemd, like I start consul, which the docs say I can do, but without providing any examples. Has anyone done this, and can share your service file? Particularly if you have acls turned on, and are passing in the token via an environment variable through systemd!
Gee, if you make it so consul can actually execute the script that systemd is trying to start, it helps a lot.
I wrote a script call start-snap so that I can pull the token out of secret storage, but here’s the working service file:
[Unit]
Description="Consul Snapshot Agent"
Documentation=https://www.consul.io/
Requires=network-online.target
After=consul.service
ConditionFileNotEmpty=/opt/consul/config/consul.hcl
[Service]
Type=simple
User=consul
Group=consul
ExecStart=/opt/consul/start-snap
KillMode=mixed
Restart=on-failure
RestartSec=10
StartLimitInterval=60
StartLimitBurst=6
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target