git: 6b3966e2907c - main - www/nginx-module-postgres: Add New Port

From: Jochen Neumeister <joneum_at_FreeBSD.org>
Date: Tue, 13 Oct 2026 21:20:59 UTC
The branch main has been updated by joneum:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6b3966e2907c8aac2622d43c051878483859cf80

commit 6b3966e2907c8aac2622d43c051878483859cf80
Author:     Jochen Neumeister <joneum@FreeBSD.org>
AuthorDate: 2026-10-13 21:19:46 +0000
Commit:     Jochen Neumeister <joneum@FreeBSD.org>
CommitDate: 2026-10-13 21:20:46 +0000

    www/nginx-module-postgres: Add New Port
    
    Sources of the postgres module for the NGINX ports.  The module queries
    PostgreSQL from nginx itself, with no application in between, and answers
    with the rows as text, as JSON, or as nothing but a status code.
    
    Sponsored by:   Netzkommune GmbH
---
 www/Makefile                                   |  1 +
 www/nginx-module-postgres/Makefile             | 55 ++++++++++++++++++++++++++
 www/nginx-module-postgres/distinfo             |  3 ++
 www/nginx-module-postgres/files/pkg-message.in | 14 +++++++
 www/nginx-module-postgres/pkg-descr            |  8 ++++
 5 files changed, 81 insertions(+)

diff --git a/www/Makefile b/www/Makefile
index 9f55ee4550f5..cadbb9f3a960 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -545,6 +545,7 @@
     SUBDIR += nginx-module-lua-stream
     SUBDIR += nginx-module-ndk
     SUBDIR += nginx-module-njs
+    SUBDIR += nginx-module-postgres
     SUBDIR += nginx-module-slowfs-cache
     SUBDIR += nginx-module-vod
     SUBDIR += nginx-module-websockify
diff --git a/www/nginx-module-postgres/Makefile b/www/nginx-module-postgres/Makefile
new file mode 100644
index 000000000000..31daebbccb8c
--- /dev/null
+++ b/www/nginx-module-postgres/Makefile
@@ -0,0 +1,55 @@
+PORTNAME=	nginx-module-postgres
+DISTVERSION=	1.0.0
+CATEGORIES=	www
+
+MAINTAINER=	joneum@FreeBSD.org
+COMMENT=	Sources of the postgres module for the NGINX ports
+WWW=		https://github.com/sysadmin-labs/nginx-postgres-module
+
+LICENSE=	BSD2CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	sysadmin-labs
+GH_PROJECT=	nginx-postgres-module
+
+NO_ARCH=	yes
+NO_BUILD=	yes
+
+SUB_FILES=	pkg-message
+
+_MODDIR=	share/nginx/modules/${PORTNAME}
+MODULESDIR=	${PREFIX}/${_MODDIR}
+
+_MODFILES=	src/ngx_postgres_ddebug.h \
+		src/ngx_postgres_escape.c \
+		src/ngx_postgres_escape.h \
+		src/ngx_postgres_handler.c \
+		src/ngx_postgres_handler.h \
+		src/ngx_postgres_keepalive.c \
+		src/ngx_postgres_keepalive.h \
+		src/ngx_postgres_module.c \
+		src/ngx_postgres_module.h \
+		src/ngx_postgres_output.c \
+		src/ngx_postgres_output.h \
+		src/ngx_postgres_processor.c \
+		src/ngx_postgres_processor.h \
+		src/ngx_postgres_rewrite.c \
+		src/ngx_postgres_rewrite.h \
+		src/ngx_postgres_upstream.c \
+		src/ngx_postgres_upstream.h \
+		src/ngx_postgres_util.c \
+		src/ngx_postgres_util.h \
+		src/ngx_postgres_variable.c \
+		src/ngx_postgres_variable.h \
+		src/resty_dbd_stream.h
+
+PLIST_FILES=	${_MODDIR}/config \
+		${_MODFILES:S!^!${_MODDIR}/!}
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${MODULESDIR}/src
+	${INSTALL_DATA} ${WRKSRC}/config ${STAGEDIR}${MODULESDIR}
+	${INSTALL_DATA} ${_MODFILES:S!^!${WRKSRC}/!} ${STAGEDIR}${MODULESDIR}/src
+
+.include <bsd.port.mk>
diff --git a/www/nginx-module-postgres/distinfo b/www/nginx-module-postgres/distinfo
new file mode 100644
index 000000000000..6ba48779bbcd
--- /dev/null
+++ b/www/nginx-module-postgres/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1791920188
+SHA256 (sysadmin-labs-nginx-postgres-module-1.0.0_GH0.tar.gz) = 351bba8174f5e1a6d5fe7b7674d2f32103659be87c3d66310d134229a53b5e4d
+SIZE (sysadmin-labs-nginx-postgres-module-1.0.0_GH0.tar.gz) = 70031
diff --git a/www/nginx-module-postgres/files/pkg-message.in b/www/nginx-module-postgres/files/pkg-message.in
new file mode 100644
index 000000000000..695e39a0367a
--- /dev/null
+++ b/www/nginx-module-postgres/files/pkg-message.in
@@ -0,0 +1,14 @@
+[
+{ type: install
+  message: <<EOM
+This package contains the sources of the postgres module only.  It does not
+install a loadable module.
+
+The module itself is built by the nginx ports.  To use postgres, build
+www/nginx, www/nginx-devel or www/freenginx with the POSTGRES option
+enabled.  Those ports pick the sources up from
+%%PREFIX%%/share/nginx/modules/nginx-module-postgres and produce
+ngx_postgres_module.so.
+EOM
+}
+]
diff --git a/www/nginx-module-postgres/pkg-descr b/www/nginx-module-postgres/pkg-descr
new file mode 100644
index 000000000000..ad9fd0c8bbed
--- /dev/null
+++ b/www/nginx-module-postgres/pkg-descr
@@ -0,0 +1,8 @@
+The postgres module queries PostgreSQL from nginx itself, with no
+application in between: a location names an upstream and a query, and the
+rows come back as text, as JSON, or as nothing but a status code.  Values
+from the request go into the query escaped, and the status code can be
+chosen by how many rows came back.
+
+This port only installs the module sources.  The module itself is built by
+the nginx ports when their POSTGRES option is enabled.