From 0cc7edb2637cd56e676442cc95bbb288cd254f7e Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Sat, 14 Dec 2019 01:16:49 -0600 Subject: [PATCH] Add sample systemd service file --- MANIFEST.in | 3 ++ README.rst | 4 ++- .../etc/systemd/system/pgwui_server.service | 29 +++++++++++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 examples/etc/systemd/system/pgwui_server.service diff --git a/MANIFEST.in b/MANIFEST.in index f630619..74fefd2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -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 diff --git a/README.rst b/README.rst index 2d5cfa7..fd8ef98 100644 --- a/README.rst +++ b/README.rst @@ -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 index 0000000..e4b05d2 --- /dev/null +++ b/examples/etc/systemd/system/pgwui_server.service @@ -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 + -- 2.34.1