1
0
Fork 0

added build recipe

This commit is contained in:
Sangbum Kim 2016-07-04 14:43:22 +09:00
parent 9e3541c960
commit 23f13efc5d
4 changed files with 135 additions and 0 deletions

59
PKGBUILD Normal file
View File

@ -0,0 +1,59 @@
pkgname=gnatsd
pkgver=v0.8.1.r0.g86e883c
_pkgver=0.8.1
pkgrel=1
pkgdesc="Analyzes resource usage and performance characteristics of running containers."
depends=('glibc' 'bash')
makedepends=('go' 'rsync' 'godep')
arch=('x86_64' 'i686')
source=(
"$pkgname::git+https://github.com/nats-io/gnatsd.git#tag=v$_pkgver"
"gnatsd.service"
"gnatsd.install"
"gnatsd.conf"
)
url="http://nats.io/"
license=("APACHE")
install=gnatsd.install
sha512sums=('SKIP'
'0c4d71b35c00289e330e939a6500664aac066e654e7381c4a0d87d97ba595e635a5f5770e52197fec8ea8a29fcd2fad98a24deff80c3bdbedf6d927eeac96d26'
'c55320053e34b10b2d94627cec62242e58fcee72c8cc7eb6efa083b1bc26bedf4ce79efe3fa49bf9e1648c3a1a7b8e9d7bcfce08aa002dc7bfd6c719ad73b5b0'
'7eeef63f6b22a17a07cbc09b302996b12c5ab1e4a04d57e9358e8905374900375c899e9f05c0a845c4c071e3f546b5e831f3336f8cdb83cc8532ada19ac9e13b')
pkgver() {
cd "$srcdir/$pkgname"
git describe --long --tags | sed -r 's/^go//;s/([^-]*-g)/r\1/;s/-/./g'
}
prepare()
{
export GOPATH="${srcdir}/gopath"
export GOBIN="$GOPATH/bin"
mkdir -p $GOPATH/src/github.com/nats-io/
ln -sfT $srcdir/gnatsd $GOPATH/src/github.com/nats-io/gnatsd
}
build()
{
echo "Building gnatsd version=${pkgver} branch=$branch commit=${commit}..."
cd $GOPATH/src/github.com/nats-io/gnatsd
go build
}
package() {
cd $srcdir/gnatsd
_build_path="${srcdir}/${pkgname}"
mkdir -p "${pkgdir}/usr/bin"
install -pm 755 "${_build_path}/gnatsd" "${pkgdir}/usr/bin/gnatsd"
mkdir -p "${pkgdir}/usr/lib/systemd/system/"
install -pm 644 "${srcdir}/gnatsd.service" "${pkgdir}/usr/lib/systemd/system/gnatsd.service"
mkdir -p "${pkgdir}/etc/gnatsd/"
install -pm 644 "${srcdir}/gnatsd.conf" "${pkgdir}/etc/gnatsd/gnatsd.conf"
}

31
gnatsd.conf Normal file
View File

@ -0,0 +1,31 @@
# Sample config file
port: 4242
net: 0.0.0.0
#authorization {
# user: derek
# password: bella
# timeout: 1
#}
cluster {
host: 127.0.0.1
port: 4244
# authorization {
# user: route_user
# password: top_secret
# timeout: 1
# }
# Routes are actively solicited and connected to from this server.
# Other servers can connect to us if they supply the correct credentials
# in their routes definitions from above.
# routes = [
# nats-route://foo:bar@localhost:4245
# nats-route://foo:bar@localhost:4246
# ]
}

11
gnatsd.install Normal file
View File

@ -0,0 +1,11 @@
post_install() {
systemctl daemon-reload
}
post_upgrade() {
post_install
}
post_remove() {
systemctl daemon-reload
}

34
gnatsd.service Normal file
View File

@ -0,0 +1,34 @@
# Copyright 2016 Sangbum Kim / amuz.es
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[Unit]
Description=gnatsd
Documentation=http://nats.io
After=network.target
After=network-online.target
[Service]
User=nobody
Group=nobody
Type=simple
PIDFile=/var/run/gnatsd/gnatsd.pid
Restart=on-failure
RestartSec=10s
PermissionsStartOnly=true
ExecStartPre=-/usr/bin/mkdir -p /var/run/gnatsd
ExecStartPre=/usr/bin/chown -R nobody:nobody /var/run/gnatsd/
ExecStart=/usr/bin/gnatsd -s -P /var/run/gnatsd/gnatsd.pid -c /etc/gnatsd/gnatsd.conf $EXTRA
[Install]
WantedBy=multi-user.target