From b56d50439f5e0d9621667a9495288711790ded93 Mon Sep 17 00:00:00 2001 From: Vitaliy Kukharik <37010174+vitabaks@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:23:46 +0300 Subject: [PATCH] restart patroni service if it crashed https://github.com/zalando/patroni/pull/2372 --- roles/patroni/templates/patroni.service.j2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/roles/patroni/templates/patroni.service.j2 b/roles/patroni/templates/patroni.service.j2 index 5f6e1377b..b3d2ac45a 100644 --- a/roles/patroni/templates/patroni.service.j2 +++ b/roles/patroni/templates/patroni.service.j2 @@ -1,5 +1,5 @@ [Unit] -Description=Runners to orchestrate a high-availability PostgreSQL - patroni +Description=Runners to orchestrate a high-availability PostgreSQL - Patroni After=syslog.target network.target [Service] @@ -11,6 +11,7 @@ Group=postgres # Read in configuration file if it exists, otherwise proceed EnvironmentFile=-/etc/patroni_env.conf +# The default is the user's home directory, and if you want to change it, you must provide an absolute path. # WorkingDirectory=~ # Where to send early-startup messages from the server @@ -32,14 +33,14 @@ ExecStart=/usr/bin/patroni /etc/patroni/patroni.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 +# 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=60 -# Do not restart the service if it crashes, we want to manually inspect database on failure -Restart=no +# Restart the service if it crashed +Restart=on-failure [Install] WantedBy=multi-user.target