Config file not loaded when running as service #158

Closed
opened 2020-03-31 20:55:11 +00:00 by Lombra · 3 comments

After some troubleshooting I've found that my config file is only getting loaded when I run the vikunja executable in the foreground, and not when I run it as a service.

When running in the foreground, I get the following and everything seems to work:

Found config file: /etc/vikunja/config.yml

When running as a service, I get the following and I can't login, presumably due to the database not being loaded:

$HOME is not defined
Using defaults.

I use the following unit file, following the example in the documentation:

[Unit]
Description=Vikunja
After=syslog.target
After=network.target
Requires=postgresql.service

[Service]
RestartSec=2s
Type=simple
WorkingDirectory=/opt/vikunja
ExecStart=/usr/bin/vikunja
Restart=always

[Install]
WantedBy=multi-user.target

I'm running Debian 10 and Vikunja 0.11 for backend and frontend.

I noticed there were some possibly related changes recently.
51c74de1de
I don't know whether this is included in the current master build, but using that did not seem to help.

After some troubleshooting I've found that my config file is only getting loaded when I run the vikunja executable in the foreground, and not when I run it as a service. When running in the foreground, I get the following and everything seems to work: ``` Found config file: /etc/vikunja/config.yml ``` When running as a service, I get the following and I can't login, presumably due to the database not being loaded: ``` $HOME is not defined Using defaults. ``` I use the following unit file, following the example in the documentation: ``` [Unit] Description=Vikunja After=syslog.target After=network.target Requires=postgresql.service [Service] RestartSec=2s Type=simple WorkingDirectory=/opt/vikunja ExecStart=/usr/bin/vikunja Restart=always [Install] WantedBy=multi-user.target ``` I'm running Debian 10 and Vikunja 0.11 for backend and frontend. I noticed there were some possibly related changes recently. https://kolaente.dev/vikunja/api/commit/51c74de1de9e4b6c60b99873b6fb87fe9d9eee08 I don't know whether this is included in the current master build, but using that did not seem to help.
Owner

Yes, 51c74de1de is included in the current master build (that one has always the latest changes from the master branch).

The behaviour you describe is indeed a bug, it should not bail if the home directory is not set but instead just don't try to add a config file from that directory. I assume this has something to do with the way systemd sets env variables.

I'll push a fix.

Yes, https://kolaente.dev/vikunja/api/commit/51c74de1de9e4b6c60b99873b6fb87fe9d9eee08 is included in the current master build (that one has always the latest changes from the master branch). The behaviour you describe is indeed a bug, it should not bail if the home directory is not set but instead just don't try to add a config file from that directory. I assume this has something to do with the way systemd sets env variables. I'll push a fix.
Owner

I've pushed a fix in 6d1018e647, a release will be ready in a few minutes once ci passes.

Please test again once a new release is ready.

I've pushed a fix in https://kolaente.dev/vikunja/api/commit/6d1018e6475057f8c620253880c181db4e69ae7e, a release will be ready in a few minutes [once ci passes](https://drone.kolaente.de/vikunja/api/1131). Please test again once a new release is ready.
Author

That seems to work. Thanks!

That seems to work. Thanks!
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#158
No description provided.