Badger
Docs / Concepts

Running in production

Badger runs as a long-lived service. On most Linux systems that means a systemd unit.

systemd

Create a user for it and the unit:

$ sudo useradd --system --home /var/lib/badger --create-home --shell /usr/sbin/nologin badger
# /etc/systemd/system/badger.service
[Unit]
Description=Badger
After=network-online.target
Wants=network-online.target

[Service]
User=badger
ExecStart=/usr/local/bin/badger worker
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=/var/lib/badger

[Install]
WantedBy=multi-user.target
$ sudo systemctl daemon-reload
$ sudo systemctl enable --now badger
$ journalctl -u badger -f

Badger reloads its configuration on SIGHUP, so systemctl reload badger applies changes without a restart.

Containers

Release archives include a Dockerfile. Build the image once and run it with the configuration mounted:

$ docker build -t badger:1.1.0 .
$ docker run -d --name badger --restart unless-stopped -v /etc/badger:/etc/badger:ro badger:1.1.0 worker

Upgrading

Replace the binary and restart. Within a major version the configuration stays compatible; the changelog says when anything needs your attention.