Add databases/webdis, a simple HTTP gateway for Redis.

This commit is contained in:
Jimmy Olgeni 2021-04-06 18:26:36 +02:00
parent 688515d6ad
commit a1a984dd97
10 changed files with 128 additions and 2 deletions

2
GIDs
View File

@ -226,7 +226,7 @@ devmon:*:283:
vnstat:*:284:
exaddos:*:285:exaddos
rancid:*:286:
# free: 287
webdis:*:287:
ntopng:*:288:
# free: 289
# free: 290

2
UIDs
View File

@ -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

View File

@ -1027,6 +1027,7 @@
SUBDIR += virtualpg
SUBDIR += virtuoso
SUBDIR += vsqlite
SUBDIR += webdis
SUBDIR += wfb2sql
SUBDIR += xapian-bindings
SUBDIR += xapian-bindings12

35
databases/webdis/Makefile Normal file
View File

@ -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>

View File

@ -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

View File

@ -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)

View File

@ -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"

View File

@ -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
}

View File

@ -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"

View File

@ -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/