Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add systemd user service #3510

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tachi107
Copy link

@Tachi107 Tachi107 commented Jul 3, 2021

Closes #728

I didn't know where to put the systemd unit, so I created a systemd/ directory. Let me know if there is a more appropriate place :)

Edit: forgot to mention that I've obviously tested this, and (on my Debian 11 pc) everything works as expected

@FlexW
Copy link

FlexW commented Jul 12, 2021

I just wanted to throw in that this might not play nice with the autostart file that we provide. If the user disables autostart in the application, and has the systemd file installed, the settings from the gui get not respected anymore. That may confuse users.

EDIT: Btw you can use dex to autostart applications that provide a autostart file, if you don't use a DE like GNOME or KDE. I do that on i3.

@Tachi107
Copy link
Author

I just wanted to throw in that this might not play nice with the autostart file that we provide. If the user disables autostart in the application, and has the systemd file installed, the settings from the gui get not respected anymore. That may confuse users.

I agree, the UI is completely unaware of the systemd unit, but it is also true that having the unit installed does not cause the service to start, so unless the user manually runs systemctl --user enable nextcloud-desktop nothing strange should happen.

Syncing the UI and the systemd unit would be nice though

@Tachi107
Copy link
Author

I just noticed that running Nextcloud through systemd causes some minor issues; the client does not respect GTK settings like icon theme, font, etc (see screenshot).

Nothing that would cause serious problems, but I would prefer to first fix that issues and then let you merge this. Sorry for not noticing earlier :) (this also says a lot about the severity of the issue)

image

image

@Tachi107
Copy link
Author

This looks like a Qt issue, as running GTK apps through systemd does not cause any issue, while apps like qbittorrent suffer from the same problem.

If anyone has any suggestion it would be much appreciated :)

@mgallien
Copy link
Collaborator

This looks like a Qt issue, as running GTK apps through systemd does not cause any issue, while apps like qbittorrent suffer from the same problem.

If anyone has any suggestion it would be much appreciated :)

I guess you will want to modify Wants=network-online.target to be launched once the desktop environment is launched such that env variables are set and allow getting the proper style
one guess it to use graphical-session.target but I am not sure

@Tachi107
Copy link
Author

I guess you will want to modify Wants=network-online.target to be launched once the desktop environment is launched such that env variables are set and allow getting the proper style

That's the same thing I thought, but it seems that it doesn't solve the issue. Even manually restarting the service after the system is fully booted does nothing.

@mgallien
Copy link
Collaborator

I guess you will want to modify Wants=network-online.target to be launched once the desktop environment is launched such that env variables are set and allow getting the proper style

That's the same thing I thought, but it seems that it doesn't solve the issue. Even manually restarting the service after the system is fully booted does nothing.

I will have another look soon unless somebody is faster than me

@mgallien
Copy link
Collaborator

@Tachi107 I am really sorry for the lack of followup from me on this one
going to test it and see if I can get it merged

Signed-off-by: Andrea Pappacoda <andrea@pappacoda.it>
@Tachi107
Copy link
Author

Don't worry :)
I've been using this for quite a while now, and apart from the minor issues I mentioned before I did not encounter any other problems

@nextcloud-desktop-bot
Copy link

AppImage file: Nextcloud-PR-3510-394c89d50ed0abd4955957cc69bb976fca037819-x86_64.AppImage

To test this change/fix you can simply download above AppImage file and test it.

Please make sure to quit your existing Nextcloud app and backup your data.

@codecov
Copy link

codecov bot commented Jun 22, 2022

Codecov Report

Merging #3510 (394c89d) into master (af93a98) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #3510      +/-   ##
==========================================
- Coverage   56.42%   56.42%   -0.01%     
==========================================
  Files         138      138              
  Lines       17071    17071              
==========================================
- Hits         9633     9632       -1     
- Misses       7438     7439       +1     
Impacted Files Coverage Δ
src/libsync/propagatedownload.cpp 65.18% <0.00%> (-0.15%) ⬇️

Wants=network-online.target

[Service]
ExecStart=@bindir@/nextcloud --background
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

executable name is defined as a variable in cmake files
please replace this by this variable APPLICATION_EXECUTABLE

Copy link
Collaborator

@mgallien mgallien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my other comments
for the context
when developing the Nextcloud client, I run in parallel the latest official AppImage binary
so to be able to run my self built desktop client, I make changes to NEXTCLOUD.cmake to not conflict with the already running client

option(INSTALL_SYSTEMD "Install systemd user service" ON)
if(INSTALL_SYSTEMD)
set(bindir ${CMAKE_INSTALL_FULL_BINDIR})
configure_file(systemd/nextcloud-desktop.service.in ${CMAKE_CURRENT_BINARY_DIR}/nextcloud-desktop.service)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of nextcloud-desktop please use this cmake variable LINUX_APPLICATION_ID
that is already in use with the .desktop file generation (https://github.com/nextcloud/desktop/blob/master/src/gui/CMakeLists.txt#L732)

# SPDX-License-Identifier: GPL-2.0-or-later

[Unit]
Description=Nextcloud desktop user service
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace Nextcloud by this variable from cmake APPLICATION_NAME

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include a simple systemd service with the client
5 participants