5c467495c6
patroni@.service. * debian/patroni.install: Install it.
108 lines
3.1 KiB
Diff
108 lines
3.1 KiB
Diff
Index: patroni/extras/startup-scripts/patroni
|
|
===================================================================
|
|
--- patroni.orig/extras/startup-scripts/patroni
|
|
+++ patroni/extras/startup-scripts/patroni
|
|
@@ -18,7 +18,7 @@ USER="postgres"
|
|
GROUP="postgres"
|
|
|
|
NAME=patroni
|
|
-PATRONI="/opt/patroni/$NAME.py"
|
|
+PATRONI="/usr/bin/$NAME"
|
|
PIDFILE="/var/run/$NAME.pid"
|
|
|
|
# Set this parameter, if you have several Postgres versions installed
|
|
@@ -114,6 +114,12 @@ case "$1" in
|
|
kill -HUP $CHILDPID
|
|
;;
|
|
|
|
+ force-reload)
|
|
+ log_success_msg "Rorce-reloading Patroni configuration"
|
|
+ get_pid
|
|
+ kill -HUP $CHILDPID
|
|
+ ;;
|
|
+
|
|
status)
|
|
get_pid
|
|
if start-stop-daemon -T --pid $CHILDPID; then
|
|
@@ -130,7 +136,7 @@ case "$1" in
|
|
;;
|
|
|
|
*)
|
|
- echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|status}"
|
|
+ echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload|status}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
Index: patroni/extras/startup-scripts/patroni.service
|
|
===================================================================
|
|
--- patroni.orig/extras/startup-scripts/patroni.service
|
|
+++ patroni/extras/startup-scripts/patroni.service
|
|
@@ -1,9 +1,7 @@
|
|
-# 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
|
|
+After=network.target
|
|
+ConditionPathExists=/etc/patroni/config.yml
|
|
|
|
[Service]
|
|
Type=simple
|
|
@@ -16,11 +14,7 @@ EnvironmentFile=-/etc/patroni_env.conf
|
|
|
|
WorkingDirectory=~
|
|
|
|
-# 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
|
|
+ExecStart=/usr/bin/patroni /etc/patroni/config.yml
|
|
|
|
# Send HUP to reload from patroni.yml
|
|
ExecReload=/bin/kill -s HUP $MAINPID
|
|
--- /dev/null 2018-10-10 13:20:47.405927503 +0200
|
|
+++ ./extras/startup-scripts/patroni@.service 2018-10-22 18:30:47.699456103 +0200
|
|
@@ -0,0 +1,40 @@
|
|
+# systemd service template for patroni instances. The actual instances will
|
|
+# be called "patroni@version-cluster", e.g. "patroni@10-main". The
|
|
+# variable %i expands to "version-cluster", %I expands to "version/cluster".
|
|
+# (%I breaks for cluster names containing dashes.)
|
|
+[Unit]
|
|
+Description=Patroni instance %i
|
|
+After=network.target
|
|
+ConditionPathExists=/etc/patroni/%i.yml
|
|
+
|
|
+[Service]
|
|
+Type=simple
|
|
+
|
|
+User=postgres
|
|
+Group=postgres
|
|
+
|
|
+# Read in configuration file if it exists, otherwise proceed
|
|
+EnvironmentFile=-/etc/patroni_env.conf
|
|
+
|
|
+WorkingDirectory=~
|
|
+
|
|
+ExecStart=/usr/bin/patroni /etc/patroni/%i.yml
|
|
+
|
|
+# Send HUP to reload from patroni.yml
|
|
+ExecReload=/bin/kill -s HUP $MAINPID
|
|
+
|
|
+# only kill the patroni process, not it's children, so it will gracefully stop postgres
|
|
+KillMode=process
|
|
+
|
|
+# Give a reasonable amount of time for the server to start up/shut down
|
|
+TimeoutSec=30
|
|
+
|
|
+# Do not restart the service if it crashes, we want to manually inspect database on failure
|
|
+Restart=no
|
|
+
|
|
+# Uncomment in order to get debugging output
|
|
+#Environment=PATRONI_LOGLEVEL=DEBUG
|
|
+
|
|
+[Install]
|
|
+WantedBy=multi-user.target
|
|
+
|