Newansage v0.4.0 is out
Guides / Run without systemd

Run without systemd

Run ansage in a container or under another supervisor, and what ansage upgrade needs from it.

ansage runs the same without systemd: the readiness messages (READY=1, RELOADING=1, STOPPING=1) are only sent when NOTIFY_SOCKET is set. What a supervisor has to provide:

ansage doesthe supervisor should
runs in the foreground, logs to stdoutkeep it in the foreground, collect stdout
exits 0 after SIGTERM/SIGINTnot restart it
exits 1 on an error (bad config, cannot bind)restart it after a delay
exits 75 for ansage upgraderestart it at once, with the binary now at its path
reloads on SIGHUPsend SIGHUP on reload (or run ansage reload)

ansage upgrade

ansage upgrade refuses when nothing would start ansage again:

Would be refused without --force: ansage does not run under systemd (no NOTIFY_SOCKET, no ANSAGE_SUPERVISED=1): nothing would start it again

Set ANSAGE_SUPERVISED=1 in ansage's environment once your supervisor restarts it on exit 75.

Docker / Compose

compose.yaml
services:
  ansage:
    image: debian:stable-slim
    command: ["/usr/local/bin/ansage", "--config", "/etc/ansage/ansage.toml"]
    network_mode: host               # BGP and the service address live on the host
    restart: unless-stopped          # also restarts after exit 75
    environment:
      ANSAGE_SUPERVISED: "1"
    cap_add: [NET_BIND_SERVICE]      # with listen on port 179; NET_ADMIN with [kernel]
    stop_grace_period: 45s           # longer than drain_time + 15 s
    volumes:
      - ./ansage:/usr/local/bin/ansage:ro
      - ./ansage.toml:/etc/ansage/ansage.toml:ro
      - ./run:/run/ansage

The binary is static (musl), so any base image works. docker compose exec ansage ansage show summary uses the control socket inside the container.

In the foreground

ansage --config ./ansage.toml --log-format text

Ctrl-C stops it (with drain_time: drains first, a second Ctrl-C stops at once). Colors are only used on a terminal; NO_COLOR turns them off.

Esc to close