Opened 13 years ago

Closed 5 years ago

#2034 closed feature-request (Fixed)

Add systemd .service file

Reported by: mcx Owned by:
Priority: minor Milestone: 2.0.2
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 13 years ago.
Deluged systemd service file
deluged-web-ui.service (182 bytes ) - added by mcx 13 years ago.
deluged-web-ui.socket (103 bytes ) - added by mcx 13 years ago.

Download all attachments as: .zip

Change History (22)

by mcx, 13 years ago

Attachment: deluged.service added

Deluged systemd service file

comment:1 by mcx, 13 years ago

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

by mcx, 13 years ago

Attachment: deluged-web-ui.service added

by mcx, 13 years ago

Attachment: deluged-web-ui.socket added

comment:2 by matimatik, 12 years ago

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 by matimatik, 12 years ago

Found this in Twisted documentation about integration with systemd.

comment:4 by Calum, 11 years ago

Resolution: fixed
Status: newclosed

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 by Rahul Sundaram, 11 years ago

Resolution: fixed
Status: closedreopened

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 by Calum, 10 years ago

Milestone: Future2.0.0

comment:7 by Hugo Osvaldo Barrera, 7 years ago

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 by Calum, 7 years ago

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 by Hugo Osvaldo Barrera, 7 years ago

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 by Calum, 7 years ago

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 by Hugo Osvaldo Barrera, 7 years ago

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 by Calum, 6 years ago

Milestone: 2.02.0.0

Milestone renamed

comment:13 by Calum, 6 years ago

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 by Hugo Osvaldo Barrera, 6 years ago

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 by Calum, 6 years ago

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 6 years ago by Calum (previous) (diff)

comment:16 by Hugo Osvaldo Barrera, 6 years ago

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.

comment:17 by Calum, 5 years ago

Milestone: 2.0.02.1.x

Ticket retargeted after milestone closed

comment:18 by Calum, 5 years ago

Milestone: 2.1.x2.0.2

comment:19 by Calum, 5 years ago

Resolution: Fixed
Status: reopenedclosed

Now in tarball: 212efc4f52dd9979511b871a560356c3e7b7ad6b

@hobarrera As long as package maintainers correctly install the service file with user.conf file and create deluge user there is no issue.

/etc/systemd/system/deluged.service /etc/systemd/system/deluged.service.d/user.conf

The use of deluge user in service file does rely on the actual deluge user being added to the system. I think it makes sense to remove it from the default service file and include details in user and packaging guides that using root is discouraged and detail how to setup with specific user.

Note: See TracTickets for help on using tickets.