sysutils/stanchion: Open source database cluster control for Riak

Stanchion is an application to enforce the serialization of requests. It
consists of two main parts: a simple HTTP interface and a processing backend
that manages requests and interacts with a local Riak instance.

WWW: https://github.com/basho/stanchion

Submitted by:	Scott Kamp (based on)
This commit is contained in:
William Grzybowski 2015-09-25 12:24:07 +00:00
parent ab7b5f959d
commit d239f0baf7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397818
8 changed files with 227 additions and 0 deletions

1
UIDs
View File

@ -223,6 +223,7 @@ caldavd:*:639:639::0:0:Caldavd user:/var/db/caldavd:/usr/sbin/nologin
monkeysphere:*:641:641::0:0:Monkeysphere User:/var/monkeysphere:/usr/local/bin/bash
aox:*:666:666::0:0:Archiveopteryx user:/nonexistent:/usr/sbin/nologin
riak:*:667:667::0:0:Riak user:/usr/local/lib/riak:/bin/sh
stanchion:*:669:667::0:0:Stanchion user:/usr/local/lib/stanchion:/bin/sh
bnetd:*:700:700::0:0:Bnetd user:/nonexistent:/usr/sbin/nologin
fastnetmon:*:701:701::0:0:FastNetMon user:/nonexistent:/usr/sbin/nologin
bopm:*:717:717::0:0:Blitzed Open Proxy Monitor:/nonexistent:/bin/sh

View File

@ -957,6 +957,7 @@
SUBDIR += ssid
SUBDIR += ssync
SUBDIR += stalepid
SUBDIR += stanchion
SUBDIR += stmpclean
SUBDIR += storcli
SUBDIR += stow

View File

