Initial import of patroni packaging version 1.3.4-1

This commit is contained in:
Michael Banck 2017-09-14 14:55:13 +02:00
commit 1d683abdb2
18 changed files with 421 additions and 0 deletions

6
debian/changelog vendored Normal file
View file

@ -0,0 +1,6 @@
patroni (1.3.4-1) UNRELEASED; urgency=medium
* Team upload.
* Initial release. (Closes: #875493)
-- Michael Banck <michael.banck@credativ.de> Thu, 14 Sep 2017 14:53:51 +0200

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
9

90
debian/config.yml vendored Normal file
View file

@ -0,0 +1,90 @@
scope: batman
#namespace: /service/
name: postgresql0
restapi:
listen: 127.0.0.1:8008
connect_address: 127.0.0.1:8008
# certfile: /etc/ssl/certs/ssl-cert-snakeoil.pem
# keyfile: /etc/ssl/private/ssl-cert-snakeoil.key
# authentication:
# username: username
# password: password
etcd:
host: 127.0.0.1:2379
bootstrap:
# this section will be written into Etcd:/<namespace>/<scope>/config after initializing new cluster
# and all other cluster members will use it as a `global configuration`
dcs:
ttl: 30
loop_wait: 10
retry_timeout: 10
maximum_lag_on_failover: 1048576
# master_start_timeout: 300
# synchronous_mode: false
postgresql:
use_pg_rewind: true
# use_slots: true
parameters:
# wal_level: hot_standby
# hot_standby: "on"
# wal_keep_segments: 8
# max_wal_senders: 5
# max_replication_slots: 5
# wal_log_hints: "on"
# archive_mode: "on"
# archive_timeout: 1800s
# archive_command: mkdir -p ../wal_archive && test ! -f ../wal_archive/%f && cp %p ../wal_archive/%f
# recovery_conf:
# restore_command: cp ../wal_archive/%f %p
# some desired options for 'initdb'
initdb: # Note: It needs to be a list (some options need values, others are switches)
- encoding: UTF8
- data-checksums
pg_hba: # Add following lines to pg_hba.conf after running 'initdb'
- host replication replicator 127.0.0.1/32 md5
- host all all 0.0.0.0/0 md5
# - hostssl all all 0.0.0.0/0 md5
# Additional script to be launched after initial cluster creation (will be passed the connection URL as parameter)
# post_init: /usr/local/bin/setup_cluster.sh
# # Some additional users users which needs to be created after initializing new cluster
# users:
# admin:
# password: admin
# options:
# - createrole
# - createdb
postgresql:
listen: 127.0.0.1:5432
connect_address: 127.0.0.1:5432
# data_dir: /var/lib/postgresql/9.6/main
# bin_dir: /usr/lib/postgresql/9.6/bin
# config_dir: /etc/postgresql/9.6/main
pgpass: /etc/patroni/pgpass
authentication:
replication:
username: replicator
password: rep-pass
# superuser:
# username: postgres
# password: zalando
parameters:
unix_socket_directories: '/var/run/postgresql'
#watchdog:
# mode: automatic # Allowed values: off, automatic, required
# device: /dev/watchdog
# safety_margin: 5
tags:
nofailover: false
noloadbalance: false
clonefrom: false
nosync: false

53
debian/control vendored Normal file
View file

@ -0,0 +1,53 @@
Source: patroni
Section: database
Priority: optional
Maintainer: Debian PostgreSQL Maintainers <pkg-postgresql-public@lists.alioth.debian.org>
Uploaders: Michael Banck <michael.banck@credativ.de>,
Adrian.Vondendriesch <adrian.vondendriesch@credativ.de>
Build-Depends:
debhelper (>= 9),
dh-python,
libjs-jquery,
libjs-mathjax,
libjs-underscore,
pyflakes3,
python3,
python3-boto,
python3-cdiff,
python3-click (>= 4.1),
python3-consul (>= 0.7.0),
python3-dateutil,
python3-dnspython,
python3-etcd (>= 0.4.3),
python3-flake8,
python3-kazoo,
python3-mccabe,
python3-mock,
python3-prettytable (>= 0.7),
python3-psutil,
python3-psycopg2 (>= 2.6.1),
python3-pycodestyle,
python3-pytest,
python3-pytest-cov,
python3-setuptools,
python3-sphinx,
python3-sphinx-rtd-theme,
python3-tz,
python3-tzlocal,
python3-yaml,
sphinx-common
Standards-Version: 3.9.8
X-Python3-Version: >= 3.5
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-postgresql/patroni.git/
Vcs-Git: https://anonscm.debian.org/git/pkg-postgresql/patroni.git
Homepage: https://github.com/zalando/patroni
Package: patroni
Architecture: all
Depends: ${misc:Depends}, ${python3:Depends}, lsb-base (>= 3.0-6)
Suggests:
Description: Template for PostgreSQL High Availability
Patroni is a template for a customized, high-availability PostgreSQL solution
using Python and a distributed configuration store (ZooKeeper, etcd or
Consul). It provides a REST API on each Postgres node of the cluster allowing
for remote management and monitoring.

29
debian/copyright vendored Normal file
View file

@ -0,0 +1,29 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: patroni
Source: https://github.com/zalando/patroni
Files: *
Copyright: Copyright (c) 2015 Compose, Zalando SE
License: MIT
Files: debian/*
Copyright: Copyright (c) 2017 Michael Banck
License: MIT
License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1
debian/files vendored Normal file
View file

@ -0,0 +1 @@
patroni_1.3.4-1_source.buildinfo database optional

View file

@ -0,0 +1,11 @@
--- ./tests/test_postgresql.py.orig 2017-09-12 13:00:06.189831872 +0200
+++ ./tests/test_postgresql.py 2017-09-12 13:00:28.966391766 +0200
@@ -174,7 +174,7 @@
if not os.path.exists(self.data_dir):
os.makedirs(self.data_dir)
self.p = Postgresql({'name': 'test0', 'scope': 'batman', 'data_dir': self.data_dir,
- 'config_dir': self.config_dir, 'retry_timeout': 10,
+ 'config_dir': self.config_dir, 'retry_timeout': 10, 'pgpass': '/tmp/pgpass0',
'listen': '127.0.0.2, 127.0.0.3:5432', 'connect_address': '127.0.0.2:5432',
'authentication': {'superuser': {'username': 'test', 'password': 'test'},
'replication': {'username': 'replicator', 'password': 'rep-pass'}},

2
debian/patches/series vendored Normal file
View file

@ -0,0 +1,2 @@
pgpass_in_testsuite.patch
sphinx_no_mathjax.patch

11
debian/patches/sphinx_no_mathjax.patch vendored Normal file
View file

@ -0,0 +1,11 @@
--- ./docs/conf.py.orig 2017-09-14 00:41:41.030687903 +0200
+++ ./docs/conf.py 2017-09-14 00:41:48.546688391 +0200
@@ -33,7 +33,7 @@
# ones.
extensions = ['sphinx.ext.intersphinx',
'sphinx.ext.todo',
- 'sphinx.ext.mathjax',
+# 'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode']

11
debian/patches/sphinx_no_theme.patch vendored Normal file
View file

@ -0,0 +1,11 @@
--- ./docs/conf.py.orig 2017-09-14 13:02:16.190226130 +0200
+++ ./docs/conf.py 2017-09-14 13:03:18.494248159 +0200
@@ -81,6 +81,8 @@
# If true, `todo` and `todoList` produce output, else they produce nothing.
todo_include_todos = True
+# mathjax path
+mathjax_path = /usr/share/javascript/mathjax/
# -- Options for HTML output ----------------------------------------------

2
debian/patroni.docs vendored Normal file
View file

@ -0,0 +1,2 @@
docs/build/html
docs/README.rst

3
debian/patroni.examples vendored Normal file
View file

@ -0,0 +1,3 @@
postgres*.yml
docker-compose.yml
haproxy.cfg

150
debian/patroni.init vendored Normal file
View file

@ -0,0 +1,150 @@
#!/bin/sh
#
### BEGIN INIT INFO
# Provides: patroni
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Patroni init script
# Description: Runners to orchestrate a high-availability PostgreSQL
### END INIT INFO
### BEGIN USER CONFIGURATION
CONF="/etc/patroni/postgres.yml"
LOGFILE="/var/log/patroni.log"
USER="postgres"
GROUP="postgres"
NAME=patroni
PATRONI="/usr/bin/$NAME"
PIDFILE="/var/run/$NAME.pid"
# Set this parameter, if you have several Postgres versions installed
# POSTGRES_VERSION="9.4"
POSTGRES_VERSION=""
### END USER CONFIGURATION
. /lib/lsb/init-functions
# Loading this library for get_versions() function
if test ! -e /usr/share/postgresql-common/init.d-functions; then
log_failure_msg "Probably postgresql-common does not installed."
exit 1
else
. /usr/share/postgresql-common/init.d-functions
fi
# Is there Patroni executable?
if test ! -e $PATRONI; then
log_failure_msg "Patroni executable $PATRONI does not exist."
exit 1
fi
# Is there Patroni configuration file?
if test ! -e $CONF; then
log_failure_msg "Patroni configuration file $CONF does not exist."
exit 1
fi
# Create logfile if doesn't exist
if test ! -e $LOGFILE; then
log_action_msg "Creating logfile for Patroni..."
touch $LOGFILE
chown $USER:$GROUP $LOGFILE
fi
prepare_pgpath() {
if [ "$POSTGRES_VERSION" != "" ]; then
if [ -x /usr/lib/postgresql/$POSTGRES_VERSION/bin/pg_ctl ]; then
PGPATH="/usr/lib/postgresql/$POSTGRES_VERSION/bin"
else
log_failure_msg "Postgres version incorrect, check POSTGRES_VERSION variable."
exit 0
fi
else
get_versions
if echo $versions | grep -q -e "\s"; then
log_warning_msg "You have several Postgres versions installed. Please, use POSTGRES_VERSION to define correct environment."
else
versions=`echo $versions | sed -e 's/^[ \t]*//'`
PGPATH="/usr/lib/postgresql/$versions/bin"
fi
fi
}
get_pid() {
if test -e $PIDFILE; then
PID=`cat $PIDFILE`
CHILDPID=`ps --ppid $PID -o %p --no-headers`
else
log_failure_msg "Could not find PID file. Patroni probably down."
exit 1
fi
}
case "$1" in
start)
prepare_pgpath
PGPATH=$PATH:$PGPATH
log_success_msg "Starting Patroni\n"
exec start-stop-daemon --start --quiet \
--background \
--pidfile $PIDFILE --make-pidfile \
--chuid $USER:$GROUP \
--chdir `eval echo ~$USER` \
--exec $PATRONI \
--startas /bin/sh -- \
-c "/usr/bin/env PATH=$PGPATH /usr/bin/python $PATRONI $CONF >> $LOGFILE 2>&1"
;;
stop)
log_success_msg "Stopping Patroni"
get_pid
start-stop-daemon --stop --pid $CHILDPID
start-stop-daemon --stop --pidfile $PIDFILE --remove-pidfile --quiet
;;
reload)
log_success_msg "Reloading Patroni configuration"
get_pid
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
log_success_msg "Patroni is running\n"
exit 0
else
log_warning_msg "Patroni in not running\n"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|restart|reload|force-reload|status}"
exit 1
;;
esac
if [ $? -eq 0 ]; then
echo .
exit 0
else
echo " failed"
exit 1
fi

1
debian/patroni.install vendored Normal file
View file

@ -0,0 +1 @@
debian/patroni.service lib/systemd/system

24
debian/patroni.service vendored Normal file
View file

@ -0,0 +1,24 @@
[Unit]
Description=Runners to orchestrate a high-availability PostgreSQL
After=network.target
[Service]
Type=simple
User=postgres
Group=postgres
ExecStart=/usr/bin/patroni /etc/patroni/config.yml
# 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
[Install]
WantedBy=multi-user.target

23
debian/rules vendored Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/make -f
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export READTHEDOCS=no
%:
dh $@ --with=python3 --buildsystem=pybuild
override_dh_auto_clean:
-dh_auto_clean
rm -rf .eggs .pybuild
override_dh_auto_build:
dh_auto_build
(cd docs; $(MAKE) html)
override_dh_installdocs:
dh_installdocs
dh_sphinxdoc /usr/share/doc/patroni/html
override_dh_auto_test:
python3 setup.py test

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (quilt)

2
debian/watch vendored Normal file
View file

@ -0,0 +1,2 @@
version=3
https://github.com/zalando/patroni/releases .*/archive/(.*).tar.gz