diff options
author | Konstantin Kulikov <k.kulikov2@gmail.com> | 2019-08-02 18:43:05 +0000 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2019-08-11 21:41:26 -0300 |
commit | e28d2e1f07e57e163b15dba7de2efc372cc06c5a (patch) | |
tree | e933a94ecb3383a2b09813620abc37324ec3ac19 /testing | |
parent | 292c4bf77ed44d27e54df201fa5b89867888ca4e (diff) | |
download | aports-e28d2e1f07e57e163b15dba7de2efc372cc06c5a.tar.bz2 aports-e28d2e1f07e57e163b15dba7de2efc372cc06c5a.tar.xz |
testing/grafana: new aport
Diffstat (limited to 'testing')
-rw-r--r-- | testing/grafana/APKBUILD | 56 | ||||
-rw-r--r-- | testing/grafana/grafana.confd | 7 | ||||
-rw-r--r-- | testing/grafana/grafana.initd | 20 | ||||
-rw-r--r-- | testing/grafana/grafana.pre-install | 8 | ||||
-rw-r--r-- | testing/grafana/phantomjs | 5 |
5 files changed, 96 insertions, 0 deletions
diff --git a/testing/grafana/APKBUILD b/testing/grafana/APKBUILD new file mode 100644 index 0000000000..b9b5a0dbb6 --- /dev/null +++ b/testing/grafana/APKBUILD @@ -0,0 +1,56 @@ +# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com> +# Maintainer: Konstantin Kulikov <k.kulikov2@gmail.com> +pkgname=grafana +pkgver=6.3.0 +pkgrel=0 +_commit=830da0fda # git rev-parse --short HEAD +_stamp=1565095768 # git --no-pager show -s --format=%ct +pkgdesc="Open source, feature rich metrics dashboard and graph editor" +url="https://grafana.com" +arch="x86_64" # Builds are slow on arm archs, x86 requires python2. +license="Apache-2.0" +makedepends="go nodejs yarn" +install="$pkgname.pre-install" +subpackages="$pkgname-openrc" +source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/$pkgname/archive/v$pkgver.tar.gz + grafana.initd + grafana.confd + phantomjs + " + +export GOFLAGS="-mod=vendor" +export GOPATH="$srcdir/go" +export GOCACHE="$srcdir/gocache" + +build() { + # Don't pollute our git repo with grafanas commit hooks. + # Also don't try to install phantomjs since it depends on glibc. + # This command also acts as "yarn install". + yarn remove husky phantomjs-prebuilt --pure-lockfile -W + + yarn build --phjsToRelease "$srcdir/phantomjs" --force + + local ldflags="-X main.version=$pkgver -X main.commit=$_commit -X main.buildstamp=$_stamp" + go build -ldflags "$ldflags" ./pkg/cmd/grafana-server + go build -ldflags "$ldflags" ./pkg/cmd/grafana-cli +} + +check() { + go test ./pkg/... +} + +package() { + install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname" + install -Dm644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname" + install -Dm755 "$builddir/$pkgname-server" "$pkgdir/usr/sbin/$pkgname-server" + install -Dm755 "$builddir/$pkgname-cli" "$pkgdir/usr/bin/$pkgname-cli" + install -Dm644 "$builddir/conf/sample.ini" "$pkgdir/etc/grafana.ini" + install -dm755 "$pkgdir/usr/share/grafana" + cp -r "$builddir/conf" "$builddir/public" "$builddir/tools" "$pkgdir/usr/share/grafana/" + install -Dm755 "$srcdir/phantomjs" "$pkgdir/usr/share/grafana/tools/phantomjs/phantomjs" +} + +sha512sums="d1af9c662011ba667465cde456daed42786269c41a0d2233bf9758da56d0ecbe8b4a7433e55d87f85a419da26b5d15b1f2df57c565333f7b79fc6a3863f6edc6 grafana-6.3.0.tar.gz +1d051e673c2904faf232f7cae790e69396504bddef3d8b7c892879eaf1a5906a566bb539d42f4d44b738dfa8eb37069a84b684c31cb93eb8d21e82a371ce1417 grafana.initd +00bbd8e650c3dac7c3e92d7fbeb99265f4ef5f5a70876d551173eb2bfc8732f8d9c4e03ed5fb776e1e2e58a5e9778a09cc551e5a30b9c73b9f4051393fd10f4b grafana.confd +740df131d7e8897b30c53140e170c9a5a1d84d422d8ae395b244bb525d4416c4e5acae2c6e1c2baf2710fe8e7067f849fc2986f567640afef0f28a694f560f86 phantomjs" diff --git a/testing/grafana/grafana.confd b/testing/grafana/grafana.confd new file mode 100644 index 0000000000..799aef5466 --- /dev/null +++ b/testing/grafana/grafana.confd @@ -0,0 +1,7 @@ +GRAFANA_HOME=/var/lib/grafana +GRAFANA_OPTS="-config /etc/grafana.ini -homepath /usr/share/grafana \ +cfg:paths.data=$GRAFANA_HOME/data \ +cfg:paths.plugins=$GRAFANA_HOME/plugins \ +cfg:paths.provisioning=$GRAFANA_HOME/provisioning \ +cfg:server.http_addr=127.0.0.1 \ +cfg:log.mode=syslog" diff --git a/testing/grafana/grafana.initd b/testing/grafana/grafana.initd new file mode 100644 index 0000000000..a3458f9129 --- /dev/null +++ b/testing/grafana/grafana.initd @@ -0,0 +1,20 @@ +#!/sbin/openrc-run + +command="/usr/sbin/grafana-server" +command_args="$GRAFANA_OPTS" +command_background=yes +command_user=grafana:grafana +pidfile="/run/$RC_SVCNAME.pid" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath -d -o grafana:grafana -m755 $GRAFANA_HOME \ + $GRAFANA_HOME/provisioning \ + $GRAFANA_HOME/provisioning/dashboards \ + $GRAFANA_HOME/provisioning/datasources \ + $GRAFANA_HOME/provisioning/notifiers +} diff --git a/testing/grafana/grafana.pre-install b/testing/grafana/grafana.pre-install new file mode 100644 index 0000000000..fee2e76df9 --- /dev/null +++ b/testing/grafana/grafana.pre-install @@ -0,0 +1,8 @@ +#!/bin/sh + +name=grafana + +addgroup -S "$name" 2>/dev/null +adduser -S -D -H -h "/var/lib/$name" -s /sbin/nologin -G "$name" -g "$name" "$name" 2>/dev/null + +exit 0 diff --git a/testing/grafana/phantomjs b/testing/grafana/phantomjs new file mode 100644 index 0000000000..c8b5b4246f --- /dev/null +++ b/testing/grafana/phantomjs @@ -0,0 +1,5 @@ +#!/bin/sh + +echo 'Phantomjs not supported on alpine' >&2 +exit 1 + |