Opened 7 years ago

Last modified 5 months ago

#2034 reopened feature-request

Add systemd .service file

Reported by: mcx Owned by:
Priority: minor Milestone: 2.0.0
Component: Packaging Version: other (please specify)
Keywords: systemd unit service Cc:

Description

Hi,

I created deluged.service file[1] to support systemd[2].

It would be useful for all GNU/Linux distributions if you include it in deluge source packages.

[1] deluged.service attached
[2] http://www.freedesktop.org/wiki/Software/systemd

Best regards, Maciej Sitarz

Attachments (3)

deluged.service (176 bytes) - added by mcx 7 years ago.
Deluged systemd service file
deluged-web-ui.service (182 bytes) - added by mcx 7 years ago.
deluged-web-ui.socket (103 bytes) - added by mcx 7 years ago.

Download all attachments as: .zip

Change History (19)

Changed 7 years ago by mcx

Deluged systemd service file

comment:1 Changed 7 years ago by mcx

I also created a unit for deluged web interface daemon[1] and a .socket unit[2] for socket activation of the web UI.

[1] deluged-web-ui.service [2] deluged-web-ui.socket

Changed 7 years ago by mcx

Changed 7 years ago by mcx

comment:2 Changed 7 years ago by matimatik

Need socket passing support (either tcpd-like, or native systemd interface) in deluge-webui for this .socket to be usable. Maybe we need start new ticket about it...

comment:3 Changed 7 years ago by matimatik

Found this in Twisted documentation about integration with systemd.

comment:4 Changed 6 years ago by Cas

  • Resolution set to fixed
  • Status changed from new to closed

We don't really keep the service files in the codebase as they are either on the wiki or included by package maintainers.

I have created a systemd wiki page which probably needs fleshed out more.

I also think you should probably modify the script for deluged to also wait on the filesystem like the ubuntu upstart scripts.

comment:5 Changed 6 years ago by rahulsundaram

  • Resolution fixed deleted
  • Status changed from closed to reopened

I am the Fedora maintainer of Deluge and would request the systemd unit files be included in the codebase by default and conditionally installed only on distributions using systemd. This is easily achieved by using pkgconfig

http://www.freedesktop.org/software/systemd/man/daemon.html

Unlike sysv init scripts, systemd unit files are standardized across distros and Fedora (in the near future RHEL), (open)SUSE, Mageia, Mandriva, Arch Linux, NixOS etc use systemd by default and Debian installer has recently added support as well. Besides adding this support does not affect non-systemd distros in any way. Several upstream projects include systemd by default including Transmission etc. Thanks for your consideration.

comment:6 Changed 5 years ago by Cas

  • Milestone changed from Future to 2.0.0

comment:7 Changed 2 years ago by hobarrera

Personally, I'd much prefer that a user service file is provided (or maybe simply both, since one does not affect the other):

[Unit]
Description=A bitorrent client daemon
Documentation=man:deluged(1)

[Service]
ExecStart=/usr/bin/deluged -d

[Install]
WantedBy=default.target

This file should be installed into /usr/lib/systemd/user/deluged.service. The main difference is that this does not require root privileges to start the daemon, and it runs as a user of the service starting it (rather than a dedicated user).

I guess it may also allow multiple users to run their own instances of deluged (not sure if they could run at the same time) though.

comment:8 Changed 23 months ago by Cas

The reason for dedicated user is for security.

I have put service files into the codebase: http://git.deluge-torrent.org/deluge/tree/packaging/systemd?h=develop

Though I will need to remember to include it in source tarball.

comment:9 Changed 22 months ago by hobarrera

The reason for dedicated user is for security.

I understand this, but that requires root privileges to manage (also, downloads directory permissions becomes a bit of a pain with multiple users).

A user systemd service runs as the user, and importantly, can be controlled (started/stopped) by that user.

Any reason to NOT include both systemd files (they go into different locations, so there's no conflict).

comment:10 Changed 22 months ago by Cas

Are you suggesting this for desktop users rather than server environment, which is what these service file we originally intended for.

I am trying to envisage the scenarios that you are trying to cater for and whether there is a better alternative to cover all of them.

For example I have been looking at systemd as user:

https://www.brendanlong.com/systemd-user-services-are-amazing.html

comment:11 Changed 22 months ago by hobarrera

Yup, the additional file I'm proposing is geared towards desktop users, rather than dedicated machines.

I don't think a *single* alternative can cover both scenarios; they're pretty different.

comment:12 Changed 7 months ago by Cas

  • Milestone changed from 2.0 to 2.0.0

Milestone renamed

comment:13 Changed 5 months ago by Cas

So looking at this again, I am thinking that removing the user and group and instead put them in a conf file /etc/systemd/system/deluged.d/user.conf. This would mean the service files can be installed in both system and user locations.

comment:14 Changed 5 months ago by hobarrera

That's not correct: non-root users can't edit the /etc/systemd/system/deluged.d/user.conf file.

The systemd user unit file allows non-root users to manage and run deluge as themselves, without requiring root access on the host.

comment:15 Changed 5 months ago by Cas

Without the user details in service files they can be installed to both system and user. There is no need for a non-root user to edit /etc/systemd/system/deluged.d/user.conf file.

Last edited 5 months ago by Cas (previous) (diff)

comment:16 Changed 5 months ago by hobarrera

Without the user details, the system version would run as root, rather than as a dedicated user. Running a torrent daemon as root sounds like an awful idea, especially security-wise.

Note: See TracTickets for help on using tickets.