Add sample systemd service file
authorKarl O. Pinc <kop@karlpinc.com>
Sat, 14 Dec 2019 07:16:49 +0000 (01:16 -0600)
committerKarl O. Pinc <kop@karlpinc.com>
Sat, 28 Dec 2019 21:25:52 +0000 (15:25 -0600)
MANIFEST.in
README.rst
examples/etc/systemd/system/pgwui_server.service [new file with mode: 0644]

index f630619165ee28baf6f5e59376e87638c7acd673..74fefd2237504fcb2c8f4a6cb9e760cf1af74f64 100644 (file)
@@ -4,6 +4,9 @@ include *.mk
 include .coveragerc
 # List all the examples, so we don't accidently include editor backups
 include examples/etc
+include examples/etc/systemd
+include examples/etc/systemd/system
+include examples/etc/systemd/system/pgwui_server.service
 include examples/etc/nginx
 include examples/etc/nginx/sites-available
 include examples/etc/nginx/sites-available/mysite
index 2d5cfa7f4f47a349faee3406e456b7a488b7e7b5..fd8ef982138c5869838bcf8b800db8c50d2ad9f0 100644 (file)
@@ -103,7 +103,9 @@ The installation can then be accessed via URLs similar to::
 
   http://localhost:6543/logout
 
-Automating startup at boot time is OS dependent.
+Automating startup at boot time is OS dependent.  An example systemd
+configuration is provided with PGWUI_Server.
+
 
 Troubleshooting
 ^^^^^^^^^^^^^^^
diff --git a/examples/etc/systemd/system/pgwui_server.service b/examples/etc/systemd/system/pgwui_server.service
new file mode 100644 (file)
index 0000000..e4b05d2
--- /dev/null
@@ -0,0 +1,29 @@
+# This example is for Nginx.
+#
+# WantedBy
+
+# Change to the service name for the webserver/reverse proxy of your
+# choice.  This will ensure PGWUI_Server is started when the webserver
+# starts.
+#
+# WantedBy works fine when the webserver/reverse proxy communicates
+# over a network socket.  When the communication is via a Unix socket
+# Requires and Before or After may be needed.  Their use can avoid
+# race conditions and ensure that the Unix socket is created before
+# the opposite end tries to open it.
+#
+# ExecStart
+# Change the paths depending on the location of the Python virtual
+# environment in which PGWUI_Server is installed.
+
+[Unit]
+Description=PGWUI_Server web server
+
+[Service]
+Type=simple
+User=www-data
+ExecStart=/usr/local/lib/pgwui/venv/bin/python -W 'ignore:The psycopg2 wheel package will be renamed from release 2.8::psycopg2' /usr/local/lib/pgwui/venv/bin/pserve /etc/pgwui.ini
+
+[Install]
+WantedBy=nginx.service
+