Index: head/GIDs =================================================================== --- head/GIDs +++ head/GIDs @@ -712,7 +712,7 @@ # free: 768 # free: 769 postgres:*:770: -# free: 771 +cockroach:*:771: # free: 772 # free: 773 # free: 774 Index: head/UIDs =================================================================== --- head/UIDs +++ head/UIDs @@ -718,7 +718,7 @@ # free: 768 # free: 769 postgres:*:770:770::0:0:PostgreSQL Daemon:/var/db/postgres:/bin/sh -# free: 771 +cockroach:*:771:771::0:0:CockroachDB Daemon:/var/db/cockroach:/usr/sbin/nologin # free: 772 # free: 773 # free: 774 Index: head/databases/Makefile =================================================================== --- head/databases/Makefile +++ head/databases/Makefile @@ -33,6 +33,7 @@ SUBDIR += cego SUBDIR += cegobridge SUBDIR += clickhouse + SUBDIR += cockroach SUBDIR += couchdb SUBDIR += courier-authlib-mysql SUBDIR += courier-authlib-pgsql Index: head/databases/cockroach/Makefile =================================================================== --- head/databases/cockroach/Makefile +++ head/databases/cockroach/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +PORTNAME= cockroach +PORTVERSION= 1.0.4 +DISTVERSIONPREFIX= v +CATEGORIES= databases +MASTER_SITES= https://binaries.cockroachdb.com/ +EXTRACT_SUFX= .src.tgz + +MAINTAINER= james@jen20.com +COMMENT= Cloud-native SQL database that survive disasters + +LICENSE= APACHE20 +LICENSE_FILE= ${WRKSRC}/src/github.com/cockroachdb/cockroach/LICENSE + +BUILD_DEPENDS= bash:shells/bash \ + cmake:devel/cmake \ + go:lang/go + +USES= gmake + +USE_RC_SUBR= cockroach + +PLIST_FILES= bin/cockroach + +USERS= cockroach +GROUPS= cockroach + +post-patch: + @${REINPLACE_CMD} -e 's|-DCMAKE_CXX_FLAGS=-DNDEBUG)|-DCMAKE_CXX_FLAGS=-DNDEBUG) -DFAIL_ON_WARNINGS=OFF|g' \ + ${WRKSRC}/src/github.com/cockroachdb/cockroach/build/common.mk + +do-build: + @${SETENV} -i PATH="${PATH}" \ + ${MAKE_CMD} -C ${WRKSRC} buildoss + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/src/github.com/cockroachdb/cockroach/cockroach ${STAGEDIR}${PREFIX}/bin/ + +.include Index: head/databases/cockroach/distinfo =================================================================== --- head/databases/cockroach/distinfo +++ head/databases/cockroach/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1502917562 +SHA256 (cockroach-v1.0.4.src.tgz) = 1d135016ccef6c684b7414b6b26219cad74ebec9dea5421862ac8288025476b6 +SIZE (cockroach-v1.0.4.src.tgz) = 69123903 Index: head/databases/cockroach/files/cockroach.in =================================================================== --- head/databases/cockroach/files/cockroach.in +++ head/databases/cockroach/files/cockroach.in @@ -0,0 +1,69 @@ +#!/bin/sh + +# $FreeBSD$ +# +# PROVIDE: cockroach +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# cockroach_enable (bool): Set to NO by default. +# Set it to YES to enable cockroach. +# cockroach_user (user): Set user to run cockroach. +# Default is "cockroach". +# cockroach_group (group): Set group to run cockroach. +# Default is "cockroach". +# cockroach_dir (dir): Set dir to run cockroach in. +# Default is "path=/var/db/cockroach". +# cockroach_flags (string): Set additional flags with which to run cockroach. +# Default is "--insecure --host=localhost". + +. /etc/rc.subr + +name=cockroach +rcvar=cockroach_enable + +load_rc_config $name + +: ${cockroach_enable:="NO"} +: ${cockroach_user:="cockroach"} +: ${cockroach_group:="cockroach"} +: ${cockroach_dir:="/var/db/cockroachdb"} +: ${cockroach_store:="--store=path=${cockroach_dir}"} +: ${cockroach_flags:="--insecure --host=localhost"} + +start_precmd=cockroach_startprecmd +start_cmd=${name}_start +stop_cmd=${name}_stop + +pidfile=/var/run/cockroach.pid +command="%%PREFIX%%/bin/cockroach" + +cockroach_startprecmd() +{ + if [ ! -e ${pidfile} ]; then + install -o ${cockroach_user} -g ${cockroach_group} /dev/null ${pidfile}; + fi + + if [ ! -d ${cockroach_dir} ]; then + install -d -o ${cockroach_user} -g ${cockroach_group} ${cockroach_dir} + fi +} + +cockroach_start() { + /usr/sbin/daemon -u ${cockroach_user} \ + -p $pidfile ${command} \ + start \ + ${cockroach_store} \ + ${cockroach_flags} +} + +cockroach_stop() { + [ -f $pidfile ] \ + && ${command} quit --insecure \ + || echo ${name} not running? \(check ${pidfile}\) +} + +run_rc_command "$1" Index: head/databases/cockroach/pkg-descr =================================================================== --- head/databases/cockroach/pkg-descr +++ head/databases/cockroach/pkg-descr @@ -0,0 +1,11 @@ +CockroachDB is a distributed SQL database built on a transactional +and strongly-consistent key-value store. It scales horizontally; +survives disk, machine, rack, and even datacenter failures with +minimal latency disruption and no manual intervention; supports +strongly-consistent ACID transactions; and provides a familiar SQL +API for structuring, manipulating, and querying data. + +CockroachDB is inspired by Google's Spanner and F1 technologies, and +it's completely open source. + +WWW: https://cockroachlabs.io/