Commit c05fd028 authored by Carlo Landmeter's avatar Carlo Landmeter
Browse files

testing/consul: new aport

APKBUILD provided by Olivier Mauras <olivier@mauras.ch>
parent 15a3137a
# Contributor: Olivier Mauras <olivier@mauras.ch>
# Maintainer:
pkgname=consul
pkgver=0.5.0
pkgrel=0
pkgdesc="A tool for service discovery, monitoring and configuration"
url="https://www.consul.io/"
arch="all"
license="MPL 2.0"
depends=""
depends_dev=""
makedepends="go godep perl bash mercurial $depends_dev"
install="$pkgname.pre-install $pkgname.pre-deinstall $pkgname.post-deinstall"
pkgusers="consul"
pkggroups="consul"
subpackages=""
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.gz
v${pkgver//./-}.json
consul.initd
consul.confd
acl.json.sample
encrypt.json.sample
server.json
tls.json.sample"
_disturl="dev.alpinelinux.org:/archive/$pkgname/"
_gourl="github.com/hashicorp/consul"
_builddir="$srcdir"/src/github.com/hashicorp
snapshot() {
abuild clean
abuild deps
abuild fetch
export GOPATH="$srcdir"
mkdir -p $_builddir
cd $_builddir
msg "Checking out v${pkgver} tag"
git clone -q --branch v${pkgver} https://$_gourl || return 1
cd $pkgname
# use custom godeps file
install -D "$srcdir"/v${pkgver//./-}.json \
$_builddir/$pkgname/Godeps/Godeps.json || return 1
go get -v -d || return 1
godep restore
cd "$srcdir"
tar zcf $pkgname-$pkgver.tar.gz src || return 1
rsync --progress -La $pkgname-$pkgver.tar.gz \
$_disturl || return 1
cd $startdir && abuild undeps
}
prepare() {
cd "$srcdir"/${pkgname}-${pkgver}
local i
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
cd "$_builddir"/$pkgname || return 1
export GOPATH="$srcdir"
go build -v -o bin/consul \
-ldflags "-X main.GitDescribe $pkgver" || return 1
}
package() {
cd "$_builddir"
# Consul init script
install -m755 -D "$srcdir"/$pkgname.initd \
"$pkgdir"/etc/init.d/$pkgname || return 1
# Consul init conf
install -m644 -D "$srcdir"/$pkgname.confd \
"$pkgdir"/etc/conf.d/$pkgname || return 1
# Main binary
install -m750 -o root -g consul \
-D ${pkgname}/bin/${pkgname} \
"$pkgdir"/usr/sbin/${pkgname} || return 1
# Consul datadir
install -m750 -o consul -g consul -d "$pkgdir"/var/${pkgname} || return 1
# Consul configdir
install -m750 -o root -g consul -d "$pkgdir"/etc/${pkgname} || return 1
# Consul sample config files
for cf in acl.json.sample encrypt.json.sample server.json tls.json.sample; do
install -m640 -o root -g consul "$srcdir"/$cf "$pkgdir"/etc/${pkgname} || return 1
done
}
md5sums="14f03d1b12e0153a0df2a4becad6516f consul-0.5.0.tar.gz
5594031fcbe1accb446ddb2a94a15e20 v0-5-0.json
34adfd50f993e57f5941d77963a23eef consul.initd
9873f8d9a30f788eda9298e89366a1c9 consul.confd
3ecdfa3d217bf8517a2b025da321811d acl.json.sample
3cfcc6f98d15ce3f3ac7021657786ab6 encrypt.json.sample
75a654690d6096987d52796a6e01e405 server.json
f16f70961c3297b54affc6f2c615873a tls.json.sample"
sha256sums="fff18f7f624b393d96e9898afa5dd32501c09cf3a9e701ad9452fd6d972009e2 consul-0.5.0.tar.gz
3e4e5ebadb7076e967f6dc68eb4b5a3c8b5fb03db2c4da5f95be4f8480b3b5c6 v0-5-0.json
f6caf13d0797f1cdc3d861e3417baa4e4fc3e8beaf5698b278ce514b3af5edac consul.initd
888aaaee84b3d8431526960becfdb123eaf438ae10fa58f59b5520ae0c0d0830 consul.confd
40b230f47a5a52eac87cfea4cdda99125a2136630bdf49d22af0df814201f313 acl.json.sample
927f9b480d4593a9d3dfe5e3e047e30fddc954a83157517135db3f60e7596a6f encrypt.json.sample
1058636fbbe66890c8a04a264f1200572202b205976aa562b07fe86f4faab89f server.json
b10bd00587a8ed56284e1c0bc9f1bdc6d556986320113ddf4e118042dc39cd2d tls.json.sample"
sha512sums="1f30c93899e05086edd1f40f8d23c175f6f4340a8ac79e9451772638bb01c1e8ba918b94bca3261e5e6327c83e51e06125b7717249323a91394a42b4863969fe consul-0.5.0.tar.gz
179eb44a60d6af9404b224ad7d21d67be57fdab4ee753d6ee62ef15e7febf5c2b4d7fa5e21fb718e500bbb63c40c31478dcbc7fb129c0312658e6b04e05106ca v0-5-0.json
8510cdd05c8fa8e856cbc3806d8851adfebf64f34d7736503e6516050df6c98537e0fe334a28dc8ce2278be87ab7e1c0e09f77f26848bb6fff70f28ff702218a consul.initd
f2c5af74dfcbca2fea8ebea31139d93f44455b93ef17ec611b880d7071af4125615dbbd23969d0d04ca636c26d7b4e7eb97f1266baa89252097f4cbc5173d817 consul.confd
d4310dde63d3b8fc4791124bd255bf2a1402b86d00f6b1732e18b0caedb75eae6c77382e1a48f12469828ef4bb363db4580fb1aafa63fcdc97b1431f6ea96d58 acl.json.sample
ec30ad73c13f9dd5ba15389567436dbf74c24e822cb959c6ccc40a35e36e212313c70f3cf1ccee3f63a7bb98760173d6c2478161a25b85e14dd889a47572aff1 encrypt.json.sample
a8b984db03f0bfb652d541dbdd3f1bc9be22f16cce78f73e495cc54adea1e09e9ac0e2f306ca8436590433c80a2ef824641f790b30aea9acb806b01fcabc918e server.json
7582f1845a742cf570db5aa52077eb4c4cbfe68ee2ae9569cc2806444217eba0ee960a3a52f3edd1a7c36ca8b7811df5cab6dd062b060ab43ed57b8c811c85de tls.json.sample"
# Sample locked down default ACL policy
# Use uuidgen to generate a master_token - Accepts any string format
#{
# "acl_datacenter": "dc1",
# "acl_master_token": "35629809-57c6-4ef5-a807-b3a23394d57d",
# "acl_default_policy": "deny",
# "acl_down_policy": "deny"
#}
# Consul startup
consul_opts="agent -config-dir=/etc/consul"
#!/sbin/runscript
name=consul
daemon=/usr/sbin/$name
daemon_user=$name
daemon_group=$name
depend() {
need net
after firewall
}
start() {
ebegin "Starting ${name}"
start-stop-daemon --start --quiet \
-m --pidfile /var/run/${name}.pid \
--user ${daemon_user} --group ${daemon_group} \
-b -1 /dev/null -2 /dev/null \
-k 027 --exec ${daemon} -- ${consul_opts}
eend $?
}
stop() {
ebegin "Stopping ${name}"
start-stop-daemon --stop --quiet \
--pidfile /var/run/${name}.pid \
--exec ${daemon}
eend $?
}
#!/bin/sh
# Delete consul group and user
delgroup consul 2> /dev/null
deluser consul 2> /dev/null
exit 0
#!/bin/sh
# Stop consul service
rc-service consul stop &> /dev/null
exit 0
#!/bin/sh
# Create consul group and user
addgroup -S consul 2> /dev/null
adduser -h /var/consul -s /sbin/nologin -G consul -S -D consul 2> /dev/null
exit 0
# Enable gossip message encryption
# Use 'consul keygen' to generate a new one
#{
# "encrypt": "HnAKJceZzkkqiHBkP52iEQ=="
#}
{
"data_dir": "/var/consul",
"server": true,
"bootstrap_expect": 1,
"disable_update_check": true,
"disable_remote_exec": true,
"enable_syslog": true
}
# Enable RPC encryption with TLS
#{
# "ca_file": "/etc/consul/ssl/ca_cert.pem",
# "cert_file": "/etc/consul/ssl/server.pem",
# "key_file": "/etc/consul/ssl/server.key",
# "verify_incoming": true,
# "verify_outgoing": true
#}
{
"ImportPath": "github.com/hashicorp/consul",
"GoVersion": "go1.4.2",
"Deps": [
{
"ImportPath": "github.com/armon/circbuf",
"Rev": "f092b4f207b6e5cce0569056fba9e1a2735cb6cf"
},
{
"ImportPath": "github.com/armon/go-metrics",
"Rev": "88b7658f24511c4b885942b26e9ea7a61ee37ebc"
},
{
"ImportPath": "github.com/armon/go-radix",
"Rev": "e39d623f12e8e41c7b5529e9a9dd67a1e2261f80"
},
{
"ImportPath": "github.com/armon/gomdb",
"Rev": "151f2e08ef45cb0e57d694b2562f351955dff572"
},
{
"ImportPath": "github.com/golang/protobuf/proto",
"Rev": "5677a0e3d5e89854c9974e1256839ee23f8233ca"
},
{
"ImportPath": "github.com/hashicorp/go-checkpoint",
"Rev": "88326f6851319068e7b34981032128c0b1a6524d"
},
{
"ImportPath": "github.com/hashicorp/go-msgpack/codec",
"Rev": "71c2886f5a673a35f909803f38ece5810165097b"
},
{
"ImportPath": "github.com/hashicorp/go-multierror",
"Rev": "fcdddc395df1ddf4247c69bd436e84cfa0733f7e"
},
{
"ImportPath": "github.com/hashicorp/go-syslog",
"Rev": "42a2b573b664dbf281bd48c3cc12c086b17a39ba"
},
{
"ImportPath": "github.com/hashicorp/golang-lru",
"Rev": "f09f965649501e2ac1b0c310c632a7bebdbdc1d4"
},
{
"ImportPath": "github.com/hashicorp/hcl",
"Rev": "513e04c400ee2e81e97f5e011c08fb42c6f69b84"
},
{
"ImportPath": "github.com/hashicorp/logutils",
"Rev": "23b0af5510a2d1442103ef83ffcf53eb82f3debc"
},
{
"ImportPath": "github.com/hashicorp/memberlist",
"Rev": "9a1e242e454d2443df330bdd51a436d5a9058fc4"
},
{
"ImportPath": "github.com/hashicorp/net-rpc-msgpackrpc",
"Rev": "d377902b7aba83dd3895837b902f6cf3f71edcb2"
},
{
"ImportPath": "github.com/hashicorp/raft",
"Rev": "a88bfa8385bc52c1f25d0fc02d1b55a2708d04ab"
},
{
"ImportPath": "github.com/hashicorp/raft-mdb",
"Rev": "4ec3694ffbc74d34f7532e70ef2e9c3546a0c0b0"
},
{
"ImportPath": "github.com/hashicorp/scada-client",
"Rev": "c26580cfe35393f6f4bf1b9ba55e6afe33176bae"
},
{
"ImportPath": "github.com/hashicorp/serf/serf",
"Comment": "v0.6.4-3-gcc95df9",
"Rev": "cc95df950d69acfd117128c98a3bc6b64c1da3fd"
},
{
"ImportPath": "github.com/hashicorp/yamux",
"Rev": "b4f943b3f25da97dec8e26bee1c3269019de070d"
},
{
"ImportPath": "github.com/inconshreveable/muxado",
"Rev": "f693c7e88ba316d1a0ae3e205e22a01aa3ec2848"
},
{
"ImportPath": "github.com/matttproud/golang_protobuf_extensions/ext",
"Rev": "ba7d65ac66e9da93a714ca18f6d1bc7a0c09100c"
},
{
"ImportPath": "github.com/miekg/dns",
"Rev": "64fea017a260b4ccbfbb3f60ab027e0398cd8f6f"
},
{
"ImportPath": "github.com/mitchellh/cli",
"Rev": "e3c2e3d39391e9beb9660ccd6b4bd9a2f38dd8a0"
},
{
"ImportPath": "github.com/mitchellh/mapstructure",
"Rev": "442e588f213303bec7936deba67901f8fc8f18b1"
},
{
"ImportPath": "github.com/prometheus/client_golang/model",
"Comment": "0.1.0-33-g38dbb2e",
"Rev": "38dbb2e26868d15db0275ddbaac0cbe450ec03de"
},
{
"ImportPath": "github.com/prometheus/client_golang/prometheus",
"Comment": "0.1.0-33-g38dbb2e",
"Rev": "38dbb2e26868d15db0275ddbaac0cbe450ec03de"
},
{
"ImportPath": "github.com/prometheus/client_golang/text",
"Comment": "0.1.0-33-g38dbb2e",
"Rev": "38dbb2e26868d15db0275ddbaac0cbe450ec03de"
},
{
"ImportPath": "github.com/prometheus/client_model/go",
"Comment": "model-0.0.2-12-gfa8ad6f",
"Rev": "fa8ad6fec33561be4280a8f0514318c79d7f6cb6"
},
{
"ImportPath": "github.com/prometheus/procfs",
"Rev": "92faa308558161acab0ada1db048e9996ecec160"
},
{
"ImportPath": "github.com/ryanuber/columnize",
"Comment": "v2.0.1-6-g44cb478",
"Rev": "44cb4788b2ec3c3d158dd3d1b50aba7d66f4b59a"
}
]
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment