User talk:Simon/Keeping private: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
Line 1: Line 1:
[[File:Bl announcement poster.jpeg|150px|thumb|Poster announcing the bootleg library, July 2019]]
[[File:Bl announcement poster.jpeg|150px|thumb|Poster announcing the bootleg library, July 2019]]


[[User:Simon/prototypes/calibre-web_configuration]]
{{User:Simon/prototypes/calibre-web_configuration}}


[[User:Simon/Trim4/prototypes/calibre_service_file]]
{{User:Simon/Trim4/prototypes/calibre_service_file}}


[[Category: Library Snippets]]
[[Category: Library Snippets]]

Latest revision as of 14:39, 20 June 2020

Poster announcing the bootleg library, July 2019

calibre-web configuration

This is the configuration for calibre-web to listen on localhost:

--- a/cps/server.py
+++ b/cps/server.py
@@ -152,7 +152,7 @@ class WebServer(object):
        http_server = HTTPServer(WSGIContainer(self.app),
                                 max_buffer_size=209700000,
                                 ssl_options=self.ssl_args)
-        http_server.listen(self.listen_port, self.listen_address)
+        http_server.listen(self.listen_port, address="127.0.0.1")
        self.wsgiserver = IOLoop.instance()
        self.wsgiserver.start()
        # wait for stop signal

Creating a unit file

You can easily create a unit file for calibre to run on boot on a modern (systemd) based Linux system. This means it will also restart after a crash. Create the file /etc/systemd/system/calibre-server.service with the contents shown below:

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

[Service]
Type=simple
User=pi
Group=pi
WorkingDirectory=/home/pi/calibre-web
ExecStart=python cps.py
Restart=always

[Install]
WantedBy=multi-user.target

The User and Group should be the same ones that own the files in the calibre library directory. It's generally not a good idea to run the server as root. Also change the path to the calibre library directory to suit your system.

Starting the calibre-server service

Run:

sudo systemctl start calibre-server

to start the server.

Stopping the calibre-server service

Stopping the service is as easy as running:

sudo systemctl stop calibre-server

Checking the status of the calibre-server service

Check its status with:

sudo systemctl status calibre-server

Enabling the calibre-server service to start at boot

To make it start at boot, run:

sudo systemctl enable calibre-server

Note

The calibre server does not need a running X server, but it does need the X libraries installed as some components it uses link against them.

The calibre server also supports systemd socket activation, so you can use that, if needed, as well.