-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add systemd unit file and README.systemd explanation
Merged from koniu/recoll-webui#55 Add a sample systemd script in examples and a README describing how to integrate the standalone WebUI app with systemd. Author: Rob Fair <[email protected]>
- Loading branch information
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |