Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Apr 2021 16:58:50 GMT
From:      Jimmy Olgeni <olgeni@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: a1a984dd9763 - main - Add databases/webdis, a simple HTTP gateway for Redis.
Message-ID:  <202104061658.136GwoP9000300@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by olgeni:

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

commit a1a984dd9763dd8bd0c50e538e0ee6bcf6d213b8
Author:     Jimmy Olgeni <olgeni@FreeBSD.org>
AuthorDate: 2021-04-06 16:26:36 +0000
Commit:     Jimmy Olgeni <olgeni@FreeBSD.org>
CommitDate: 2021-04-06 16:58:00 +0000

    Add databases/webdis, a simple HTTP gateway for Redis.
---
 GIDs                                  |  2 +-
 UIDs                                  |  2 +-
 databases/Makefile                    |  1 +
 databases/webdis/Makefile             | 35 +++++++++++++++++++++++++++++
 databases/webdis/distinfo             |  3 +++
 databases/webdis/files/patch-Makefile | 13 +++++++++++
 databases/webdis/files/pkg-message.in |  4 ++++
 databases/webdis/files/webdis.conf    | 24 ++++++++++++++++++++
 databases/webdis/files/webdis.in      | 42 +++++++++++++++++++++++++++++++++++
 databases/webdis/pkg-descr            |  4 ++++
 10 files changed, 128 insertions(+), 2 deletions(-)

diff --git a/GIDs b/GIDs
index d1a4f5a6b9c2..16bcb3576c7e 100644
--- a/GIDs
+++ b/GIDs
@@ -226,7 +226,7 @@ devmon:*:283:
 vnstat:*:284:
 exaddos:*:285:exaddos
 rancid:*:286:
-# free: 287
+webdis:*:287:
 ntopng:*:288:
 # free: 289
 # free: 290
diff --git a/UIDs b/UIDs
index 4d4442ac55a6..c8572bbcb5d4 100644
--- a/UIDs
+++ b/UIDs
@@ -231,7 +231,7 @@ devmon:*:283:283::0:0:devmon monitor:/nonexistent:/usr/sbin/nologin
 vnstat:*:284:284::0:0:vnStat Network Monitor:/nonexistent:/usr/sbin/nologin
 exaddos:*:285:285::0:0:exaddos daemon user:/nonexistent:/usr/sbin/nologin
 rancid:*:286:286::0:0:RANCID daemon user:/usr/local/var/rancid:/bin/sh
-# free: 287
+webdis:*:287:287::0:0:webdis daemon user:/nonexistent:/usr/sbin/nologin
 ntopng:*:288:288::0:0:ntopng daemon user:/nonexistent:/usr/sbin/nologin
 # free: 289
 # free: 290
diff --git a/databases/Makefile b/databases/Makefile
index 3f00997d24cd..4defdda72ec6 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -1027,6 +1027,7 @@
     SUBDIR += virtualpg
     SUBDIR += virtuoso
     SUBDIR += vsqlite
+    SUBDIR += webdis
     SUBDIR += wfb2sql
     SUBDIR += xapian-bindings
     SUBDIR += xapian-bindings12
