Skip to content

Linux binary and systemd

Install and manage the Supermetry binary as a Linux systemd service.

Run a Supermetry release as a dedicated Linux system service.

The installer creates the supermetry system user, installs the binary at /usr/local/bin/supermetry, writes /etc/supermetry/supermetry.env, and creates /etc/systemd/system/supermetry.service. It then reloads systemd, enables and starts the service, and checks /readyz.

  1. Extract a Linux release archive, then install the user, directories, binary and bundled unit:

    Terminal window
    getent group supermetry >/dev/null || sudo groupadd --system supermetry
    getent passwd supermetry >/dev/null || sudo useradd --system --gid supermetry --home-dir /var/lib/supermetry --shell /usr/sbin/nologin supermetry
    sudo install -d -m 0750 -o root -g supermetry /etc/supermetry
    sudo install -d -m 0700 -o supermetry -g supermetry /var/lib/supermetry
    sudo install -m 0755 supermetry /usr/local/bin/supermetry
    sudo install -m 0644 supermetry.service /etc/systemd/system/supermetry.service
  2. Enter the PostgreSQL URL and public URL, then create the service environment:

    Terminal window
    printf 'PostgreSQL URL: '
    IFS= read -r database_url
    printf 'Public URL: '
    IFS= read -r base_url
    secret_key="$(openssl rand -base64 32)"
    env_file="$(mktemp)"
    printf '%s\n' \
    "SUPERMETRY_DATABASE_URL=${database_url}" \
    "SUPERMETRY_BASE_URL=${base_url}" \
    'SUPERMETRY_LISTEN=127.0.0.1:8787' \
    "SUPERMETRY_SECRET_KEY=${secret_key}" > "$env_file"
    sudo install -m 0640 -o root -g supermetry "$env_file" /etc/supermetry/supermetry.env
    rm "$env_file"
  3. Start the service now and on boot:

    Terminal window
    sudo systemctl daemon-reload
    sudo systemctl enable --now supermetry
Terminal window
sudo systemctl start supermetry
sudo systemctl stop supermetry
sudo systemctl restart supermetry
sudo systemctl enable supermetry
sudo systemctl disable supermetry
sudo systemctl status supermetry
sudo journalctl -u supermetry -f

The unit starts the server with /usr/local/bin/supermetry and no subcommand.

What you should see: sudo systemctl status supermetry reports an active service.