This port delivers tasks to the CBSD using beanstalkd broker.

The service acts as an intermediate link between the broker and the CBSD.

PR:		253789
Submitted by:	olevole___at___olevole___dot___ru
This commit is contained in:
Kirill Ponomarev 2021-02-23 10:28:03 +00:00
parent 72837b45fa
commit 7940d0a475
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=566387
5 changed files with 128 additions and 0 deletions

View file

@ -141,6 +141,7 @@
SUBDIR += byobu
SUBDIR += catfish
SUBDIR += cbsd
SUBDIR += cbsd-mq-router
SUBDIR += ccd2iso
SUBDIR += cciss_vol_status
SUBDIR += ccze

View file

@ -0,0 +1,37 @@
# $FreeBSD$
PORTNAME= cbsd-mq-router
PORTVERSION= 0.1
CATEGORIES= sysutils
MAINTAINER= olevole@olevole.ru
COMMENT= CBSD message queue router
LICENSE= BSD2CLAUSE
RUN_DEPENDS= beanstalkd:net/beanstalkd
USES= go
USE_GITHUB= yes
GH_TAGNAME= 1605df2
GH_ACCOUNT= cbsd
GH_PROJECT= cbsd-mq-router
USE_RC_SUBR= cbsd-mq-router
PLIST_FILES= bin/cbsd-mq-router "@sample etc/cbsd-mq-router.json.sample"
GH_TUPLE= beanstalkd:go-beanstalk:3bed00be7a17:beanstalkd/src/github.com/beanstalkd/go-beanstalk \
golang:crypto:5ea612d1eb83:golang_crypto/vendor/golang.org/x/crypto \
golang:term:6a3ed077a48d:golang_term/vendor/golang.org/x/term \
golang:sys:9a76102bfb43:golang_sys/vendor/golang.org/x/sys
post-extract:
${LN} -sf ${WRKSRC}/src ${WRKDIR}
${LN} -sf ${WRKSRC} ${WRKDIR}/src/${PORTNAME}
do-install:
${INSTALL_PROGRAM} ${WRKDIR}/bin/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/cbsd-mq-router
${INSTALL_DATA} ${WRKDIR}/${PORTNAME}-${GH_TAGNAME}/etc/cbsd-mq-router.json ${STAGEDIR}${PREFIX}/etc/cbsd-mq-router.json.sample
.include <bsd.port.mk>

View file

@ -0,0 +1,11 @@
TIMESTAMP = 1614070067
SHA256 (cbsd-cbsd-mq-router-0.1-1605df2_GH0.tar.gz) = 2671686dc5764b27d6d8ccb9a4375026fd1e3cba7c53d1a5c3947da101d89ec8
SIZE (cbsd-cbsd-mq-router-0.1-1605df2_GH0.tar.gz) = 6970
SHA256 (beanstalkd-go-beanstalk-3bed00be7a17_GH0.tar.gz) = 4efb9667cadd4945ec54ccc3caa824ab7fb06f75f8b234c1899c4664dc718bb7
SIZE (beanstalkd-go-beanstalk-3bed00be7a17_GH0.tar.gz) = 8063
SHA256 (golang-crypto-5ea612d1eb83_GH0.tar.gz) = ab4d88d6121195632d006705a950adebaf4fa99dd15ea0c508297a17c5d3277e
SIZE (golang-crypto-5ea612d1eb83_GH0.tar.gz) = 1726242
SHA256 (golang-term-6a3ed077a48d_GH0.tar.gz) = 6760076add528b90a5e07ad357eef6f11ec03e19eebe66d1b1ef383fd9214e9a
SIZE (golang-term-6a3ed077a48d_GH0.tar.gz) = 15333
SHA256 (golang-sys-9a76102bfb43_GH0.tar.gz) = 5bbc9c4e02f8ffa73c0f1baa3d0cbd4fc987b5daf08373f669673b8d651afb1b
SIZE (golang-sys-9a76102bfb43_GH0.tar.gz) = 1115608

View file

@ -0,0 +1,75 @@
#!/bin/sh
# PROVIDE: cbsd_mq_router
# REQUIRE: NETWORK
# BEFORE: DAEMON
. /etc/rc.subr
name="cbsd_mq_router"
desc="CBSD message queue router"
rcvar="cbsd_mq_router_enable"
pidfile="/var/run/${name}.pid"
daemon_pidfile="/var/run/${name}-daemon.pid"
logdir="/var/log/${name}"
logfile="${logdir}/cbsd_mq_router.log"
extra_commands="reload"
command="%%PREFIX%%/bin/cbsd-mq-router"
cbsd_mq_router_config=${cbsd_mq_router_config-"%%PREFIX%%/etc/cbsd-mq-router.json"}
required_files="${cbsd_mq_router_config}"
cbsd_mq_router_args=${cbsd_mq_router_args-"-config ${cbsd_mq_router_config}"}
load_rc_config ${name}
start_cmd="start"
stop_cmd="stop"
status_cmd="status"
reload_cmd="reload"
stop()
{
if [ -f "${daemon_pidfile}" ]; then
pids=$( pgrep -F ${daemon_pidfile} 2>&1 )
_err=$?
[ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${daemon_pidfile}
fi
if [ -f "${pidfile}" ]; then
pids=$( pgrep -F ${pidfile} 2>&1 )
_err=$?
[ ${_err} -eq 0 ] && kill -9 ${pids} && /bin/rm -f ${pidfile}
fi
}
start()
{
[ ! -d ${logdir} ] && mkdir -p ${logdir}
touch ${logfile}
/usr/sbin/daemon -f -R5 -p ${pidfile} -P ${daemon_pidfile} -o ${logfile} ${command} ${cbsd_mq_router_args}
}
reload()
{
stop
start
}
status()
{
if [ -f "${pidfile}" ]; then
pids=$( pgrep -F ${pidfile} 2>&1 )
_err=$?
if [ ${_err} -eq 0 ]; then
echo "${name} is running as pid ${pids}"
exit 0
else
echo "wrong pid: ${pids}"
exit 1
fi
else
echo "no pidfile $pidfile"
exit 1
fi
}
run_rc_command "$1"

View file

@ -0,0 +1,4 @@
Deliver tasks to the CBSD using beanstalkd broker. The service
acts as an intermediate link between the broker and the CBSD.
WWW: https://github.com/cbsd/cbsd-mq-router