Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 06-24-2017, 09:20 AM   #1
dom134
Member
dom134 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
--Manage-users and systemd

Hello there, I am really enjoying using Calibre 3.0: keep up the great work!

I am trying to run calibre-server through systemd (Ubuntu 16.04 and Apache2). I have created a couple of users using:
Quote:
calibre-server --manage-users
I can manually start calibre-server by using:
Quote:
calibre-server --url-prefix /calibre --port=8080 --enable-auth /path_to_library
However I do need to ensure that /path_to_library is owned by me and not root nor www-data. Calibre will then function with no issues.

If I try to run it through systemd, however, it continually asks for login details and I cannot get through to the library.

This is my file:

Quote:
#/lib/systemd/system/calibre.service

[Unit]
Description=Calibre Service
After=network.target

[Service]
Type=simple
PIDFile=/var/run/calibre-server.pid

ExecStart=/usr/bin/calibre-server \
--max-opds-items=30 \
--max-opds-ungrouped-items=100 \
--url-prefix /calibre \
--port=8080 \
--pidfile=/var/run/calibre-server.pid \
--enable-auth \
--log=calibre.log
/path_to_library

[Install]
WantedBy=multi-user.target
If I run it as --disable-auth it works fine, but without password protection!

Is there anything I am doing wrong?
dom134 is offline   Reply With Quote
Old 06-24-2017, 11:03 AM   #2
dom134
Member
dom134 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
I updated to 3.1 and I still have issues - I hadn't turned disable-auth off

Last edited by dom134; 06-24-2017 at 01:49 PM. Reason: mistakenly thought I had fixed it
dom134 is offline   Reply With Quote
Advert
Old 06-28-2017, 07:50 PM   #3
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Well, the systemd service is started as root, but calibre defaults to looking at the user database in "${XDG_CONFIG_HOME:-$HOME/.config}/calibre/server-users.sqlite". So you have edited it in /home/dom134/ (or whatever your username is) and then the systemd instance tried accessing it in /root/

You can pass the --userdb /path/to/server-users.sqlite if you like, but I suggest running calibre-server under your systemd user instance.

There is also no need for a pidfile, and if you don't specify a library calibre will fallback on serving all the libraries known to the GUI configuration.

Code:
[eschwartz@arch ~]$ cat ~/.config/systemd/user/calibre-server.service
[Unit]
Description=Main calibre server
After=network.target

[Service]
ExecStart=/usr/bin/calibre-server \
    --port=8080 \
    --enable-auth \
    --access-log=/%h/.local/share/calibre.log

[Install]
WantedBy=default.target
eschwartz is offline   Reply With Quote
Old 06-29-2017, 01:40 PM   #4
dom134
Member
dom134 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
Thumbs up

Thanks eschwarz, it works a treat!

In the end I passed the path to the user database, and it all works now.
This is my file:

[Unit]
Description=Calibre Service
After=network.target

[Service]
ExecStart=/usr/bin/calibre-server \
--url-prefix /calibre \
--port=8080 \
--enable-auth \
--access-log=/any_path/.local/share/calibre.log \
--userdb=/home/me/.config/calibre/server-users.sqlite \
/Calibre

[Install]
WantedBy=default.target
dom134 is offline   Reply With Quote
Old 06-29-2017, 08:00 PM   #5
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Well, keep in mind that the content server is capable of writing to both the library (via calibredb) and the userdb (there is a new option to edit your password directly from the browser). So you might not want to run it as root, if only because you can end up with root-owned files without meaning to.
eschwartz is offline   Reply With Quote
Advert
Old 06-30-2017, 04:10 PM   #6
dom134
Member
dom134 began at the beginning.
 
Posts: 14
Karma: 10
Join Date: May 2016
Device: none
Hello eschwartz,

How do you start a systemd unit without sudo?

I have placed the file in ~/.config/systemd/user, but when I start calibre.service all I get is:

Quote:
Failed to restart calibre.service: Unit calibre.service not found.
dom134 is offline   Reply With Quote
Old 06-30-2017, 04:37 PM   #7
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,422
Karma: 85397180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Code:
systemctl --user
will allow you to control systemd user instances. For more information, see the excellent Arch Wiki: https://wiki.archlinux.org/index.php/Systemd/User
eschwartz is offline   Reply With Quote
Reply

Tags
calibre-server, login/password, systemd


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Manage Tags Rellwood Library Management 1 07-27-2016 06:29 PM
Glo Manage collections junedog Kobo Reader 1 11-14-2013 07:51 AM
Manage Title? Sabardeyn Library Management 2 01-05-2013 01:16 AM
Mac users steered toward costlier hotels than Windows users? hrosvit General Discussions 35 06-29-2012 01:59 AM
Android users sad hicks, iPhone users rich girls afa General Discussions 38 08-22-2011 09:04 PM


All times are GMT -4. The time now is 03:33 AM.


MobileRead.com is a privately owned, operated and funded community.