diff options
author | 2015-05-24 07:59:56 +0000 | |
---|---|---|
committer | 2015-05-24 07:59:56 +0000 | |
commit | 1676c85f64914d9ec9d3551dcefdb5ad9fbb1b6d (patch) | |
tree | 8df8de7c22a3007bb1bf89d47c3609acec9a42a0 /app-admin | |
parent | Stable for PPC64 (bug #511778). (diff) | |
download | gentoo-2-1676c85f64914d9ec9d3551dcefdb5ad9fbb1b6d.tar.gz gentoo-2-1676c85f64914d9ec9d3551dcefdb5ad9fbb1b6d.tar.bz2 gentoo-2-1676c85f64914d9ec9d3551dcefdb5ad9fbb1b6d.zip |
Add consul, partially based on ebuilds by Alexys Jacob <ultrabug@gentoo.org>.
(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key FDE8EF85AE5719A3)
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/consul/ChangeLog | 12 | ||||
-rw-r--r-- | app-admin/consul/consul-0.5.2.ebuild | 149 | ||||
-rw-r--r-- | app-admin/consul/consul-9999.ebuild | 105 | ||||
-rw-r--r-- | app-admin/consul/files/bootstrap.json.example | 4 | ||||
-rw-r--r-- | app-admin/consul/files/consul.confd | 10 | ||||
-rw-r--r-- | app-admin/consul/files/consul.initd | 40 | ||||
-rw-r--r-- | app-admin/consul/files/consul.service | 16 | ||||
-rw-r--r-- | app-admin/consul/files/data-dir.json.example | 3 | ||||
-rw-r--r-- | app-admin/consul/files/ui-dir.json.example | 3 | ||||
-rw-r--r-- | app-admin/consul/metadata.xml | 10 |
10 files changed, 352 insertions, 0 deletions
diff --git a/app-admin/consul/ChangeLog b/app-admin/consul/ChangeLog new file mode 100644 index 000000000000..3767f6a180ac --- /dev/null +++ b/app-admin/consul/ChangeLog @@ -0,0 +1,12 @@ +# ChangeLog for app-admin/consul +# Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/consul/ChangeLog,v 1.1 2015/05/24 07:59:56 zmedico Exp $ + +*consul-0.5.2 (24 May 2015) +*consul-9999 (24 May 2015) + + 24 May 2015; Zac Medico <zmedico@gentoo.org> +consul-0.5.2.ebuild, + +consul-9999.ebuild, +files/bootstrap.json.example, +files/consul.confd, + +files/consul.initd, +files/consul.service, +files/data-dir.json.example, + +files/ui-dir.json.example, +metadata.xml: + Add consul, partially based on ebuilds by Alexys Jacob <ultrabug@gentoo.org>. diff --git a/app-admin/consul/consul-0.5.2.ebuild b/app-admin/consul/consul-0.5.2.ebuild new file mode 100644 index 000000000000..5ae00c054da6 --- /dev/null +++ b/app-admin/consul/consul-0.5.2.ebuild @@ -0,0 +1,149 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/consul/consul-0.5.2.ebuild,v 1.1 2015/05/24 07:59:56 zmedico Exp $ + +EAPI=5 + +inherit systemd user + +KEYWORDS="~amd64" +DESCRIPTION="A tool for service discovery, monitoring and configuration" +HOMEPAGE="http://www.consul.io" +GO_PN="github.com/hashicorp/consul" +LICENSE="MPL-2.0" +SLOT="0" +IUSE="test web" + +DEPEND=">=dev-lang/go-1.4 + dev-go/go-crypto + test? ( dev-go/go-tools ) + web? ( + dev-ruby/sass + dev-ruby/uglifier + )" +RDEPEND=">=dev-lang/go-1.4" + +SRC_URI="https://github.com/hashicorp/consul/archive/v0.5.2.tar.gz -> ${P}.tar.gz +https://github.com/armon/circbuf/archive/f092b4f207b6e5cce0569056fba9e1a2735cb6cf.tar.gz -> circbuf-f092b4f207b6e5cce0569056fba9e1a2735cb6cf.tar.gz +https://github.com/armon/go-metrics/archive/a54701ebec11868993bc198c3f315353e9de2ed6.tar.gz -> go-metrics-a54701ebec11868993bc198c3f315353e9de2ed6.tar.gz +https://github.com/armon/go-radix/archive/0bab926c3433cfd6490c6d3c504a7b471362390c.tar.gz -> go-radix-0bab926c3433cfd6490c6d3c504a7b471362390c.tar.gz +https://github.com/armon/gomdb/archive/151f2e08ef45cb0e57d694b2562f351955dff572.tar.gz -> gomdb-151f2e08ef45cb0e57d694b2562f351955dff572.tar.gz +https://github.com/boltdb/bolt/archive/2c04100eb9793f2b8541d243494e2909d2112325.tar.gz -> bolt-2c04100eb9793f2b8541d243494e2909d2112325.tar.gz +https://github.com/hashicorp/consul-migrate/archive/v0.1.0.tar.gz -> consul-migrate-0.1.0.tar.gz +https://github.com/hashicorp/go-checkpoint/archive/88326f6851319068e7b34981032128c0b1a6524d.tar.gz -> go-checkpoint-88326f6851319068e7b34981032128c0b1a6524d.tar.gz +https://github.com/hashicorp/go-msgpack/archive/71c2886f5a673a35f909803f38ece5810165097b.tar.gz -> go-msgpack-71c2886f5a673a35f909803f38ece5810165097b.tar.gz +https://github.com/hashicorp/go-multierror/archive/fcdddc395df1ddf4247c69bd436e84cfa0733f7e.tar.gz -> go-multierror-fcdddc395df1ddf4247c69bd436e84cfa0733f7e.tar.gz +https://github.com/hashicorp/go-syslog/archive/42a2b573b664dbf281bd48c3cc12c086b17a39ba.tar.gz -> go-syslog-42a2b573b664dbf281bd48c3cc12c086b17a39ba.tar.gz +https://github.com/hashicorp/golang-lru/archive/995efda3e073b6946b175ed93901d729ad47466a.tar.gz -> golang-lru-995efda3e073b6946b175ed93901d729ad47466a.tar.gz +https://github.com/hashicorp/hcl/archive/513e04c400ee2e81e97f5e011c08fb42c6f69b84.tar.gz -> hcl-513e04c400ee2e81e97f5e011c08fb42c6f69b84.tar.gz +https://github.com/hashicorp/logutils/archive/367a65d59043b4f846d179341d138f01f988c186.tar.gz -> logutils-367a65d59043b4f846d179341d138f01f988c186.tar.gz +https://github.com/hashicorp/memberlist/archive/6025015f2dc659ca2c735112d37e753bda6e329d.tar.gz -> memberlist-6025015f2dc659ca2c735112d37e753bda6e329d.tar.gz +https://github.com/hashicorp/net-rpc-msgpackrpc/archive/d377902b7aba83dd3895837b902f6cf3f71edcb2.tar.gz -> net-rpc-msgpackrpc-d377902b7aba83dd3895837b902f6cf3f71edcb2.tar.gz +https://github.com/hashicorp/raft/archive/a8065f298505708bf60f518c09178149f3c06f21.tar.gz -> raft-a8065f298505708bf60f518c09178149f3c06f21.tar.gz +https://github.com/hashicorp/raft-boltdb/archive/d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee.tar.gz -> raft-boltdb-d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee.tar.gz +https://github.com/hashicorp/raft-mdb/archive/4ec3694ffbc74d34f7532e70ef2e9c3546a0c0b0.tar.gz -> raft-mdb-4ec3694ffbc74d34f7532e70ef2e9c3546a0c0b0.tar.gz +https://github.com/hashicorp/scada-client/archive/c26580cfe35393f6f4bf1b9ba55e6afe33176bae.tar.gz -> scada-client-c26580cfe35393f6f4bf1b9ba55e6afe33176bae.tar.gz +https://github.com/hashicorp/serf/archive/558a6876882b2c5c61df29fd3990fb1765fd71d3.tar.gz -> serf-558a6876882b2c5c61df29fd3990fb1765fd71d3.tar.gz +https://github.com/hashicorp/yamux/archive/b2e55852ddaf823a85c67f798080eb7d08acd71d.tar.gz -> yamux-b2e55852ddaf823a85c67f798080eb7d08acd71d.tar.gz +https://github.com/inconshreveable/muxado/archive/f693c7e88ba316d1a0ae3e205e22a01aa3ec2848.tar.gz -> muxado-f693c7e88ba316d1a0ae3e205e22a01aa3ec2848.tar.gz +https://github.com/miekg/dns/archive/bb1103f648f811d2018d4bedcb2d4b2bce34a0f1.tar.gz -> dns-bb1103f648f811d2018d4bedcb2d4b2bce34a0f1.tar.gz +https://github.com/mitchellh/cli/archive/6cc8bc522243675a2882b81662b0b0d2e04b99c9.tar.gz -> cli-6cc8bc522243675a2882b81662b0b0d2e04b99c9.tar.gz +https://github.com/mitchellh/mapstructure/archive/442e588f213303bec7936deba67901f8fc8f18b1.tar.gz -> mapstructure-442e588f213303bec7936deba67901f8fc8f18b1.tar.gz +https://github.com/ryanuber/columnize/archive/44cb4788b2ec3c3d158dd3d1b50aba7d66f4b59a.tar.gz -> columnize-44cb4788b2ec3c3d158dd3d1b50aba7d66f4b59a.tar.gz" + +STRIP_MASK="*.a" +S="${WORKDIR}/src/${GO_PN}" + +pkg_setup() { + enewgroup consul + enewuser consul -1 -1 /var/lib/${PN} consul +} + +get_archive_go_package() { + local archive=${1} uri x + for x in ${SRC_URI}; do + if [[ ${x} == http* ]]; then + uri=${x} + elif [[ ${x} == ${archive} ]]; then + break + fi + done + uri=${uri#https://} + echo ${uri%/archive/*} +} + +unpack_go_packages() { + local go_package x + # Unpack packages to appropriate locations for GOPATH + for x in ${A}; do + unpack ${x} + if [[ ${x} == *.tar.gz ]]; then + go_package=$(get_archive_go_package ${x}) + mkdir -p src/${go_package%/*} + mv ${go_package##*/}-* src/${go_package} || die + fi + done +} + +src_unpack() { + unpack_go_packages + # Create a writable GOROOT in order to avoid sandbox violations + # or other interference from installed instances. + export GOPATH="${WORKDIR}" GOROOT="${WORKDIR}/goroot" + cp -sR "${EPREFIX}"/usr/lib/go "${GOROOT}" || die + while read -r path; do + rm -rf "${GOROOT}/src/${path#${WORKDIR}/src}" \ + "${GOROOT}/pkg/linux_${ARCH}/${path#${WORKDIR}/src}" || die + done < <(find "${WORKDIR}"/src -maxdepth 3 -mindepth 3 -type d) +} + +src_prepare() { + # Avoid the need to have a git checkout + sed -e 's:^GIT.*::' \ + -e 's:-X main.GitCommit.*:" \\:' \ + -i scripts/build.sh || die + + # Disable tests that fail under network-sandbox + sed -e 's:TestServer_StartStop:_TestServer_StartStop:' \ + -i consul/server_test.go || die + sed -e 's:TestRetryJoin(:_TestRetryJoin(:' \ + -i command/agent/command_test.go || die +} + +src_compile() { + emake + + if use web; then + pushd ui >/dev/null || die + emake dist + fi +} + +src_install() { + local x + + dobin bin/* + rm -rf bin + + keepdir /etc/consul.d + insinto /etc/consul.d + doins "${FILESDIR}/"*.json.example + + for x in /var/{lib,log}/${PN}; do + keepdir "${x}" + fowners consul:consul "${x}" + done + + if use web; then + insinto /var/lib/${PN}/ui + doins -r ui/dist/* + fi + + newinitd "${FILESDIR}/consul.initd" "${PN}" + newconfd "${FILESDIR}/consul.confd" "${PN}" + systemd_dounit "${FILESDIR}/consul.service" + + insinto /usr/lib/go + find "${WORKDIR}"/{pkg,src} -name '.git*' -exec rm -rf {} \; 2>/dev/null + doins -r "${WORKDIR}"/{pkg,src} +} diff --git a/app-admin/consul/consul-9999.ebuild b/app-admin/consul/consul-9999.ebuild new file mode 100644 index 000000000000..be4fa50fec23 --- /dev/null +++ b/app-admin/consul/consul-9999.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/consul/consul-9999.ebuild,v 1.1 2015/05/24 07:59:56 zmedico Exp $ + +EAPI=5 + +inherit git-r3 systemd user + +KEYWORDS="" +DESCRIPTION="A tool for service discovery, monitoring and configuration" +HOMEPAGE="http://www.consul.io" +GO_PN="github.com/hashicorp/consul" +EGIT_REPO_URI="git://${GO_PN}.git" +LICENSE="MPL-2.0" +SLOT="0" +IUSE="test web" + +DEPEND=">=dev-lang/go-1.4 + dev-go/go-crypto + test? ( dev-go/go-tools ) + web? ( + dev-ruby/sass + dev-ruby/uglifier + )" +RDEPEND=">=dev-lang/go-1.4" +SRC_URI="" + +STRIP_MASK="*.a" +S="${WORKDIR}/src/${GO_PN}" +EGIT_CHECKOUT_DIR="${S}" + +pkg_setup() { + enewgroup consul + enewuser consul -1 -1 /var/lib/${PN} consul +} + +src_unpack() { + git-r3_src_unpack + cd "${S}" || die + + # Create a writable GOROOT in order to avoid sandbox violations + # or other interference from installed instances. + export GOPATH="${WORKDIR}" GOROOT="${WORKDIR}/goroot" + cp -sR "${EPREFIX}"/usr/lib/go "${GOROOT}" || die + + # Use latest versions of some packages, in case of incompatible + # API changes + rm -rf "${GOROOT}/src/${GO_PN%/*}" \ + "${GOROOT}/pkg/linux_${ARCH}/${GO_PN%/*}" || die + + # Fetch dependencies + emake deps + + # Avoid interference from installed instances + while read -r path; do + rm -rf "${GOROOT}/src/${path#${WORKDIR}/src}" \ + "${GOROOT}/pkg/linux_${ARCH}/${path#${WORKDIR}/src}" || die + done < <(find "${WORKDIR}"/src -maxdepth 3 -mindepth 3 -type d) +} + +src_prepare() { + # Disable tests that fail under network-sandbox + sed -e 's:TestServer_StartStop:_TestServer_StartStop:' \ + -i consul/server_test.go || die + sed -e 's:TestRetryJoin(:_TestRetryJoin(:' \ + -i command/agent/command_test.go || die +} + +src_compile() { + emake + + if use web; then + pushd ui >/dev/null || die + emake dist + fi +} + +src_install() { + local x + + dobin bin/* + rm -rf bin + + keepdir /etc/consul.d + insinto /etc/consul.d + doins "${FILESDIR}/"*.json.example + + for x in /var/{lib,log}/${PN}; do + keepdir "${x}" + fowners consul:consul "${x}" + done + + if use web; then + insinto /var/lib/${PN}/ui + doins -r ui/dist/* + fi + + newinitd "${FILESDIR}/consul.initd" "${PN}" + newconfd "${FILESDIR}/consul.confd" "${PN}" + systemd_dounit "${FILESDIR}/consul.service" + + insinto /usr/lib/go + find "${WORKDIR}"/{pkg,src} -name '.git*' -exec rm -rf {} \; 2>/dev/null + doins -r "${WORKDIR}"/{pkg,src} +} diff --git a/app-admin/consul/files/bootstrap.json.example b/app-admin/consul/files/bootstrap.json.example new file mode 100644 index 000000000000..b7d573c0d2b3 --- /dev/null +++ b/app-admin/consul/files/bootstrap.json.example @@ -0,0 +1,4 @@ +{ + "server": true, + "bootstrap_expect": 1 +} diff --git a/app-admin/consul/files/consul.confd b/app-admin/consul/files/consul.confd new file mode 100644 index 000000000000..b15e19c77013 --- /dev/null +++ b/app-admin/consul/files/consul.confd @@ -0,0 +1,10 @@ +# you can change the init script behavior by setting those parameters +# - group (default: consul) +# - pidfile (default: /run/consul/consul.pid) +# - user (default: consul) + +# extra arguments for the consul agent +command_args="-config-dir=/etc/consul.d" + +# upstream strongly recommends > 1 +GOMAXPROCS=2 diff --git a/app-admin/consul/files/consul.initd b/app-admin/consul/files/consul.initd new file mode 100644 index 000000000000..67f3659912e8 --- /dev/null +++ b/app-admin/consul/files/consul.initd @@ -0,0 +1,40 @@ +#!/sbin/openrc-run +# Copyright 2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/app-admin/consul/files/consul.initd,v 1.1 2015/05/24 07:59:56 zmedico Exp $ + +description="consul agent" +extra_started_commands="reload" +export GOMAXPROCS=${GOMAXPROCS:-2} +group=${group:-${SVCNAME}} +pidfile=${pidfile:-"/run/${SVCNAME}/${SVCNAME}.pid"} +user=${user:-${SVCNAME}} + +command="/usr/bin/${SVCNAME}" +command_args="agent -config-dir=/etc/consul.d ${command_args}" +command_background="true" +start_stop_daemon_args="--user ${user} --group ${group} \ + --stdout /var/log/${SVCNAME}/${SVCNAME}.log \ + --stderr /var/log/${SVCNAME}/${SVCNAME}.log" + +depend() { + need net + after net +} + +reload() { + ebegin "Reloading ${SVCNAME}" + ${command} reload + eend $? +} + +start_pre() { + checkpath -d -m 0755 -o "${user}":"${group}" "${pidfile%/*}" +} + +stop() { + # SIGINT is required for graceful shutdown of consul agent + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --signal SIGINT --pidfile "${pidfile}" + eend $? +} diff --git a/app-admin/consul/files/consul.service b/app-admin/consul/files/consul.service new file mode 100644 index 000000000000..496fe4814789 --- /dev/null +++ b/app-admin/consul/files/consul.service @@ -0,0 +1,16 @@ +[Unit] +Description=consul agent +Requires=network-online.target +After=network-online.target + +[Service] +User=consul +Environment=GOMAXPROCS=2 +Environment=CONSUL_AGENT_OPTS="-config-dir=/etc/consul.d" +ExecStart=/usr/bin/consul agent $CONSUL_AGENT_OPTS +Restart=on-failure +KillSignal=SIGINT +ExecReload=/usr/bin/consul reload + +[Install] +WantedBy=default.target diff --git a/app-admin/consul/files/data-dir.json.example b/app-admin/consul/files/data-dir.json.example new file mode 100644 index 000000000000..af162113af62 --- /dev/null +++ b/app-admin/consul/files/data-dir.json.example @@ -0,0 +1,3 @@ +{ + "data_dir": "/var/lib/consul" +} diff --git a/app-admin/consul/files/ui-dir.json.example b/app-admin/consul/files/ui-dir.json.example new file mode 100644 index 000000000000..e5cf7464b123 --- /dev/null +++ b/app-admin/consul/files/ui-dir.json.example @@ -0,0 +1,3 @@ +{ + "ui_dir": "/var/lib/consul/ui" +} diff --git a/app-admin/consul/metadata.xml b/app-admin/consul/metadata.xml new file mode 100644 index 000000000000..00ccb4e3b239 --- /dev/null +++ b/app-admin/consul/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>zmedico@gentoo.org</email> + </maintainer> + <use> + <flag name="web">Build the web UI.</flag> + </use> +</pkgmetadata> |