From 77ea98ea335e9997c6cb8ddd44a42880727981f8 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 1 Sep 2023 11:52:21 +0200 Subject: [PATCH] deb-db/cockroach-bin: Initial import Signed-off-by: Stefan Knoblich --- dev-db/cockroach-bin/Manifest | 8 +++ .../cockroach-bin/cockroach-bin-23.1.8.ebuild | 52 ++++++++++++++ .../cockroach-bin/files/cockroach-limits.conf | 4 ++ .../cockroach-bin/files/cockroach.confd-1.0 | 45 ++++++++++++ .../cockroach-bin/files/cockroach.initd-1.0.1 | 70 +++++++++++++++++++ 5 files changed, 179 insertions(+) create mode 100644 dev-db/cockroach-bin/Manifest create mode 100644 dev-db/cockroach-bin/cockroach-bin-23.1.8.ebuild create mode 100644 dev-db/cockroach-bin/files/cockroach-limits.conf create mode 100644 dev-db/cockroach-bin/files/cockroach.confd-1.0 create mode 100644 dev-db/cockroach-bin/files/cockroach.initd-1.0.1 diff --git a/dev-db/cockroach-bin/Manifest b/dev-db/cockroach-bin/Manifest new file mode 100644 index 0000000..7071058 --- /dev/null +++ b/dev-db/cockroach-bin/Manifest @@ -0,0 +1,8 @@ +AUX cockroach-limits.conf 136 BLAKE2B 78020250f472fd810a27bd22f9f76e531c09d6748db9d808e5c7fe731bd8d8f4db983eb374220fa1a6224866f116f9c0e7e53023078b94b7b880bd70d8b32b0b SHA512 c8c68263967f0d25eaf29dc3023046edeaf9e36f23f6f296d7e1dd7b2126a0b4f431af60e34fcb5c075855260f19d7ffc0516d6ef68ff852b3c95a2632cdd6ae +AUX cockroach.confd 521 BLAKE2B 58fbe1b859cfd2c988c55a2f3aa067bab60ca30da67e85dbf99ae603c08abb646045285dd1931651945bf45100d46e61a6da5bc5ff424366dbf8e492c871283a SHA512 81efbc65e1e6dbcc4f98ab0f9ca201c9dd299140ee31cc04bfab82c7d33215a69cad15b3c190c23eb0e4a11b9050bc588b5d1097630bf2ebee4f3f14d53f3183 +AUX cockroach.confd-1.0 1324 BLAKE2B 8a906ce78a86b2b95c2b6d5777ea116462e5d6ad47b3ba72e88637e227d34f0d411af557dc8e049706740d62d9fc724b432d99d5bab1502b5e05b0af1d860eb3 SHA512 538042bb5484acfdb31c5a750be73d5e6efeb03a3b243d5bc204db9266a7b02daf7ea9d4687fd3a5223dc6d493a1672c1b581e4527599cb3e7c31e11ec2742fd +AUX cockroach.initd 542 BLAKE2B c59d584d90442ee97bd6b2e4a564bd348073680efc09e22cde650e365487de91025413cdd0feaac2f42e752aa4debba2da9bda15634e7464cf53cf5550e74fba SHA512 86684b238413812b6787bf0841dc34302f80b9ad2c25a47a349100503b37f61ec8851870c29bb4fe697216443a39ad5e2decbcedea90664adb3b7316c440e345 +AUX cockroach.initd-1.0 1676 BLAKE2B f74872fe73a571ad29e4c85193c35f1c139ce316b951dd25b695f220269f582597635216feac04e7d5d00aab6d8ed459e93c543fe7ee86fe804e9ce33dce7280 SHA512 5f0b6ade2b25372cfc7d810d9dbe10e9732e79527c0ad73eec0cdbbad894a773bfd4aaffb958d3c0e0e7ecb636a07214be494cfdd5e69f4faacc30849f7e3eb9 +AUX cockroach.initd-1.0.1 1820 BLAKE2B f3080961c251e23a01c1e5664a0112d5cab809278bfb4d1d2dbb388bb483c519e08f87e528c2c3b35519b3781890815a574442828b93913de80c5459a79454e6 SHA512 df0c06bb6ee97c3f531250486ca1fe3d2333c1e280e2d0acb24c9aa061bd6ba35358504e29bf934a382e0a677c812e6dd474e78fcab1cd5188e93e8082748e04 +DIST cockroach-v23.1.8.linux-amd64.tgz 112767822 BLAKE2B 0cf05076e5e63254e37a3f5bd87cba04d289324c830fafc7b8ae149236630d695312155ae51513dac3e01841c81c71836b4b5e63fb344014921e0f77c6ee685b SHA512 557dd02e2b8aea48df12c8deffaf06edc8269976618002ad71ed591de307055eeb38899c411605bc6aa3b8eaf63d3ff177cf0ee411a9a4f9255c91d8d4bfdfd0 +EBUILD cockroach-bin-23.1.8.ebuild 1365 BLAKE2B b4870120f049e0fac9a1c3b85618e767949e45ef3cc4985604ccd926631b5773c7ca004faff8a9a965d4de94a1630219a5af322ba2477c7259d872f6231d2c38 SHA512 2d6c4ae68f15de3d4d1b306bacf4f5f70ed1e1dfa0d3dee35d3f329d8e77780faec1604f5dc9e068c87ade3c01abb3a1dc190aa7cbe59fef59fe1a14e6c840f6 diff --git a/dev-db/cockroach-bin/cockroach-bin-23.1.8.ebuild b/dev-db/cockroach-bin/cockroach-bin-23.1.8.ebuild new file mode 100644 index 0000000..f536779 --- /dev/null +++ b/dev-db/cockroach-bin/cockroach-bin-23.1.8.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +MY_PV=v${PV} + +inherit toolchain-funcs + +DESCRIPTION="open source database for building cloud services" +HOMEPAGE="https://www.cockroachlabs.com" +SRC_URI="https://binaries.cockroachdb.com/cockroach-${MY_PV}.linux-amd64.tgz" +S="${WORKDIR}/cockroach-${MY_PV}.linux-amd64" + +LICENSE="Cockroach Apache-2.0" +SLOT="0" +KEYWORDS="~amd64" + +RDEPEND=" + acct-group/cockroach + acct-user/cockroach +" + +DEPEND=" + ${RDEPEND} + !!dev-db/cockroach +" + +QA_EXECSTACK="usr/bin/cockroach" + +src_install() { + dobin cockroach + + insinto /usr/lib/cockroach + doins lib/libgeos{,_c}.so + fperms 0755 /usr/lib/cockroach/libgeos{,_c}.so + + insinto /etc/security/limits.d + newins "${FILESDIR}"/cockroach-limits.conf cockroach.conf + newconfd "${FILESDIR}"/cockroach.confd-1.0 cockroach + newinitd "${FILESDIR}"/cockroach.initd-1.0.1 cockroach + keepdir /var/log/cockroach + fowners cockroach:cockroach /var/log/cockroach + if [[ -z ${REPLACING_VERSIONS} ]]; then + ewarn "The default setup is for the first node of an insecure" + ewarn "cluster that only listens on localhost." + ewarn "Please read the cockroach manual at the following url" + ewarn "and configure /etc/conf.d/cockroach correctly if you" + ewarn "plan to use it in production." + ewarn + ewarn "http://cockroachlabs.com/docs" + fi +} diff --git a/dev-db/cockroach-bin/files/cockroach-limits.conf b/dev-db/cockroach-bin/files/cockroach-limits.conf new file mode 100644 index 0000000..2014a5d --- /dev/null +++ b/dev-db/cockroach-bin/files/cockroach-limits.conf @@ -0,0 +1,4 @@ +# This is needed because cockroach can open a high number of file +# descriptors +cockroach soft nofile 35000 +cockroach hard nofile 35000 diff --git a/dev-db/cockroach-bin/files/cockroach.confd-1.0 b/dev-db/cockroach-bin/files/cockroach.confd-1.0 new file mode 100644 index 0000000..7874cc1 --- /dev/null +++ b/dev-db/cockroach-bin/files/cockroach.confd-1.0 @@ -0,0 +1,45 @@ +# The default setup is for the first node of an insecure cluster that only +# listens on localhost. +# +# Please read the cockroach manual at the following url and configure +# this file correctly if you plan to use cockroach in production. +# +# http://cockroachlabs.com/docs +# +#For more information about what the arguments mean, run +#"cockroach start --help" or "cockroach quit --help". +# +#These values are passed to the appropriate arguments when starting or +#stopping the cockroach database. +#Leaving these commented accepts the cockroach defaults with the +#exceptions of host, http_host, insecure and log_path. +# +#The default for host and http_host is localhost instead of the catch-all +#address. If you want to use the catch-all address for either of these, +#please use +# "all" for the setting. # +# +# The default for insecure is yes which passes the --insecure argument to +# cockroach. If you want a secure connection, set insecure=no and set +# certs_path to the location of your certificates. +# +#log_path defaults to /var/log/${RC_SVCNAME}. +# +#attrs="" +#cache="" +#certs_path="" +#host="" +#http_host="" +#http_port="" +#insecure="" +#join="" +#locality="" +#log_path="" +#port="" +#store="" +# +# extra arguments to use when starting the database +# start_args="" +# +# extra arguments to use when stopping the database +# stop_args="" diff --git a/dev-db/cockroach-bin/files/cockroach.initd-1.0.1 b/dev-db/cockroach-bin/files/cockroach.initd-1.0.1 new file mode 100644 index 0000000..252fc6b --- /dev/null +++ b/dev-db/cockroach-bin/files/cockroach.initd-1.0.1 @@ -0,0 +1,70 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command=/usr/bin/cockroach +pidfile=/run/${RC_SVCNAME}/cockroach.pid +start_stop_daemon_args="--quiet --user cockroach" +[ -n "${attrs}" ] && attrs_arg="--attrs=${attrs}" +[ -n "${cache}" ] && cache_arg="--cache=${cache}" +[ -n "${certs_path}" ] && certs_dir_arg="--certs-dir=${certs_path}" +[ "${host}" != all ] && host_arg="--host=${host:-localhost}" +[ "$http_host" != all ] && http_host_arg="--http-host=${http_host:-localhost}" +[ -n "${http_port}" ] && http_port_arg="--http-port=${http_port}" +yesno "${insecure:-yes}" && insecure_arg="--insecure" +[ -n "${join}" ] && join_arg="--join=${join}" +[ -n "${locality}" ] && locality_arg="--locality=\"${locality}\"" +log_path="${log_path:-/var/log/${RC_SVCNAME}}" +[ -n "${log_path}" ] && log_dir_arg="--log-dir=${log_path}" + pidfile_arg="--pid-file=${pidfile}" +[ -n "${port}" ] && port_arg="--port=${port}" +store_arg="--store=${store:-/var/lib/cockroach/data}" +command_args="start --background + ${attrs_arg} + ${cache_arg} + ${certs_dir_arg} + ${host_arg} + ${http_host_arg} + ${http_port_arg} + ${insecure_arg} + ${join_arg} + ${locality_arg} + ${log_dir_arg} + ${pidfile_arg} + ${port_arg} + ${store_arg} + ${start_args}" +quit_args=" + ${certs_dir_arg} + ${host_arg} + ${insecure_arg} + ${port_arg} + " + +depend() { + use net +} + +start_pre() { + if [ -n "${log_path}" ]; then + checkpath -d -m 0755 -o cockroach:cockroach "${log_path}" || + return 1 + fi + checkpath -d -m 0755 -o cockroach:cockroach "$(dirname ${pidfile})" +} + +stop() { +ebegin "bringing down ${RC_SVCNAME}" +eval ${command} quit ${quit_args} ${stop_args} +eend $? +} + +stop_post() { + local cr_pid + read -r cr_pid < "${pidfile}" + while [ -d /proc/"${cr_pid}" ]; do + sleep 1 + done + rm -f "${pidfile}" + return 0 +}