app-metrics/prometheus: Add ebuild with systemd service file. #33
8 changed files with 173 additions and 0 deletions
6
app-metrics/prometheus/ChangeLog
Normal file
6
app-metrics/prometheus/ChangeLog
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
*prometheus-2.13.1 (14 Nov 2019)
|
||||||
|
|
||||||
|
14 Nov 2019; <manuel@gentoo.org> +files/prometheus-3.initd,
|
||||||
|
+files/prometheus.confd, +files/prometheus.initd, +files/prometheus.service,
|
||||||
|
+metadata.xml, +prometheus-2.13.1.ebuild:
|
||||||
|
app-metrics/prometheus: Add ebuild with systemd service file.
|
8
app-metrics/prometheus/Manifest
Normal file
8
app-metrics/prometheus/Manifest
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
AUX prometheus-3.initd 848 BLAKE2B 062f20c87cbd20325b1160c8bdd6bf0e2a043b03cd55b257c4af6af57f0a706663cd809f73e97ae659db9d62e81b5ca25f89cecc0082adeb2002a7c715a03a56 SHA512 461cc0d3ccb2998fd6476a8e5e7d676265dd0b3892f6f6afd3f3eb4510aa8f42826674ec64cf07f2e19ad7170aeed27a0643366acedd6d8327db77c285af448b
|
||||||
|
AUX prometheus.confd 43 BLAKE2B c83afa8ad1133c9e93abd40c862ff5b3ac9a3b3c4447b915ae1482d92096dec9f200d089de2458a6cdb0e72d2bf0652d56e3afd6d5a3cd8a3ed7a6c9a0e3e42c SHA512 37468e897cd34b50b0edc65ada3f0c2e05459c3d96bb7f82d58b6de5bf10a127f1bf7912af93d83d94e3ea7287cfeb2311e36535f291d01a11d152a0b438591c
|
||||||
|
AUX prometheus.initd 929 BLAKE2B d48650b11b77d4d04b5458682456fb20f8085dc3efe9d0ddd2a6c75751ddae156bbb83c20082bc7b6833395602c24da61e2f7610bdff291e05e3eeb4fb651317 SHA512 504122eb8ed19beac81987b77eb78bba9b36b2ef15f28b1a542804271046e06363baf464f3c303982f647eba65fbc2b5459235f56625e1ff3fed9834937cd0d2
|
||||||
|
AUX prometheus.service 440 BLAKE2B 81a89d51ce54e4af5a1d400cee05418e031bce5d87df5546d5e759a6f9814d16eb88266dd129d40c94c1b7d971281f45f5a63a091a8ee6110fe601b909fc5175 SHA512 db040d60eaeffe5583a2e01d0e8c855ad7585ff89627b6fa0bbeac923381ef32154b49ddf7997d8774937d317cbc705357d90a05d2eedee417f7ce6ee486b291
|
||||||
|
DIST prometheus-2.13.1.tar.gz 15249891 BLAKE2B 35cd3c81bdb4f3a783c2ab1f1318946db5b25c94496fe351739a59259a726bf54d418d6b29efeff44c8007353ed63368819ce89ffe6a4f380b7ae216da3c4d63 SHA512 aed3b44db97cd2a67add64d13e950246b25c2b459f6b1081a6c548862c4e85c055254a0dfb94b08ac85f83dbbe30afceb1c54a8ad6f7ff1367aeb6af6d270e8a
|
||||||
|
EBUILD prometheus-2.13.1.ebuild 2063 BLAKE2B 87f71b82f276ab8edee18afc0b3dc6282ba2a729972e01596e50103679e0e19cfd238405871cdc5f45ed2de8415e35195dc6cd9f5db9fa456d79c4a07bfead9f SHA512 a61452a0bc74c2a7c747a37248955a22c369d0fb658b65108d1379789eed9da4592b13ba50d85f70ef6c42d4063e863aa4d7eb609e43dec49f0167379e61778d
|
||||||
|
MISC ChangeLog 284 BLAKE2B 3beb721fab1774b5c98db088acfdc192972d6bb78d7e0329f0d9ee6bb9ac7d9ca44ec729f4d6b6bd55782a5d439cbd474af101e02ea5362aacc921b924039dbd SHA512 ea7600136b83ce75d2476cbaae5685edfeeed36a48c8aa73922f65f1273e4e94bb82811afc6998cc6b44646ea7bb486dd146ce39c025ea3598aec521b1c80f4c
|
||||||
|
MISC metadata.xml 334 BLAKE2B 270b8d4817af970210624443197549e469d28b03ad38d87c1d3b7da0cb59476da6394989577fd199d26bf63322d0e74474428e493c8b4969fd74a42aa82adf5b SHA512 41aaef9331d9b27b5d7e0587679199bbbe149c5a4edfa9bc9932c2ea18b2c970d96d8f07a4a33253d567baab666d58e55f928db669ee2ff5d8ef0c7cd5da1e85
|
28
app-metrics/prometheus/files/prometheus-3.initd
Normal file
28
app-metrics/prometheus/files/prometheus-3.initd
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 2016-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
description="Prometheus monitoring system and time series database"
|
||||||
|
pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
|
||||||
|
user=${user:-${SVCNAME}}
|
||||||
|
group=${group:-${SVCNAME}}
|
||||||
|
|
||||||
|
command="/usr/bin/prometheus"
|
||||||
|
command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}"
|
||||||
|
command_background="true"
|
||||||
|
start_stop_daemon_args="--user ${user} --group ${group} \
|
||||||
|
--stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \
|
||||||
|
--stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log"
|
||||||
|
|
||||||
|
extra_started_commands="reload"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after net
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading ${SVCNAME}"
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
eend $? "Failed to stop ${SVCNAME}"
|
||||||
|
}
|
||||||
|
|
2
app-metrics/prometheus/files/prometheus.confd
Normal file
2
app-metrics/prometheus/files/prometheus.confd
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# arguments for Prometheus
|
||||||
|
command_args=""
|
34
app-metrics/prometheus/files/prometheus.initd
Normal file
34
app-metrics/prometheus/files/prometheus.initd
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/sbin/openrc-run
|
||||||
|
# Copyright 2016-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
description="Prometheus monitoring system and time series database"
|
||||||
|
pidfile=/var/run/${RC_SVCNAME}.pid
|
||||||
|
user=${user:-${RC_SVCNAME}}
|
||||||
|
group=${group:-${RC_SVCNAME}}
|
||||||
|
command_user=${user}:${group}
|
||||||
|
|
||||||
|
command="/usr/bin/prometheus"
|
||||||
|
command_args="${command_args:---config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data}"
|
||||||
|
command_background="true"
|
||||||
|
error_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
|
||||||
|
output_log=/var/log/${RC_SVCNAME}/${RC_SVCNAME}.log
|
||||||
|
|
||||||
|
extra_started_commands="reload"
|
||||||
|
|
||||||
|
depend() {
|
||||||
|
after net
|
||||||
|
}
|
||||||
|
|
||||||
|
reload() {
|
||||||
|
ebegin "Reloading configuration for ${RC_SVCNAME}"
|
||||||
|
case "$supervisor" in
|
||||||
|
supervise-daemon)
|
||||||
|
supervise-daemon ${RC_SVCNAME} --signal HUP
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
start-stop-daemon --signal HUP --pidfile "${pidfile}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
eend $? "Failed to reload ${RC_SVCNAME}"
|
||||||
|
}
|
15
app-metrics/prometheus/files/prometheus.service
Normal file
15
app-metrics/prometheus/files/prometheus.service
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=Prometheus monitoring system and time series database
|
||||||
|
Documentation=https://prometheus.io/docs/introduction/overview/
|
||||||
|
After=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=/etc/conf.d/prometheus
|
||||||
|
User=prometheus
|
||||||
|
Group=prometheus
|
||||||
|
Restart=on-failure
|
||||||
|
ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data $command_args
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
11
app-metrics/prometheus/metadata.xml
Normal file
11
app-metrics/prometheus/metadata.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
|
||||||
|
<pkgmetadata>
|
||||||
|
<maintainer type="person">
|
||||||
|
<email>manuel@fritteli.ch</email>
|
||||||
|
<name>Manuel Friedli</name>
|
||||||
|
</maintainer>
|
||||||
|
<upstream>
|
||||||
|
<remote-id type="github">prometheus/prometheus</remote-id>
|
||||||
|
</upstream>
|
||||||
|
</pkgmetadata>
|
69
app-metrics/prometheus/prometheus-2.13.1.ebuild
Normal file
69
app-metrics/prometheus/prometheus-2.13.1.ebuild
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
# Copyright 1999-2019 Gentoo Authors
|
||||||
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
|
EAPI=6
|
||||||
|
inherit user golang-build golang-vcs-snapshot systemd
|
||||||
|
|
||||||
|
EGO_PN="github.com/prometheus/prometheus"
|
||||||
|
MY_PV=v${PV/_rc/-rc.}
|
||||||
|
PROMETHEUS_COMMIT="6f92ce5"
|
||||||
|
KEYWORDS="~amd64"
|
||||||
|
|
||||||
|
DESCRIPTION="Prometheus monitoring system and time series database"
|
||||||
|
HOMEPAGE="https://github.com/prometheus/prometheus"
|
||||||
|
SRC_URI="https://${EGO_PN}/archive/${MY_PV}.tar.gz -> ${P}.tar.gz"
|
||||||
|
LICENSE="Apache-2.0"
|
||||||
|
SLOT="0"
|
||||||
|
IUSE=""
|
||||||
|
|
||||||
|
DEPEND="
|
||||||
|
>=dev-lang/go-1.12
|
||||||
|
>=dev-util/promu-0.3.0"
|
||||||
|
|
||||||
|
PROMETHEUS_HOME="/var/lib/prometheus"
|
||||||
|
|
||||||
|
RESTRICT="test"
|
||||||
|
|
||||||
|
pkg_setup() {
|
||||||
|
enewgroup prometheus
|
||||||
|
enewuser prometheus -1 -1 "${PROMETHEUS_HOME}" prometheus
|
||||||
|
}
|
||||||
|
|
||||||
|
src_prepare() {
|
||||||
|
default
|
||||||
|
sed -i -e "s/{{.Revision}}/${PROMETHEUS_COMMIT}/" src/${EGO_PN}/.promu.yml || die
|
||||||
|
}
|
||||||
|
|
||||||
|
src_compile() {
|
||||||
|
pushd src/${EGO_PN} || die
|
||||||
|
GO111MODULE=on GOPATH="${S}" GOCACHE="${T}/go-cache" promu build -v || die
|
||||||
|
popd || die
|
||||||
|
}
|
||||||
|
|
||||||
|
src_install() {
|
||||||
|
pushd src/${EGO_PN} || die
|
||||||
|
dobin promtool prometheus
|
||||||
|
dodoc -r {documentation,{README,CHANGELOG,CONTRIBUTING}.md}
|
||||||
|
insinto /etc/prometheus
|
||||||
|
doins documentation/examples/prometheus.yml
|
||||||
|
insinto /usr/share/prometheus
|
||||||
|
doins -r console_libraries consoles
|
||||||
|
dosym ../../usr/share/prometheus/console_libraries /etc/prometheus/console_libraries
|
||||||
|
dosym ../../usr/share/prometheus/consoles /etc/prometheus/consoles
|
||||||
|
popd || die
|
||||||
|
|
||||||
|
systemd_dounit "${FILESDIR}"/prometheus.service
|
||||||
|
newinitd "${FILESDIR}"/prometheus.initd prometheus
|
||||||
|
newconfd "${FILESDIR}"/prometheus.confd prometheus
|
||||||
|
keepdir /var/log/prometheus /var/lib/prometheus
|
||||||
|
fowners prometheus:prometheus /var/log/prometheus /var/lib/prometheus
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_postinst() {
|
||||||
|
if has_version '<net-analyzer/prometheus-2.0.0_rc0'; then
|
||||||
|
ewarn "Old prometheus 1.x TSDB won't be converted to the new prometheus 2.0 format"
|
||||||
|
ewarn "Be aware that the old data currently cannot be accessed with prometheus 2.0"
|
||||||
|
ewarn "This release requires a clean storage directory and is not compatible with"
|
||||||
|
ewarn "files created by previous beta releases"
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in a new issue