diff options
author | William Grzybowski <wg@FreeBSD.org> | 2015-09-25 12:24:07 +0000 |
---|---|---|
committer | William Grzybowski <wg@FreeBSD.org> | 2015-09-25 12:24:07 +0000 |
commit | d239f0baf74bae64ce88ba21af92110fa3209786 (patch) | |
tree | fc823ccaefed92e3dc1c2ca881d6b3bd798b28b4 /sysutils/stanchion | |
parent | ab7b5f959ddbc16ad212a9b6f98e9a21e2097204 (diff) | |
download | ports-d239f0baf74bae64ce88ba21af92110fa3209786.tar.gz ports-d239f0baf74bae64ce88ba21af92110fa3209786.zip |
Notes
Diffstat (limited to 'sysutils/stanchion')
-rw-r--r-- | sysutils/stanchion/Makefile | 79 | ||||
-rw-r--r-- | sysutils/stanchion/distinfo | 2 | ||||
-rw-r--r-- | sysutils/stanchion/files/patch-rel_vars.config | 43 | ||||
-rw-r--r-- | sysutils/stanchion/files/stanchion.in | 84 | ||||
-rw-r--r-- | sysutils/stanchion/pkg-descr | 5 | ||||
-rw-r--r-- | sysutils/stanchion/pkg-plist | 12 |
6 files changed, 225 insertions, 0 deletions
diff --git a/sysutils/stanchion/Makefile b/sysutils/stanchion/Makefile new file mode 100644 index 000000000000..5362de3b51ff --- /dev/null +++ b/sysutils/stanchion/Makefile @@ -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> diff --git a/sysutils/stanchion/distinfo b/sysutils/stanchion/distinfo new file mode 100644 index 000000000000..14e8f5d6107e --- /dev/null +++ b/sysutils/stanchion/distinfo @@ -0,0 +1,2 @@ +SHA256 (stanchion-2.0.0.tar.gz) = c5380f25cf8f65687e8b3a17db8e319a13e7b786110ea7c606de213d78e44106 +SIZE (stanchion-2.0.0.tar.gz) = 4109581 diff --git a/sysutils/stanchion/files/patch-rel_vars.config b/sysutils/stanchion/files/patch-rel_vars.config new file mode 100644 index 000000000000..bd80ec46e5c1 --- /dev/null +++ b/sysutils/stanchion/files/patch-rel_vars.config @@ -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 diff --git a/sysutils/stanchion/files/stanchion.in b/sysutils/stanchion/files/stanchion.in new file mode 100644 index 000000000000..022f0b5ee977 --- /dev/null +++ b/sysutils/stanchion/files/stanchion.in @@ -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" diff --git a/sysutils/stanchion/pkg-descr b/sysutils/stanchion/pkg-descr new file mode 100644 index 000000000000..84aa5a3af30d --- /dev/null +++ b/sysutils/stanchion/pkg-descr @@ -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 diff --git a/sysutils/stanchion/pkg-plist b/sysutils/stanchion/pkg-plist new file mode 100644 index 000000000000..8b41da140815 --- /dev/null +++ b/sysutils/stanchion/pkg-plist @@ -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%% |