Merge pull request #55 from pgexperts/scripts/init-scripts

Added Upstart job for running patroni under Ubuntu 14.04 or 12.04.
This commit is contained in:
Alexander Kukushkin
2015-09-30 16:39:07 +02:00
2 changed files with 46 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
# startup scripts for Patroni
This directory contains sample startup scripts for various OSes
and management tools for Patroni.
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.
@@ -0,0 +1,36 @@
# patroni - patroni daemon
#
# controls startup/shutdown of postgres
# you should disable any postgres start jobs
#
# assumes that patroni has been installed into the
# pythonpath by using setup.py install
description "patroni start daemon"
start on net-device-up
stop on runlevel [06]
respawn
respawn limit 5 10
# set location of patroni
env PATRONI=/usr/local/bin/patroni
# virtualenv example
# env PATRONI=/var/lib/postgresql/patronienv/bin/patroni
# set location of config file
env PATRONICONF=/etc/patroni/patroni.yml
# set log dir for patroni logs
# postgres user must have write permission
env POSTGRESLOGDIR=/var/log/postgresql
setuid postgres
setgid postgres
script
exec start-stop-daemon --start \
--exec $PATRONI -- $PATRONICONF \
>> $POSTGRESLOGDIR/patroni.log 2>&1
end script