From eb1e6788202b771158d6dc127c3b752239a3dfdd Mon Sep 17 00:00:00 2001 From: Jan Keirse Date: Thu, 18 Feb 2016 11:04:41 +0100 Subject: [PATCH 1/3] sample systemd service file --- extras/startup-scripts/patroni.service | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 extras/startup-scripts/patroni.service diff --git a/extras/startup-scripts/patroni.service b/extras/startup-scripts/patroni.service new file mode 100644 index 00000000..67e7ee14 --- /dev/null +++ b/extras/startup-scripts/patroni.service @@ -0,0 +1,28 @@ +# This is an example systemd config file for Patroni +# You can copy it to "/etc/systemd/system/patroni.service", + +[Unit] +Description=Runners to orchestrate a high-availability PostgreSQL +After=syslog.target network.target + +[Service] +Type=simple + +User=postgres +Group=postgres + +# Where to send early-startup messages from the server +# This is normally controlled by the global default set by systemd +# StandardOutput=syslog + +ExecStart=/bin/patroni /etc/patroni.yml + +# Give a reasonable amount of time for the server to start up/shut down +TimeoutSec=10 + +# Always restart the service if it crashes, we want it to continue running +Restart=no + +[Install] +WantedBy=multi-user.target + From e68e253d166cad71125d86bc7a652ef8ef1c79fc Mon Sep 17 00:00:00 2001 From: Jan Keirse Date: Thu, 18 Feb 2016 11:06:40 +0100 Subject: [PATCH 2/3] Add patroni.service file documentation. --- extras/startup-scripts/README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/startup-scripts/README.md b/extras/startup-scripts/README.md index 244ee65e..7cc0d445 100644 --- a/extras/startup-scripts/README.md +++ b/extras/startup-scripts/README.md @@ -8,3 +8,6 @@ Scripts supplied: ### patroni.upstart.conf Upstart job for Ubuntu 12.04 or 14.04. Requires Upstart > 1.4. Intended for systems where Patroni has been installed on a base system, rather than in Docker. + +### patroni.service +Systemd service file, to be copied to /etc/systemd/system/patroni.service, tested on Centos 7.1 with Patroni installed from pip. From 753ba835f11e771925da3ef7c2b313865bf4fcb0 Mon Sep 17 00:00:00 2001 From: Jan Keirse Date: Thu, 18 Feb 2016 11:08:18 +0100 Subject: [PATCH 3/3] wrong comment about restart --- extras/startup-scripts/patroni.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/startup-scripts/patroni.service b/extras/startup-scripts/patroni.service index 67e7ee14..fdd7558b 100644 --- a/extras/startup-scripts/patroni.service +++ b/extras/startup-scripts/patroni.service @@ -20,7 +20,7 @@ ExecStart=/bin/patroni /etc/patroni.yml # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=10 -# Always restart the service if it crashes, we want it to continue running +# Do not restart the service if it crashes, we want to manually inspect database on failure Restart=no [Install]