diff options
author | Tiago Ilieve <tiago.myhro@gmail.com> | 2019-01-25 14:56:07 +0100 |
---|---|---|
committer | Andy Postnikov <apostnikov@gmail.com> | 2019-01-27 04:42:12 +0200 |
commit | cbeabb778913c4f610bf6d7acae21464e3225414 (patch) | |
tree | be7dcc35cc6ab97d10ed3cabab4d478a7e5ace5c | |
parent | f2d584a17a087944ceb8f78a0c5e027d9e18f4ce (diff) | |
download | alpine_aports-cbeabb778913c4f610bf6d7acae21464e3225414.tar.bz2 alpine_aports-cbeabb778913c4f610bf6d7acae21464e3225414.tar.xz alpine_aports-cbeabb778913c4f610bf6d7acae21464e3225414.zip |
testing/prometheus-node-exporter: new aport
7 files changed, 142 insertions, 0 deletions
diff --git a/testing/prometheus-node-exporter/APKBUILD b/testing/prometheus-node-exporter/APKBUILD new file mode 100644 index 0000000000..5db3e3ad7f --- /dev/null +++ b/testing/prometheus-node-exporter/APKBUILD | |||
@@ -0,0 +1,46 @@ | |||
1 | # Contributor: Tiago Ilieve <tiago.myhro@gmail.com> | ||
2 | # Maintainer: Tiago Ilieve <tiago.myhro@gmail.com> | ||
3 | pkgname=prometheus-node-exporter | ||
4 | _pkgname=node_exporter | ||
5 | pkgver=0.17.0 | ||
6 | pkgrel=0 | ||
7 | pkgdesc="Prometheus exporter for machine metrics" | ||
8 | url="https://github.com/prometheus/node_exporter" | ||
9 | arch="all" | ||
10 | license="Apache-2.0" | ||
11 | makedepends="go>=1.11 bash sed" | ||
12 | install="$pkgname.pre-install $pkgname.pre-upgrade" | ||
13 | subpackages="$pkgname-openrc" | ||
14 | source="$_pkgname-$pkgver.tar.gz::https://github.com/prometheus/node_exporter/archive/v$pkgver.tar.gz | ||
15 | disable-go-race-detector.patch | ||
16 | fix-go-sum.patch | ||
17 | node-exporter.confd | ||
18 | node-exporter.initd" | ||
19 | builddir="$srcdir/$_pkgname-$pkgver" | ||
20 | |||
21 | build() { | ||
22 | cd "$builddir" | ||
23 | |||
24 | go build -v -ldflags "-s -w -X github.com/prometheus/common/version.Version=$pkgver" -o node_exporter | ||
25 | } | ||
26 | |||
27 | check() { | ||
28 | cd "$builddir" | ||
29 | |||
30 | make test | ||
31 | ./node_exporter --version | ||
32 | } | ||
33 | |||
34 | package() { | ||
35 | cd "$builddir" | ||
36 | |||
37 | install -Dm755 "$srcdir/node-exporter.confd" "$pkgdir"/etc/conf.d/node-exporter | ||
38 | install -Dm755 "$srcdir/node-exporter.initd" "$pkgdir"/etc/init.d/node-exporter | ||
39 | install -Dm755 ./node_exporter "$pkgdir"/usr/bin/node_exporter | ||
40 | } | ||
41 | |||
42 | sha512sums="8650fa24014f317b23cdbe2a6f12da0912ffc74cab815d1c94fdc0a3dc01ac1dff42a454af2ebbd4d402b7834d227bcf91ebdefa630ebe997cfd478e05ee01e5 node_exporter-0.17.0.tar.gz | ||
43 | 82511dfe2d4d12a10d6c367225066e23a52d6389d977ecad6ceb26567f67a69b427b52e58c403d89e6f8f2ebb88879002b2ef7280f675e188a64421947b21ea0 disable-go-race-detector.patch | ||
44 | 2bafe0433583f14d5e99502e11ac9a9ee75c99f8f466480e569b7ef15a95529f799a3c87348020df07ff8103a4bcc42d6f4274c842d44b97620d6d6337c2b541 fix-go-sum.patch | ||
45 | 592d3f17a3cf487d97a14c803dded07d2dfb112b159ab1a3575310fc0176fc3255ddad6657f16a8d6d3c161bfb03c203a6271ec6e6395b75716a14b0de8baced node-exporter.confd | ||
46 | df006b184c3b2d5e773044838db7143dc3a64e621f4da6b106f41915a07d5cef32933ab9bb44464f10c132f86997ae7753ae19627afd4ba6cfb125161786dfe0 node-exporter.initd" | ||
diff --git a/testing/prometheus-node-exporter/disable-go-race-detector.patch b/testing/prometheus-node-exporter/disable-go-race-detector.patch new file mode 100644 index 0000000000..99c146d037 --- /dev/null +++ b/testing/prometheus-node-exporter/disable-go-race-detector.patch | |||
@@ -0,0 +1,33 @@ | |||
1 | From 3c66e043f16c833214a10b3aaf36a16c7c1af834 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tiago Ilieve <tiago.myhro@gmail.com> | ||
3 | Date: Fri, 25 Jan 2019 14:50:25 +0100 | ||
4 | Subject: [PATCH] Disable Go race detector | ||
5 | |||
6 | Go race detector is not supported on musl[1]. | ||
7 | |||
8 | [1]: https://github.com/golang/go/issues/14481 | ||
9 | --- | ||
10 | Makefile | 7 ------- | ||
11 | 1 file changed, 7 deletions(-) | ||
12 | |||
13 | diff --git a/Makefile b/Makefile | ||
14 | index d6d138c..b61484b 100644 | ||
15 | --- a/Makefile | ||
16 | +++ b/Makefile | ||
17 | @@ -33,13 +33,6 @@ else | ||
18 | OS_detected := $(shell uname -s) | ||
19 | endif | ||
20 | |||
21 | -ifeq ($(GOHOSTARCH),amd64) | ||
22 | - ifeq ($(OS_detected),$(filter $(OS_detected),Linux FreeBSD Darwin Windows)) | ||
23 | - # Only supported on amd64 | ||
24 | - test-flags := -race | ||
25 | - endif | ||
26 | -endif | ||
27 | - | ||
28 | ifeq ($(OS_detected), Linux) | ||
29 | test-e2e := test-e2e | ||
30 | else | ||
31 | -- | ||
32 | 2.18.1 | ||
33 | |||
diff --git a/testing/prometheus-node-exporter/fix-go-sum.patch b/testing/prometheus-node-exporter/fix-go-sum.patch new file mode 100644 index 0000000000..45c35fa162 --- /dev/null +++ b/testing/prometheus-node-exporter/fix-go-sum.patch | |||
@@ -0,0 +1,27 @@ | |||
1 | From 2fdbf50c525a0ac7ed169b8ca838327ba70c89a4 Mon Sep 17 00:00:00 2001 | ||
2 | From: Tiago Ilieve <tiago.myhro@gmail.com> | ||
3 | Date: Fri, 25 Jan 2019 14:34:25 +0100 | ||
4 | Subject: [PATCH] Fix 'go.sum' hashes | ||
5 | |||
6 | 'github.com/soundcloud/go-runit' was failing with a 'checksum mismatch' | ||
7 | error message. | ||
8 | --- | ||
9 | go.sum | 2 +- | ||
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
11 | |||
12 | diff --git a/go.sum b/go.sum | ||
13 | index 5a60f0a..2de8dba 100644 | ||
14 | --- a/go.sum | ||
15 | +++ b/go.sum | ||
16 | @@ -47,7 +47,7 @@ github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFd | ||
17 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= | ||
18 | github.com/sirupsen/logrus v1.1.1 h1:VzGj7lhU7KEB9e9gMpAV/v5XT2NVSvLJhJLCWbnkgXg= | ||
19 | github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= | ||
20 | -github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:TGsOnmXp0mo82KbjaDcsTibGxWIdZNXbKJB18gFn1RM= | ||
21 | +github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a h1:os5OBNhwOwybXZMNLqT96XqtjdTtwRFw2w08uluvNeI= | ||
22 | github.com/soundcloud/go-runit v0.0.0-20150630195641-06ad41a06c4a/go.mod h1:LeFCbQYJ3KJlPs/FvPz2dy1tkpxyeNESVyCNNzRXFR0= | ||
23 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= | ||
24 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
25 | -- | ||
26 | 2.18.1 | ||
27 | |||
diff --git a/testing/prometheus-node-exporter/node-exporter.confd b/testing/prometheus-node-exporter/node-exporter.confd new file mode 100644 index 0000000000..39c80a46be --- /dev/null +++ b/testing/prometheus-node-exporter/node-exporter.confd | |||
@@ -0,0 +1,7 @@ | |||
1 | # /etc/conf.d/node-exporter | ||
2 | |||
3 | # Custom arguments can be specified like: | ||
4 | # | ||
5 | # ARGS="--web.listen-address=':9100'" | ||
6 | |||
7 | ARGS="" | ||
diff --git a/testing/prometheus-node-exporter/node-exporter.initd b/testing/prometheus-node-exporter/node-exporter.initd new file mode 100755 index 0000000000..5bd9839fe8 --- /dev/null +++ b/testing/prometheus-node-exporter/node-exporter.initd | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/sbin/openrc-run | ||
2 | |||
3 | command="/usr/bin/node_exporter" | ||
4 | command_args="$ARGS" | ||
5 | command_background="yes" | ||
6 | group="prometheus" | ||
7 | user="prometheus" | ||
8 | |||
9 | logdir="/var/log/prometheus" | ||
10 | logfile="$logdir/${SVCNAME}.log" | ||
11 | pidfile="/var/run/${SVCNAME}.pid" | ||
12 | start_stop_daemon_args="--stderr $logfile --user $user --group $group" | ||
13 | |||
14 | depend() { | ||
15 | need net | ||
16 | after firewall | ||
17 | } | ||
18 | |||
19 | start_pre() { | ||
20 | checkpath -d -o $user:$group -m755 $logdir | ||
21 | checkpath -f -o $user:$group -m644 $logfile | ||
22 | } | ||
diff --git a/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install new file mode 100755 index 0000000000..120995cf35 --- /dev/null +++ b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-install | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | addgroup -S prometheus 2>/dev/null | ||
4 | adduser -S -D -h /var/lib/prometheus -s /sbin/nologin -G prometheus -g prometheus prometheus 2>/dev/null | ||
5 | |||
6 | exit 0 | ||
diff --git a/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade new file mode 120000 index 0000000000..b87af95334 --- /dev/null +++ b/testing/prometheus-node-exporter/prometheus-node-exporter.pre-upgrade | |||
@@ -0,0 +1 @@ | |||
prometheus-node-exporter.pre-install \ No newline at end of file | |||