@ -0,0 +1,79 @@
# $FreeBSD$
PORTNAME= stanchion
PORTVERSION= 2.0.0
CATEGORIES= sysutils
MASTER_SITES= http://s3.amazonaws.com/downloads.basho.com/stanchion/${PORTVERSION:R}/${PORTVERSION}/ \
http://downloads.basho.com.s3.amazonaws.com/stanchion/${PORTVERSION:R}/${PORTVERSION}/
MAINTAINER= wg@FreeBSD.org
COMMENT= Open source database cluster control for Riak
LICENSE= APACHE20
BUILD_DEPENDS= ${LOCALBASE}/lib/riak-erlang/bin/erlc:${PORTSDIR}/lang/erlang-riak
USES= gmake readline
USE_RC_SUBR= stanchion
USE_GCC= yes
USERS= stanchion
GROUPS= riak
STANCHION_CONFDIR?= ${PREFIX}/etc/stanchion
STANCHION_DBDIR?= /var/db/stanchion
STANCHION_HOMEDIR?= ${PREFIX}/lib/stanchion
STANCHION_LIBDIR?= ${PREFIX}/lib/stanchion/lib
STANCHION_LOGDIR?= /var/log/stanchion
PLIST_SUB+= STANCHION_CONFDIR=${STANCHION_CONFDIR} \
STANCHION_DBDIR=${STANCHION_DBDIR} \
STANCHION_HOMEDIR=${STANCHION_HOMEDIR} \
STANCHION_LIBDIR=${STANCHION_LIBDIR} \
STANCHION_LOGDIR=${STANCHION_LOGDIR} \
USERS=${USERS} \
GROUPS=${GROUPS}
ALL_TARGET= rel
MAKE_JOBS_UNSAFE=yes
MAKE_ENV= PATH=${LOCALBASE}/lib/riak-erlang/bin:${PATH}
post-patch:
@${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' ${WRKSRC}/rel/vars.config
do-install:
${MKDIR} ${STAGEDIR}${STANCHION_CONFDIR}
${MKDIR} ${STAGEDIR}${STANCHION_DBDIR}
${MKDIR} ${STAGEDIR}${STANCHION_LOGDIR}
${INSTALL_DATA} ${WRKSRC}/rel/stanchion/etc/stanchion.conf ${STAGEDIR}${STANCHION_CONFDIR}/stanchion.conf
${INSTALL_DATA} ${WRKSRC}/rel/stanchion/etc/advanced.config ${STAGEDIR}${STANCHION_CONFDIR}/advanced.config
${INSTALL_DATA} ${WRKSRC}/rel/stanchion/etc/cert.pem ${STAGEDIR}${STANCHION_CONFDIR}/cert.pem
${INSTALL_DATA} ${WRKSRC}/rel/stanchion/etc/key.pem ${STAGEDIR}${STANCHION_CONFDIR}/key.pem
(cd ${WRKSRC}/rel/stanchion/lib/ && ${COPYTREE_BIN} . ${STAGEDIR}${STANCHION_LIBDIR})
(cd ${WRKSRC}/rel/stanchion/bin/ && ${COPYTREE_BIN} . ${STAGEDIR}${PREFIX}/sbin/)
(cd ${WRKSRC}/rel/stanchion/releases && ${COPYTREE_SHARE} . ${STAGEDIR}${STANCHION_HOMEDIR}/releases)
${CP} -R ${WRKSRC}/rel/stanchion/erts-* ${STAGEDIR}${STANCHION_HOMEDIR}
post-install:
(cd ${STAGEDIR}${STANCHION_HOMEDIR}; ${FIND} releases -type f \
| ${SED} -e 's,^\./,,g' \
| ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
| ${AWK} '{print "lib/stanchion/"$$2 }' >> ${TMPPLIST})
(cd ${STAGEDIR}${STANCHION_HOMEDIR}; ${FIND} erts-* -type f \
| ${SED} -e 's,^\./,,g' \
| ${AWK} '{print length, $$0}' | ${SORT} -rn \
| ${AWK} '{print "lib/stanchion/"$$2 }' >> ${TMPPLIST})
(cd ${STAGEDIR}${STANCHION_HOMEDIR}; ${FIND} erts-* -type d -empty \
| ${SED} -e 's,^\./,,g' \
| ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
| ${AWK} '{print "@dir lib/stanchion/"$$2 }' >> ${TMPPLIST})
(cd ${STAGEDIR}${STANCHION_LIBDIR}; ${FIND} . -type f \
| ${SED} -e 's,^\./,,g' \
| ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
| ${AWK} '{print "lib/stanchion/lib/"$$2 }' >> ${TMPPLIST})
(cd ${STAGEDIR}${STANCHION_LIBDIR}; ${FIND} . -type d -empty \
| ${SED} -e 's,^\./,,g' \
| ${AWK} '{print length, $$0}' | ${SORT} -rn | ${SED} -e 's/^/lib\//' \
| ${AWK} '{print "@dir lib/stanchion/lib/"$$2 }' >> ${TMPPLIST})
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (stanchion-2.0.0.tar.gz) = c5380f25cf8f65687e8b3a17db8e319a13e7b786110ea7c606de213d78e44106
SIZE (stanchion-2.0.0.tar.gz) = 4109581

View File

@ -0,0 +1,43 @@
--- rel/vars.config.orig 2015-03-23 18:52:47.000000000 +1100
+++ rel/vars.config 2015-09-24 15:04:54.707161521 +1000
@@ -2,11 +2,12 @@
%% ex: ft=erlang ts=4 sw=4 et
%% Platform-specific installation paths
-{platform_bin_dir, "./bin"}.
-{platform_data_dir, "./data"}.
-{platform_etc_dir, "./etc"}.
-{platform_lib_dir, "./lib"}.
-{platform_log_dir, "./log"}.
+{platform_base_dir, "%%PREFIX%%/lib/stanchion"}.
+{platform_bin_dir, "%%PREFIX%%/sbin"}.
+{platform_etc_dir, "%%PREFIX%%/etc/stanchion"}.
+{platform_lib_dir, "%%PREFIX%%/lib/stanchion/lib"}.
+{platform_data_dir, "/var/db/stanchion"}.
+{platform_log_dir, "/var/log/stanchion"}.
%%
%% etc/app.config
@@ -29,14 +30,14 @@
%% bin/stanchion
%%
{data_dir, "{{target_dir}}/data"}.
-{runner_script_dir, "\`cd \\`dirname $0\\` && /bin/pwd\`"}.
-{runner_base_dir, "{{runner_script_dir}}/.."}.
-{runner_etc_dir, "$RUNNER_BASE_DIR/etc"}.
-{runner_log_dir, "$RUNNER_BASE_DIR/log"}.
-{runner_lib_dir, "$RUNNER_BASE_DIR/lib"}.
-{runner_patch_dir, "$RUNNER_BASE_DIR/lib/basho-patches"}.
-{pipe_dir, "/tmp/$RUNNER_BASE_DIR/"}.
-{runner_user, ""}.
+{runner_script_dir, "{{platform_bin_dir}}"}.
+{runner_base_dir, "{{platform_base_dir}}"}.
+{runner_etc_dir, "{{platform_etc_dir}}"}.
+{runner_log_dir, "{{platform_log_dir}}"}.
+{runner_lib_dir, "{{platform_lib_dir}}"}.
+{runner_patch_dir, "{{platform_lib_dir}}/basho-patches"}.
+{pipe_dir, "/tmp/stanchion"}.
+{runner_user, "stanchion"}.
{runner_wait_process, "stanchion_server_sup"}.
%% lager

View File

@ -0,0 +1,84 @@
#!/bin/sh
# $FreeBSD$
# PROVIDE: stanchion
# REQUIRE: LOGIN cleanvar
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable stanchion:
# stanchion_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable stanchion on boot.
#
. /etc/rc.subr
name="stanchion"
rcvar=stanchion_enable
pidfile=/var/run/stanchion/stanchion.pid
start_cmd="stanchion_start"
stop_cmd="stanchion_stop"
restart_cdm="stanchion_restart"
status_cmd="stanchion_status"
command="%%PREFIX%%/sbin/stanchion"
load_rc_config $name
# Read rc.d config and set defaults
load_rc_config "$name"
: ${stanchion_enable="NO"}
stanchion_start()
{
echo "Starting Riak."
%%PREFIX%%/sbin/stanchion start
return 0
}
stanchion_stop()
{
echo "Stopping Riak processes"
%%PREFIX%%/sbin/stanchion stop
killall -9 epmd
return 0
}
stanchion_restart()
{
stanchion_stop
stanchion_start
return 0
}
stanchion_status()
{
if stanchion_running; then
echo "Riak is running."
return 0
else
echo "Riak is not running"
return 1
fi
}
stanchion_running()
{
local pid result ps
pid=`%%PREFIX%%/sbin/stanchion getpid`
result=`echo $?`
if [ "$result" == 0 ]; then
ps=`ps -waux | grep ${pid} | grep stanchion`
result=`echo $?`
if [ "$result" ]; then
return 0
else
return 1
fi
else
return 1
fi
}
run_rc_command "$1"

View File

@ -0,0 +1,5 @@
Stanchion is an application to enforce the serialization of requests. It
consists of two main parts: a simple HTTP interface and a processing backend
that manages requests and interacts with a local Riak instance.
WWW: https://github.com/basho/stanchion

View File

@ -0,0 +1,12 @@
sbin/stanchion
@sample %%STANCHION_CONFDIR%%/stanchion.conf
@sample %%STANCHION_CONFDIR%%/advanced.config
@sample %%STANCHION_CONFDIR%%/key.pem
@sample %%STANCHION_CONFDIR%%/cert.pem
@dir %%STANCHION_CONFDIR%%
@owner %%USERS%%
@group %%GROUPS%%
@dir %%STANCHION_DBDIR%%
@dir %%STANCHION_HOMEDIR%%
@dir %%STANCHION_LIBDIR%%
@dir %%STANCHION_LOGDIR%%