All of lore.kernel.org
 help / color / mirror / Atom feed
From: Babanpreet Singh <bbnpreetsingh@gmail.com>
To: openembedded-devel@lists.openembedded.org
Cc: Khem Raj <raj.khem@gmail.com>,
	Babanpreet Singh <bbnpreetsingh@gmail.com>
Subject: [meta-networking][PATCH v2] pgbouncer: add recipe
Date: Wed,  2 Dec 2026 06:00:18 +0000	[thread overview]
Message-ID: <20261202060018.7-1-bbnpreetsingh@gmail.com> (raw)

PgBouncer is a lightweight connection pooler for PostgreSQL.

AI-Generated: Uses Claude (claude-opus-5-5)
Signed-off-by: Babanpreet Singh <bbnpreetsingh@gmail.com>
---
 .../pgbouncer/pgbouncer/pgbouncer.init        | 56 +++++++++++++++++++
 .../pgbouncer/pgbouncer/pgbouncer.service     | 18 ++++++
 .../pgbouncer/pgbouncer_1.26.1.bb             | 56 +++++++++++++++++++
 3 files changed, 130 insertions(+)
 create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.init
 create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.service
 create mode 100644 meta-networking/recipes-support/pgbouncer/pgbouncer_1.26.1.bb

diff --git a/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.init b/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.init
new file mode 100644
index 0000000000..5a153cd97b
--- /dev/null
+++ b/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.init
@@ -0,0 +1,56 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides:          pgbouncer
+# Required-Start:    $local_fs $remote_fs $network
+# Required-Stop:     $local_fs $remote_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Connection pooler for PostgreSQL
+### END INIT INFO
+
+DAEMON=/usr/bin/pgbouncer
+CONF=/etc/pgbouncer/pgbouncer.ini
+PIDFILE=/var/run/pgbouncer/pgbouncer.pid
+
+test -x $DAEMON || exit 0
+test -f $CONF || exit 0
+
+stop() {
+	start-stop-daemon -K -q -p $PIDFILE -x $DAEMON -s INT
+	for i in 1 2 3 4 5 6 7 8 9 10; do
+		[ -f $PIDFILE ] && kill -0 "$(cat $PIDFILE)" 2>/dev/null || return 0
+		sleep 1
+	done
+}
+
+case "$1" in
+start)
+	echo -n "Starting pgbouncer: "
+	mkdir -p /var/run/pgbouncer /var/log/pgbouncer
+	chown pgbouncer:pgbouncer /var/run/pgbouncer /var/log/pgbouncer
+	if start-stop-daemon -S -q -p $PIDFILE -c pgbouncer -x $DAEMON -- -d $CONF; then
+		echo "done"
+	else
+		echo "failed"
+		exit 1
+	fi
+	;;
+stop)
+	echo -n "Stopping pgbouncer: "
+	stop
+	echo "done"
+	;;
+reload)
+	start-stop-daemon -K -q -p $PIDFILE -x $DAEMON -s HUP
+	;;
+restart)
+	$0 stop
+	$0 start
+	;;
+*)
+	echo "Usage: $0 {start|stop|reload|restart}"
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.service b/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.service
new file mode 100644
index 0000000000..212b02d7a6
--- /dev/null
+++ b/meta-networking/recipes-support/pgbouncer/pgbouncer/pgbouncer.service
@@ -0,0 +1,18 @@
+[Unit]
+Description=Connection pooler for PostgreSQL
+Documentation=https://www.pgbouncer.org/
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+Type=notify
+User=pgbouncer
+RuntimeDirectory=pgbouncer
+LogsDirectory=pgbouncer
+ExecStart=/usr/bin/pgbouncer /etc/pgbouncer/pgbouncer.ini
+ExecReload=/bin/kill -HUP $MAINPID
+KillSignal=SIGINT
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/meta-networking/recipes-support/pgbouncer/pgbouncer_1.26.1.bb b/meta-networking/recipes-support/pgbouncer/pgbouncer_1.26.1.bb
new file mode 100644
index 0000000000..f4eaca0f44
--- /dev/null
+++ b/meta-networking/recipes-support/pgbouncer/pgbouncer_1.26.1.bb
@@ -0,0 +1,56 @@
+SUMMARY = "Lightweight connection pooler for PostgreSQL"
+HOMEPAGE = "https://www.pgbouncer.org/"
+BUGTRACKER = "https://github.com/pgbouncer/pgbouncer/issues"
+LICENSE = "BSD-1-Clause AND BSD-3-Clause AND ISC AND PostgreSQL"
+LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=d5f4369a96e12a98e8695033381d6c28 \
+                    file://src/common/base64.c;beginline=6;endline=6;md5=e3aa2c2a657829cd2a61898e8fdde49b \
+                    file://src/common/sha2.c;beginline=23;endline=48;md5=f924a973f231ccd44fa85d7938a71ece \
+                    file://include/common/uthash.h;beginline=1;endline=21;md5=894975335149e863524c4d27839e8cfa \
+                    "
+
+SRC_URI = "https://www.pgbouncer.org/downloads/files/${PV}/${BP}.tar.gz \
+           file://pgbouncer.init \
+           file://pgbouncer.service \
+           "
+SRC_URI[sha256sum] = "00886a2994b4844cd37110970df777772cfc42a74c400522c82fba509a3f42d9"
+
+UPSTREAM_CHECK_URI = "https://www.pgbouncer.org/downloads/"
+UPSTREAM_CHECK_REGEX = "pgbouncer-(?P<pver>\d+(\.\d+)+)\.tar\.gz"
+
+DEPENDS = "libevent"
+
+inherit autotools-brokensep pkgconfig systemd update-rc.d useradd
+
+CLEANBROKEN = "1"
+
+EXTRA_AUTORECONF += "-I ${S}/lib/m4"
+
+PACKAGECONFIG ??= "openssl cares ${@bb.utils.filter('DISTRO_FEATURES', 'pam systemd', d)}"
+PACKAGECONFIG[openssl] = "--with-openssl --with-root-ca-file=${sysconfdir}/ssl/certs/ca-certificates.crt,--without-openssl,openssl,,ca-certificates"
+PACKAGECONFIG[cares] = "--with-cares,--without-cares,c-ares"
+PACKAGECONFIG[pam] = "--with-pam,--without-pam,libpam"
+PACKAGECONFIG[ldap] = "--with-ldap,--without-ldap,openldap"
+PACKAGECONFIG[systemd] = "--with-systemd,--without-systemd,systemd"
+
+EXTRA_OEMAKE += "dist_man_MANS="
+
+do_install:append() {
+    install -d ${D}${sysconfdir}/pgbouncer
+    install -m 0640 -g pgbouncer ${S}/etc/pgbouncer.ini ${D}${sysconfdir}/pgbouncer/
+    install -m 0640 -g pgbouncer /dev/null ${D}${sysconfdir}/pgbouncer/userlist.txt
+    install -D -m 0755 ${UNPACKDIR}/pgbouncer.init ${D}${sysconfdir}/init.d/pgbouncer
+    install -D -m 0644 ${UNPACKDIR}/pgbouncer.service ${D}${systemd_system_unitdir}/pgbouncer.service
+}
+
+USERADD_PACKAGES = "${PN}"
+USERADD_PARAM:${PN} = "--system --home-dir /nonexistent --no-create-home --shell /sbin/nologin --user-group pgbouncer"
+
+INITSCRIPT_NAME = "pgbouncer"
+INITSCRIPT_PARAMS = "start 65 . stop 35 0 1 2 3 4 5 6 ."
+
+SYSTEMD_SERVICE:${PN} = "pgbouncer.service"
+SYSTEMD_AUTO_ENABLE:${PN} = "disable"
+
+CONFFILES:${PN} = "${sysconfdir}/pgbouncer/pgbouncer.ini \
+                   ${sysconfdir}/pgbouncer/userlist.txt \
+                   "
-- 
2.43.0


                 reply	other threads:[~2026-12-02  6:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202060018.7-1-bbnpreetsingh@gmail.com \
    --to=bbnpreetsingh@gmail.com \
    --cc=openembedded-devel@lists.openembedded.org \
    --cc=raj.khem@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.