aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Wills <swills@FreeBSD.org>2018-03-24 00:54:47 +0800
committerSteve Wills <swills@FreeBSD.org>2018-03-24 00:54:47 +0800
commitff0184c52fc38051ae77b2a59af62dc3480f81b5 (patch)
tree2214548ad76703a6fe118aaacaea2b9027c60f4f
parent944fd9e99aa87c05dc57767c8b57a618dd78eac4 (diff)
downloadfreebsd-ports-ff0184c52fc38051ae77b2a59af62dc3480f81b5.tar.gz
freebsd-ports-ff0184c52fc38051ae77b2a59af62dc3480f81b5.tar.zst
freebsd-ports-ff0184c52fc38051ae77b2a59af62dc3480f81b5.zip
sysutils/consul-replicate: create port
The daemon consul-replicate integrates with Consul to perform cross-data-center K/V replication. WWW: https://github.com/hashicorp/consul-replicate PR: 223121 Submitted by: jhixson@gmail.com
Notes
Notes: svn path=/head/; revision=465385
-rw-r--r--sysutils/Makefile1
-rw-r--r--sysutils/consul-replicate/Makefile53
-rw-r--r--sysutils/consul-replicate/distinfo3
-rw-r--r--sysutils/consul-replicate/files/consul-replicate.in44
-rw-r--r--sysutils/consul-replicate/pkg-descr4
5 files changed, 105 insertions, 0 deletions
diff --git a/sysutils/Makefile b/sysutils/Makefile
index f6fd8c38b4a0..d374c9d7b677 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -192,6 +192,7 @@
SUBDIR += consolekit2
SUBDIR += consul
SUBDIR += consul-alerts
+ SUBDIR += consul-replicate
SUBDIR += consul_exporter
SUBDIR += container-diff
SUBDIR += contractor
diff --git a/sysutils/consul-replicate/Makefile b/sysutils/consul-replicate/Makefile
new file mode 100644
index 000000000000..8487c9ecf705
--- /dev/null
+++ b/sysutils/consul-replicate/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+PORTNAME= consul-replicate
+PORTVERSION= 0.4.0
+DISTVERSIONPREFIX= v
+CATEGORIES= sysutils
+
+MAINTAINER= jhixson@gmail.com
+COMMENT= Consul cross-DC KV replication daemon
+
+LICENSE= MPL
+
+BUILD_DEPENDS= ${LOCALBASE}/bin/go:lang/go
+
+USES= compiler
+
+USE_GITHUB= yes
+GH_ACCOUNT= hashicorp
+GH_SUBDIR= src/github.com/${GH_ACCOUNT}/${PORTNAME}
+
+USE_RC_SUBR= consul-replicate
+
+PLIST_FILES= bin/${PORTNAME}
+
+USERS= consul
+GROUPS= consul
+
+post-extract:
+ @${MV} ${WRKSRC}/vendor/ ${WRKSRC}/src/
+
+do-build:
+ @cd ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME}; \
+ ${SETENV} CGO_ENABLED=0 ${BUILD_ENV} GOCACHE=off GOPATH=${WRKSRC} \
+ go build -v -x -ldflags "\
+ -X github.com/${GH_ACCOUNT}/${PORTNAME}/version.Version=${PORTVERSION} \
+ -X github.com/${GH_ACCOUNT}/${PORTNAME}/version.GitCommit=675a2c2 \
+ -X github.com/${GH_ACCOUNT}/${PORTNAME}/version.GitDescribe=v${PORTVERSION} \
+ " -o bin/${PORTNAME}
+
+do-install:
+ ${INSTALL_PROGRAM} \
+ ${WRKSRC}/src/github.com/${GH_ACCOUNT}/${PORTNAME}/bin/${PORTNAME} \
+ ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
+
+.include <bsd.port.pre.mk>
+
+# golang assumes that if clang is in use, it is called "clang" and not "cc". If
+# it's called "cc", go fails.
+.if ${COMPILER_TYPE} == clang
+BUILD_ENV= CC=clang
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/consul-replicate/distinfo b/sysutils/consul-replicate/distinfo
new file mode 100644
index 000000000000..16c010820c3b
--- /dev/null
+++ b/sysutils/consul-replicate/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1508456952
+SHA256 (hashicorp-consul-replicate-v0.4.0_GH0.tar.gz) = cd2e0e8e9bcd80bd2b3063b2aac5169756aa48a0dc6c5736997fdf590894c49a
+SIZE (hashicorp-consul-replicate-v0.4.0_GH0.tar.gz) = 1155743
diff --git a/sysutils/consul-replicate/files/consul-replicate.in b/sysutils/consul-replicate/files/consul-replicate.in
new file mode 100644
index 000000000000..ee6ab52cc43c
--- /dev/null
+++ b/sysutils/consul-replicate/files/consul-replicate.in
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+# $FreeBSD$
+#
+# PROVIDE: consul-replicate
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# consul_replicate_enable (bool): Set to NO by default.
+# Set it to YES to enable consul.
+# consul_replicate_user (user): Set user to run consul.
+# Default is "consul".
+# consul_replcate_group (group): Set group to run consul.
+# Default is "consul".
+
+. /etc/rc.subr
+
+name=consul_replicate
+rcvar=consul_replicate_enable
+
+load_rc_config $name
+
+: ${consul_replicate_enable:="NO"}
+: ${consul_replicate_user:="consul"}
+: ${consul_replicate_group:="consul"}
+
+pidfile=/var/run/consul-replicate.pid
+procname="%%PREFIX%%/bin/consul-replicate"
+command="/usr/sbin/daemon"
+command_args="-f -p ${pidfile} /usr/bin/env ${consul_replicate_env} ${procname} -config '%%PREFIX%%/etc/consul-replicate.d' ${consul_replicate_args}"
+
+start_precmd=consul_replicate_startprecmd
+
+consul_replicate_startprecmd()
+{
+ if [ ! -e ${pidfile} ]; then
+ install -o ${consul_replicate_user} -g ${consul_replicate_group} /dev/null ${pidfile};
+ fi
+}
+
+run_rc_command "$1"
diff --git a/sysutils/consul-replicate/pkg-descr b/sysutils/consul-replicate/pkg-descr
new file mode 100644
index 000000000000..aafc29699098
--- /dev/null
+++ b/sysutils/consul-replicate/pkg-descr
@@ -0,0 +1,4 @@
+The daemon consul-replicate integrates with Consul to perform
+cross-data-center K/V replication.
+
+WWW: https://github.com/hashicorp/consul-replicate