diff options
author | Konstantin Kulikov <k.kulikov2@gmail.com> | 2019-10-03 02:07:45 +0300 |
---|---|---|
committer | Rasmus Thomsen <oss@cogitri.dev> | 2019-10-06 14:46:39 +0200 |
commit | 23f7f9e00081512b740df0074318a51ab6c49c77 (patch) | |
tree | 2565221dd4fceb71bbb4b9b9fa4e0409130a87b6 | |
parent | aee8405c7da1a99988768ce4e15a57bfd5741d64 (diff) | |
download | aports-23f7f9e00081512b740df0074318a51ab6c49c77.tar.bz2 aports-23f7f9e00081512b740df0074318a51ab6c49c77.tar.xz |
testing/grafana-image-renderer: new aport
5 files changed, 96 insertions, 0 deletions
diff --git a/testing/grafana-image-renderer/10-host-param.patch b/testing/grafana-image-renderer/10-host-param.patch new file mode 100644 index 0000000000..b4d3b7abbc --- /dev/null +++ b/testing/grafana-image-renderer/10-host-param.patch @@ -0,0 +1,31 @@ +https://github.com/grafana/grafana-image-renderer/pull/40 + +diff --git a/src/app.ts b/src/app.ts +index fffcd3d..b5b58f6 100644 +--- a/src/app.ts ++++ b/src/app.ts +@@ -22,7 +22,7 @@ async function main() { + + const logger = new ConsoleLogger(); + const browser = new Browser(logger); +- const server = new HttpServer({port: argv.port}, logger, browser); ++ const server = new HttpServer({port: argv.port, host: argv.host}, logger, browser); + + server.start(); + +diff --git a/src/http-server.ts b/src/http-server.ts +index 1aa875d..018bf6c 100644 +--- a/src/http-server.ts ++++ b/src/http-server.ts +@@ -26,8 +26,9 @@ export class HttpServer { + return res.status(err.output.statusCode).json(err.output.payload); + }); + +- this.app.listen(this.options.port); +- this.log.info(`HTTP Server started, listening on ${this.options.port}`); ++ this.app.listen(this.options.port, this.options.host); ++ const hostlabel = this.options.host ? this.options.host : ''; ++ this.log.info(`HTTP Server started, listening on ${hostlabel}:${this.options.port}`); + } + + render = async (req: express.Request, res: express.Response) => { diff --git a/testing/grafana-image-renderer/APKBUILD b/testing/grafana-image-renderer/APKBUILD new file mode 100644 index 0000000000..16e7ed1440 --- /dev/null +++ b/testing/grafana-image-renderer/APKBUILD @@ -0,0 +1,39 @@ +# Contributor: Konstantin Kulikov <k.kulikov2@gmail.com> +# Maintainer: Konstantin Kulikov <k.kulikov2@gmail.com> +pkgname=grafana-image-renderer +pkgver=1.0.5 +pkgrel=0 +pkgdesc="Grafana Backend Plugin that handles rendering of panels & dashboards to PNGs using headless chrome" +url="https://github.com/grafana/grafana-image-renderer" +arch="x86_64" # Same as grafana. +license="Apache-2.0" +makedepends="yarn" +depends="nodejs ttf-opensans chromium ca-certificates" +options="!check" # Has no test suite. +install="$pkgname.pre-install" +subpackages="$pkgname-openrc" +source="$pkgname-$pkgver.tar.gz::https://github.com/grafana/grafana-image-renderer/archive/v$pkgver.tar.gz + $pkgname.initd $pkgname.confd 10-host-param.patch" + +build() { + export CHROME_BIN="/usr/bin/chromium-browser" + export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true" + + # Don't pollute our aports repo with husky git hooks. + # This command also acts as implicit "yarn install". + yarn remove --pure-lockfile -W husky + + yarn build +} + +package() { + install -Dm755 "$srcdir/$pkgname.initd" "$pkgdir/etc/init.d/$pkgname" + install -Dm644 "$srcdir/$pkgname.confd" "$pkgdir/etc/conf.d/$pkgname" + install -dm755 "$pkgdir/usr/share/$pkgname" + cp -r "$builddir/node_modules" "$builddir/build" "$builddir/proto" "$pkgdir/usr/share/$pkgname/" +} + +sha512sums="44460e19b4225c27166d0f88a7bd73b12d85a38ff6057b82c66b0874d33ad436f6ea0245f138583efb72d3aa9073362907f873d3df06650cf6e21a4e07daaad8 grafana-image-renderer-1.0.5.tar.gz +2b2b7952153419d8593b058cb9994f88e4191fcc58893c33d15592b0cac02d2859c9ebbdeb34e6365bd0633eee19393a274535679d32ffa220e375114f4915fc grafana-image-renderer.initd +ee4fd884d39eb556ffebeb3bc8fc66295d660e94f0a1d58dea57745da967f62216096e481e417cecaf8a51c4181dff4f4586b70cfc2ee7dbad622a6b28735ad0 grafana-image-renderer.confd +824b41f1a86ea97fdf4c9c34e8171a948ec07c03fa030f37614464f8d4b96984d3d49bf5579584216a5a86b7fa321e281b35d67ffdbfc4c83ee943af35d96dc1 10-host-param.patch" diff --git a/testing/grafana-image-renderer/grafana-image-renderer.confd b/testing/grafana-image-renderer/grafana-image-renderer.confd new file mode 100644 index 0000000000..7b98c2c512 --- /dev/null +++ b/testing/grafana-image-renderer/grafana-image-renderer.confd @@ -0,0 +1 @@ +GRAFANA_IR_OPTS="--port=3001 --host=127.0.0.1" diff --git a/testing/grafana-image-renderer/grafana-image-renderer.initd b/testing/grafana-image-renderer/grafana-image-renderer.initd new file mode 100644 index 0000000000..76bec4e19e --- /dev/null +++ b/testing/grafana-image-renderer/grafana-image-renderer.initd @@ -0,0 +1,17 @@ +#!/sbin/openrc-run + +supervisor=supervise-daemon + +name="Grafana image renderer" +description="Grafana Backend Plugin that handles rendering of panels & dashboards to PNGs using headless chrome" + +command="/usr/bin/node" +command_args="build/app.js server $GRAFANA_IR_OPTS" +command_user=grafanair:grafanair +directory=/usr/share/grafana-image-renderer +supervise_daemon_args="-e CHROME_BIN=/usr/bin/chromium-browser" + +depend() { + need net + after firewall +} diff --git a/testing/grafana-image-renderer/grafana-image-renderer.pre-install b/testing/grafana-image-renderer/grafana-image-renderer.pre-install new file mode 100644 index 0000000000..4403c3bb7f --- /dev/null +++ b/testing/grafana-image-renderer/grafana-image-renderer.pre-install @@ -0,0 +1,8 @@ +#!/bin/sh + +name=grafanair + +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 |