ntfy icon indicating copy to clipboard operation
ntfy copied to clipboard

Add systemd user service for `ntfy-client.service`

Open dandersch opened this issue 1 year ago • 2 comments

We can offer ntfy-client.service as a user service along the already existing system service.

This allows the use of ~/.config/ntfy/client.yaml for configuration (for the system service, the config is hardcoded to use /etc/ntfy/client.yaml). It also means that we can update the docs to recommend enabling the user service for "personal desktop machine" use in https://docs.ntfy.sh/subscribe/cli/?h=systemd#using-the-systemd-service and remove the part about using an override.conf (unless this has another use case for the ntfy-client that I am missing?).

Repos would need to update their packages to copy over client/user/ntfy-client.service to /usr/lib/systemd/user/ntfy-client.service.

I've been using it successfully so far. I've also added entries to scripts/postinst.sh and .goreleaser.yml, but haven't tested those.

dandersch avatar Jan 15 '24 21:01 dandersch

Will this be possible to add to the docker image as well, so that it starts both server and client?

Migs3 avatar Jan 15 '24 22:01 Migs3

@Migs3 Not via this user service - the docker image doesn't (and shouldn't) use systemd. My use case was more for desktop machines that want to use only the client so that notifications can pop up with notify-send (without configuring anything in /etc like the override.conf or client.yml). If you want this functionality with a docker container, I think you would have to do what the override.conf did, i.e. include something like

    environment:
      - DISPLAY=:0
      - DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
    volumes:
      - /run/user/1000/bus:/run/user/1000/bus
    command:
      #- serve
      - subscribe

dandersch avatar Jan 16 '24 12:01 dandersch