mirror of
https://framagit.org/medoc92/recollwebui.git
synced 2026-10-19 11:04:39 +00:00
Add systemd unit file and README.systemd explanation
Merged from https://github.com/koniu/recoll-webui/pull/55 Add a sample systemd script in examples and a README describing how to integrate the standalone WebUI app with systemd. Author: Rob Fair <fair.rob@gmail.com>
This commit is contained in:
parent
b6945210ed
commit
d8d5fea25d
3 changed files with 115 additions and 0 deletions
|
|
@ -52,6 +52,9 @@ There's some optional command-line arguments available::
|
|||
-a ADDR, --addr ADDR address to bind to [127.0.0.1]
|
||||
-p PORT, --port PORT port to listen on [8080]
|
||||
|
||||
The standalone application can be configured to run automatically using
|
||||
systemd. See the file README.systemd.
|
||||
|
||||
Run as WSGI/CGI
|
||||
---------------
|
||||
|
||||
|
|
|
|||
77
README.systemd
Normal file
77
README.systemd
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
Using the standalone WebUI application with systemd
|
||||
---------------------------------------------------
|
||||
This README describes how to configure systemd so that the
|
||||
standalone WebUI application can run automatically as a systemd service.
|
||||
|
||||
Before doing this, ensure that the standalone application runs OK
|
||||
when run from the command line, and that it is *not* configured to
|
||||
be run as part of an existing web service, e.g. Apache.
|
||||
|
||||
Systemd configuration script
|
||||
----------------------------
|
||||
A sample systemd configuration script for the WebUI application is
|
||||
in examples/recoll-webui.service. This assumes the following configuration:
|
||||
|
||||
- The WebUI application runs as user 'recoll', with the WebUI source located
|
||||
in /home/recoll/recoll-webui.
|
||||
- The application should listen on the default IP address for the system.
|
||||
- The application uses port 8080.
|
||||
|
||||
If any of these are different for your installation, change the
|
||||
configuration script accordingly.
|
||||
|
||||
Installing the configuration script
|
||||
-----------------------------------
|
||||
The configuration script must be copied to the systemd directory
|
||||
and given the correct ownership/access . This can be done using:
|
||||
|
||||
$ sudo cp examples/recoll-webui /etc/systemd/system/recoll-webui
|
||||
$ sudo chown root /etc/systemd/system/recoll-webui
|
||||
$ sudo chmod 644 /etc/systemd/system/recoll-webui
|
||||
|
||||
Starting the WebUI service
|
||||
--------------------------
|
||||
To start the WebUI service do:
|
||||
|
||||
$ sudo systemctl start recoll-webui
|
||||
|
||||
This does a one-time start of the service. If you want to automatically start the
|
||||
service at boot, also do:
|
||||
|
||||
$ sudo systemctl enable recoll-webui
|
||||
|
||||
Checking the status of the WebUI service
|
||||
----------------------------------------
|
||||
Check the status of the WebUI service with:
|
||||
|
||||
$ sudo systemctl status recoll-webui
|
||||
|
||||
If it is running you should see output similar to this:
|
||||
|
||||
recoll-webui.service - Recoll Search WebUI
|
||||
Loaded: loaded (/etc/systemd/system/recoll-webui.service; enabled; vendor preset: disabled)
|
||||
Active: active (running) since Fri 2016-10-07 08:46:00 EDT; 1 day 12h ago
|
||||
Process: 16278 ExecStop=/bin/kill -SIGINT $MAINPID (code=exited, status=0/SUCCESS)
|
||||
Main PID: 16281 (python)
|
||||
CGroup: /system.slice/recoll-webui.service
|
||||
└─16281 python /home/recoll/recoll-webui/webui-standalone.py -a myhost -p 8080
|
||||
|
||||
This shows the status of the standalone application, along with the command line that
|
||||
was used.
|
||||
|
||||
Stopping the WebUI service
|
||||
--------------------------
|
||||
To stop the WebUI service do:
|
||||
|
||||
$ sudo systemctl stop recoll-webui
|
||||
|
||||
To disable the service so it does not run at boot time do:
|
||||
|
||||
$ sudo systemctl disable recoll-webui
|
||||
|
||||
Restarting the WebUI service
|
||||
----------------------------
|
||||
The WebUI configuration script is set to automatically restart the
|
||||
standalone application if it fails. You can also manually restart it using:
|
||||
|
||||
$ sudo systemctl restart recoll-webui
|
||||
35
examples/recoll-webui.service
Normal file
35
examples/recoll-webui.service
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# SystemD script for running the standalong server as a daemon
|
||||
# Place this in /etc/systemd/system/recoll-webui.servivce
|
||||
# owned by root, mode 0644
|
||||
|
||||
# This assumes the Recoll Web-UI is installed under
|
||||
# the path /home/recoll/recoll-webui, and runs against port 8080.
|
||||
# Change these below as needed.
|
||||
#
|
||||
[Unit]
|
||||
Description=Recoll Search WebUI
|
||||
|
||||
After=network.target
|
||||
|
||||
RequiresMountsFor=/home/recoll
|
||||
|
||||
[Service]
|
||||
# Standalone server runs as the main job, default
|
||||
Type=simple
|
||||
|
||||
# Run under user recoll
|
||||
User=recoll
|
||||
|
||||
# Set listen port and address as needed.
|
||||
# %H is the current host name
|
||||
ExecStart=/home/recoll/recoll-webui/webui-standalone.py \
|
||||
-a %H \
|
||||
-p 8080
|
||||
|
||||
ExecStop=/bin/kill -SIGINT $MAINPID
|
||||
KillMode=process
|
||||
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Loading…
Add table
Add a link
Reference in a new issue