summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-db/pgbouncer/files
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-db/pgbouncer/files')
-rw-r--r--dev-db/pgbouncer/files/logrotate7
-rw-r--r--dev-db/pgbouncer/files/pgbouncer-dirs.patch26
-rw-r--r--dev-db/pgbouncer/files/pgbouncer.confd12
-rw-r--r--dev-db/pgbouncer/files/pgbouncer.initd88
4 files changed, 133 insertions, 0 deletions
diff --git a/dev-db/pgbouncer/files/logrotate b/dev-db/pgbouncer/files/logrotate
new file mode 100644
index 000000000000..9617eafa66b0
--- /dev/null
+++ b/dev-db/pgbouncer/files/logrotate
@@ -0,0 +1,7 @@
+/var/log/pgbouncer/pgbouncer.log {
+ missingok
+ sharedscripts
+ postrotate
+ /etc/init.d/pgbouncer -q reload
+ endscript
+} \ No newline at end of file
diff --git a/dev-db/pgbouncer/files/pgbouncer-dirs.patch b/dev-db/pgbouncer/files/pgbouncer-dirs.patch
new file mode 100644
index 000000000000..62bcd0b84409
--- /dev/null
+++ b/dev-db/pgbouncer/files/pgbouncer-dirs.patch
@@ -0,0 +1,26 @@
+diff -Naruw a/etc/pgbouncer.ini b/etc/pgbouncer.ini
+--- a/etc/pgbouncer.ini 2012-06-10 19:57:01.000000000 +0000
++++ b/etc/pgbouncer.ini 2013-07-17 02:25:59.598888628 +0000
+@@ -29,7 +29,7 @@
+ ;;;
+
+ logfile = /var/log/pgbouncer/pgbouncer.log
+-pidfile = /var/run/pgbouncer/pgbouncer.pid
++pidfile = /run/pgbouncer/pgbouncer.pid
+
+ ;;;
+ ;;; Where to wait for clients
+@@ -40,10 +40,9 @@
+ listen_port = 6432
+
+ ; unix socket is also used for -R.
+-; On debian it should be /var/run/postgresql
+-;unix_socket_dir = /tmp
+-;unix_socket_mode = 0777
+-;unix_socket_group =
++unix_socket_dir = /run/postgresql
++unix_socket_mode = 0777
++unix_socket_group = postgres
+
+ ;;;
+ ;;; Authentication settings
diff --git a/dev-db/pgbouncer/files/pgbouncer.confd b/dev-db/pgbouncer/files/pgbouncer.confd
new file mode 100644
index 000000000000..e2c584011884
--- /dev/null
+++ b/dev-db/pgbouncer/files/pgbouncer.confd
@@ -0,0 +1,12 @@
+# Location of configuration file for PgBouncer.
+INIFILE="/etc/pgbouncer.ini"
+
+# How long to wait in seconds for a safe shutdown. Equivalent to
+# issuing 'PAUSE;' and 'SHUTDOWN;' on psql console. (See 'man 1 pgbouncer'.)
+NICE_TIMEOUT=60
+
+# Set to 'YES' to perform an immediate shutdown if the nice shutdown
+# doesn't work. Same as issuing 'SHUTDOWN;' on console. (See 'man 1
+# pgbouncer'.)
+FORCE_QUIT="no"
+FORCE_QUIT_TIMEOUT=2 \ No newline at end of file
diff --git a/dev-db/pgbouncer/files/pgbouncer.initd b/dev-db/pgbouncer/files/pgbouncer.initd
new file mode 100644
index 000000000000..f97481501aaf
--- /dev/null
+++ b/dev-db/pgbouncer/files/pgbouncer.initd
@@ -0,0 +1,88 @@
+#!/sbin/runscript
+
+extra_started_commands="reload"
+
+depend() {
+ use net
+ after postgresql
+}
+
+get_config() {
+ [ -f "${INIFILE}" ] || eend 1 "'${INIFILE}' not found"
+
+ eval echo $(sed -e 's:;.*::' "${INIFILE}" | \
+ awk '$1 == "'$1'" { print ($2 == "=" ? $3 : $2) }')
+}
+
+PIDFILE="$(get_config pidfile)"
+UNIX_SOCKET_DIR="$(get_config unix_socket_dir)"
+
+prep() {
+ if [ -n "${UNIX_SOCKET_DIR}" ] ; then
+ checkpath -o postgres:postgres -m 0775 -d "${UNIX_SOCKET_DIR}" \
+ || return 1
+ fi
+ checkpath -o pgbouncer:postgres -m 0755 -d "$(dirname ${PIDFILE})" \
+ || return 1
+ checkpath -o pgbouncer:postgres -m 0644 -f "${PIDFILE}" \
+ || return 1
+ checkpath -o pgbouncer:postgres -m 0755 -d "$(dirname $(get_config logfile))" \
+ || return 1
+ checkpath -o pgbouncer:postgres -m 0640 -f "$(get_config logfile)" \
+ || return 1
+
+ return 0
+}
+
+start() {
+ ebegin "Starting PgBouncer"
+ prep
+ local ret=$?
+ if [ $ret -ne 0 ] ; then
+ eend $ret
+ exit $ret
+ fi
+ start-stop-daemon --start \
+ --pidfile ${PIDFILE} \
+ --user pgbouncer \
+ --exec /usr/bin/pgbouncer -- -q -d "${INIFILE}"
+ eend $?
+}
+
+stop() {
+ local seconds=$(( ${NICE_TIMEOUT} + ${FORCE_QUIT_TIMEOUT} ))
+ ebegin "Stopping PgBouncer (this can take up to ${seconds} seconds)"
+
+ local retries=SIGINT/${NICE_TIMEOUT}
+
+ if [ "${FORCE_QUIT}" = "YES" ] ; then
+ einfo "FORCE_QUIT enabled."
+ retries="${retries}/SIGTERM/${FORCE_QUIT_TIMEOUT}"
+ fi
+
+ # Loops through nice and force quit in one go.
+ start-stop-daemon --stop \
+ --pidfile ${PIDFILE} \
+ --retry ${retries}
+
+ eend $?
+}
+
+restart() {
+ if [ -n "${UNIX_SOCKET_DIR}" ] ; then
+ ebegin "Performing online restart of PgBouncer"
+ start-stop-daemon --start \
+ --pidfile ${PIDFILE} \
+ --user pgbouncer \
+ --exec /usr/bin/pgbouncer -- -q -d -R "${INIFILE}"
+ eend $?
+ else
+ stop && start
+ fi
+}
+
+reload() {
+ ebegin "Reloading PgBouncer configuration from '${INIFILE}'"
+ start-stop-daemon --signal HUP --pidfile ${PIDFILE}
+ eend $?
+}