68 lines
1.9 KiB
Plaintext
68 lines
1.9 KiB
Plaintext
# It's not recommended to modify this file in-place, because it will be
|
|
# overwritten during package upgrades. It is recommended to use systemd
|
|
# "dropin" feature; i.e. create file with suffix .conf under
|
|
# /etc/systemd/system/patroni.service.d directory overriding the
|
|
# unit's defaults. You can also use "systemctl edit patroni"
|
|
# Look at systemd.unit(5) manual page for more info.
|
|
|
|
[Unit]
|
|
Description=Runners to orchestrate a high-availability PostgreSQL
|
|
After=syslog.target network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
|
|
User={{ pg_dbsu }}
|
|
Group=postgres
|
|
|
|
# Runtime Directory
|
|
RuntimeDirectory=postgresql
|
|
RuntimeDirectoryMode=0755
|
|
RuntimeDirectoryPreserve=yes
|
|
|
|
# Read in configuration file if it exists, otherwise proceed
|
|
EnvironmentFile=-/etc/patroni_env.conf
|
|
|
|
WorkingDirectory={{ pg_dbsu_home }}
|
|
|
|
# send patroni log to journald
|
|
StandardOutput=journal
|
|
StandardError=journal
|
|
SyslogIdentifier=patroni
|
|
|
|
# Pre-commands to start watchdog device
|
|
# Uncomment if watchdog is part of your patroni setup
|
|
{% if patroni_watchdog_mode == 'required' %}
|
|
ExecStartPre=-/usr/bin/sudo /sbin/modprobe softdog
|
|
ExecStartPre=-/usr/bin/sudo /bin/chown {{ pg_dbsu }} /dev/watchdog
|
|
{% else %}
|
|
#ExecStartPre=-/usr/bin/sudo /sbin/modprobe softdog
|
|
#ExecStartPre=-/usr/bin/sudo /bin/chown {{ pg_dbsu }} /dev/watchdog
|
|
{% endif %}
|
|
|
|
|
|
# Start the patroni process
|
|
ExecStart=/usr/bin/patroni /etc/patroni/patroni.yml
|
|
|
|
# Send HUP to reload from patroni.yml
|
|
ExecReload=/usr/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
|
|
|
|
TimeoutStopSec=120
|
|
LimitNOFILE=16777216
|
|
LimitNPROC=infinity
|
|
LimitCORE=infinity
|
|
|
|
# DO NOT OOM KILL PATRONI
|
|
OOMScoreAdjust=-1000
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target |