LP#1912796: include systemd installation instructions in OpenSRF installation docs. user/stompro/lp1912796_websocketd_systemd_service_installation-signoff
authorChris Sharp <csharp@georgialibraries.org>
Fri, 22 Jan 2021 15:23:51 +0000 (10:23 -0500)
committerJosh Stompro <stompro@stompro.org>
Thu, 15 Sep 2022 13:09:36 +0000 (08:09 -0500)
Create an example systemd unit file that can be copied into place
and update the README with those instructions.

Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Signed-off-by: Josh Stompro <stompro@stompro.org>
README
examples/websocketd-osrf.service.example [new file with mode: 0644]

diff --git a/README b/README
index 73eea14..a1af0ef 100644 (file)
--- a/README
+++ b/README
@@ -493,6 +493,22 @@ sudo -b /usr/local/bin/websocketd --port 7682 --ssl --sslcert=/etc/apache2/ssl/s
      --sslkey=/etc/apache2/ssl/server.key /openils/bin/osrf-websocket-stdio
 ---------------------------------------------------------------------------
 
+Optional Systemd Setup
+~~~~~~~~~~~~~~~~~~~~~~
+
+Websocketd is a standalone program with no daemon mode, but can be implemented as a systemd service.
+
+Copy <PREFIX>/examples/websocket-osrf.service.example into file /lib/systemd/system/websocketd-osrf.service
+
+Then add & start the service.
+
+[source,bash]
+--------------------------------------
+sudo systemctl daemon-reload
+sudo systemctl enable websocketd-osrf
+sudo systemctl start websocketd-osrf
+--------------------------------------
+
 Optional: Using a web proxy (Apache 2.4 and above)
 --------------------------------------------------
 When the OpenSRF HTTP Translator runs behind a proxy, Apache must be 
diff --git a/examples/websocketd-osrf.service.example b/examples/websocketd-osrf.service.example
new file mode 100644 (file)
index 0000000..18ce640
--- /dev/null
@@ -0,0 +1,17 @@
+[Unit]
+Description=Websocketd OpenSRF Gateway
+
+[Service]
+Type=simple
+User=opensrf
+Group=opensrf
+Environment=PATH=/openils/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+Environment=LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
+ExecStart=/usr/local/bin/websocketd --loglevel error --maxforks 250 --port 7682 /openils/bin/osrf-websocket-stdio
+
+# modify websocketd command line options to taste
+# --sameorigin and --origin=domain1,domain2 flags are also supported for security.
+
+# On Ubuntu 18.04+, you may also need to include something like this:
+[Install]
+WantedBy=multi-user.target