diff --git a/databases/webdis/Makefile b/databases/webdis/Makefile
new file mode 100644
index 000000000000..d792dd51a760
--- /dev/null
+++ b/databases/webdis/Makefile
@@ -0,0 +1,35 @@
+# $FreeBSD$
+
+PORTNAME=	webdis
+DISTVERSION=	0.1.14
+CATEGORIES=	databases
+
+MAINTAINER=	olgeni@FreeBSD.org
+COMMENT=	HTTP interface for Redis
+
+LICENSE=	BSD2CLAUSE
+
+LIB_DEPENDS=	libevent.so:devel/libevent
+
+USES=		gmake
+USE_GITHUB=	yes
+GH_ACCOUNT=	nicolasff
+USE_RC_SUBR=	webdis
+
+USERS=		webdis
+GROUPS=		webdis
+
+PLIST_FILES=	bin/webdis \
+		"@sample etc/webdis.conf.sample"
+
+post-patch:
+	${REINPLACE_CMD} -e "s@%%LOCALBASE%%@${LOCALBASE}@g" ${WRKSRC}/Makefile
+
+do-install:
+	${INSTALL} ${WRKSRC}/webdis ${STAGEDIR}${PREFIX}/bin/webdis
+	${INSTALL_DATA} ${FILESDIR}/webdis.conf ${STAGEDIR}${PREFIX}/etc/webdis.conf.sample
+
+post-install:
+	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/webdis
+
+.include <bsd.port.mk>
diff --git a/databases/webdis/distinfo b/databases/webdis/distinfo
new file mode 100644
index 000000000000..1ba6ca2bb248
--- /dev/null
+++ b/databases/webdis/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1617726637
+SHA256 (nicolasff-webdis-0.1.14_GH0.tar.gz) = 8c2ba6b85d6fda15acd13eb9705c0b6a19e178a2358c034e5690ef7ca0ebf5d7
+SIZE (nicolasff-webdis-0.1.14_GH0.tar.gz) = 145302
diff --git a/databases/webdis/files/patch-Makefile b/databases/webdis/files/patch-Makefile
new file mode 100644
index 000000000000..0d91188e1f55
--- /dev/null
+++ b/databases/webdis/files/patch-Makefile
@@ -0,0 +1,13 @@
+--- Makefile.orig	2019-09-30 09:33:34 UTC
++++ Makefile
+@@ -5,8 +5,8 @@ B64_OBJS?=b64/cencode.o
+ FORMAT_OBJS?=formats/json.o formats/raw.o formats/common.o formats/custom-type.o
+ HTTP_PARSER_OBJS?=http-parser/http_parser.o
+ 
+-CFLAGS ?= -O3 -Wall -Wextra -Isrc -Isrc/jansson/src -Isrc/http-parser -MD
+-LDFLAGS ?= -levent -pthread
++CFLAGS += -Isrc -Isrc/jansson/src -Isrc/http-parser -MD -I%%LOCALBASE%%/include -I%%LOCALBASE%%/include/event2
++LDFLAGS += -levent -pthread -L%%LOCALBASE%%/lib
+
+ # check for MessagePack
+ MSGPACK_LIB=$(shell ls /usr/lib/libmsgpack.so 2>/dev/null)
diff --git a/databases/webdis/files/pkg-message.in b/databases/webdis/files/pkg-message.in
new file mode 100644
index 000000000000..ff05961d2e0d
--- /dev/null
+++ b/databases/webdis/files/pkg-message.in
@@ -0,0 +1,4 @@
+You can configure the log file for webdis by adding the following
+entry to %%PREFIX%%/etc/webdis.conf:
+
+  "logfile": "/var/log/webdis.log"
diff --git a/databases/webdis/files/webdis.conf b/databases/webdis/files/webdis.conf
new file mode 100644
index 000000000000..284335149c11
--- /dev/null
+++ b/databases/webdis/files/webdis.conf
@@ -0,0 +1,24 @@
+{
+  "redis_host": "127.0.0.1",
+  "redis_port": 6379,
+  "redis_auth": null,
+  "http_host": "127.0.0.1",
+  "http_port": 7379,
+  "threads": 4,
+  "daemonize": false,
+  "database": 0,
+  "acl": [
+    {
+      "disabled": [
+        "DEBUG"
+      ]
+    },
+    {
+      "http_basic_auth": "user:password",
+      "enabled": [
+        "DEBUG"
+      ]
+    }
+  ],
+  "verbosity": 3
+}
diff --git a/databases/webdis/files/webdis.in b/databases/webdis/files/webdis.in
new file mode 100644
index 000000000000..1aba2553440f
--- /dev/null
+++ b/databases/webdis/files/webdis.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# PROVIDE: webdis
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add these lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# webdis_enable (bool):	Set to NO by default.
+#			Set it to YES to enable webdis.
+# webdis_config (path):	Set to %%PREFIX%%/etc/webdis.conf
+#			by default.
+# webdis_user (user):	Set to 'webdis'	by default.
+# webdis_group (group):	Set to 'webdis'	by default.
+
+. /etc/rc.subr
+
+name=webdis
+rcvar=webdis_enable
+
+load_rc_config $name
+
+: ${webdis_enable:=NO}
+: ${webdis_config:=%%PREFIX%%/etc/webdis.conf}
+: ${webdis_user:=webdis}
+: ${webdis_group:=webdis}
+
+start_precmd=webdis_start_precmd
+pidfile="/var/run/${name}.pid"
+procname="%%PREFIX%%/bin/${name}"
+command=/usr/sbin/daemon
+command_args="-f -c -p ${pidfile} ${procname} ${webdis_config}"
+
+webdis_start_precmd()
+{
+    if [ ! -e ${pidfile} ]; then
+        install -o ${webdis_user} -g ${webdis_group} /dev/null ${pidfile}
+    fi
+}
+
+run_rc_command "$1"
diff --git a/databases/webdis/pkg-descr b/databases/webdis/pkg-descr
new file mode 100644
index 000000000000..95630b6b8293
--- /dev/null
+++ b/databases/webdis/pkg-descr
@@ -0,0 +1,4 @@
+Webdis is a simple HTTP server which forwards commands to Redis and
+sends the reply back using a format of your choice.
+
+WWW: https://webd.is/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104061658.136GwoP9000300>