add www-apps/grafana-bin with arm64 support
This commit is contained in:
parent
adc8c59a8a
commit
1a23eda5fe
6 changed files with 196 additions and 0 deletions
27
www-apps/grafana-bin/files/grafana-r1.confd
Normal file
27
www-apps/grafana-bin/files/grafana-r1.confd
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Config file for /etc/init.d/grafana
|
||||
|
||||
# The user to run your application as
|
||||
#GRAFANA_USER=grafana
|
||||
|
||||
# The group to run your application as
|
||||
#GRAFANA_GROUP=grafana
|
||||
|
||||
# Configuration file
|
||||
#GRAFANA_CONFIGFILE="/etc/grafana/${RC_SVCNAME}.ini"
|
||||
|
||||
# PID file
|
||||
#GRAFANA_PIDFILE="/run/${RC_SVCNAME}.pid"
|
||||
|
||||
# The grafana datadir
|
||||
#GRAFANA_DATADIR=/var/lib/grafana
|
||||
|
||||
# You can use this configuration option to pass additional options to the
|
||||
# start-stop-daemon, see start-stop-daemon(8) for more details.
|
||||
# Per default we wait 1000ms after we have started the service to ensure
|
||||
# that the daemon is really up and running.
|
||||
#GRAFANA_SSDARGS="--wait 1000"
|
||||
|
||||
# The termination timeout (start-stop-daemon parameter "retry") ensures
|
||||
# that the service will be terminated within a given time (60 + 5 seconds
|
||||
# per default) when you are stopping the service.
|
||||
#GRAFANA_TERMTIMEOUT="TERM/60/KILL/5"
|
7
www-apps/grafana-bin/files/grafana.confd
Normal file
7
www-apps/grafana-bin/files/grafana.confd
Normal file
|
@ -0,0 +1,7 @@
|
|||
# Config file for /etc/init.d/grafana
|
||||
|
||||
# The user to run your application as.
|
||||
GRAFANA_USER=grafana
|
||||
|
||||
# The group to run your application as.
|
||||
GRAFANA_GROUP=grafana
|
36
www-apps/grafana-bin/files/grafana.initd
Normal file
36
www-apps/grafana-bin/files/grafana.initd
Normal file
|
@ -0,0 +1,36 @@
|
|||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
GRAFANA_USER="${GRAFANA_USER:-"grafana"}"
|
||||
GRAFANA_GROUP="${GRAFANA_GROUP:-"grafana"}"
|
||||
GRAFANA_CONFIGFILE="${GRAFANA_CONFIGFILE:-"/etc/grafana/${RC_SVCNAME}.ini"}"
|
||||
GRAFANA_DATADIR="${GRAFANA_DATADIR:-"/var/lib/grafana"}"
|
||||
GRAFANA_LOGDIR="${GRAFANA_LOGDIR:-"/var/log/grafana"}"
|
||||
GRAFANA_PIDFILE="${GRAFANA_PIDFILE:-"/run/${RC_SVCNAME}.pid"}"
|
||||
GRAFANA_SSDARGS=${GRAFANA_SSDARGS:-"--wait 1000"}
|
||||
GRAFANA_TERMTIMEOUT=${GRFANA_TERMTIMEOUT:-"TERM/60/KILL/5"}
|
||||
|
||||
command="/usr/bin/grafana-server"
|
||||
command_args="-homepath=/usr/share/grafana"
|
||||
command_args="${command_args} -config=\"${GRAFANA_CONFIGFILE}\""
|
||||
command_args="${command_args} cfg:default.paths.data=\"${GRAFANA_DATADIR}\""
|
||||
command_args="${command_args} cfg:default.paths.logs=\"${GRAFANA_LOGDIR}\""
|
||||
command_background="yes"
|
||||
pidfile="${GRAFANA_PIDFILE}"
|
||||
retry="${GRAFANA_TERMTIMEOUT}"
|
||||
start_stop_daemon_args="--user ${GRAFANA_USER}:${GRAFANA_GROUP} ${GRAFANA_SSDARGS}"
|
||||
|
||||
description="Grafana server, feature rich metrics dashboard and graph editor."
|
||||
|
||||
required_files="${GRAFANA_CONFIGFILE}"
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "${GRAFANA_DATADIR}" || return 1
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "${GRAFANA_DATADIR}/dashboards" || return 1
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "${GRAFANA_DATADIR}/plugins" || return 1
|
||||
}
|
38
www-apps/grafana-bin/files/grafana.initd.3
Normal file
38
www-apps/grafana-bin/files/grafana.initd.3
Normal file
|
@ -0,0 +1,38 @@
|
|||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2017 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
depend() {
|
||||
need localmount
|
||||
}
|
||||
|
||||
start() {
|
||||
ebegin "Starting grafana server"
|
||||
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/dashboards"
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/plugins"
|
||||
checkpath -d -o "${GRAFANA_USER}:${GRAFANA_GROUP}" -m750 "/var/lib/grafana/sessions"
|
||||
|
||||
start-stop-daemon --start -b \
|
||||
--make-pidfile \
|
||||
--pidfile /run/grafana.pid \
|
||||
--chdir /usr/share/grafana \
|
||||
--user ${GRAFANA_USER}:${GRAFANA_GROUP} \
|
||||
--exec /usr/bin/grafana-server -- \
|
||||
-config=/etc/grafana/grafana.ini \
|
||||
cfg:default.paths.data=/var/lib/grafana \
|
||||
cfg:default.paths.logs=/var/log/grafana
|
||||
|
||||
eend $?
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping grafana server"
|
||||
|
||||
start-stop-daemon --stop \
|
||||
--pidfile /run/grafana.pid \
|
||||
--user "${GRAFANA_USER}" \
|
||||
--retry=TERM/20/KILL/5
|
||||
|
||||
eend $?
|
||||
}
|
25
www-apps/grafana-bin/files/grafana.service
Normal file
25
www-apps/grafana-bin/files/grafana.service
Normal file
|
@ -0,0 +1,25 @@
|
|||
[Unit]
|
||||
Description=Grafana
|
||||
Documentation=http://docs.grafana.org
|
||||
Wants=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
User=grafana
|
||||
Group=grafana
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
RuntimeDirectory=grafana
|
||||
WorkingDirectory=/usr/share/grafana
|
||||
ExecStart=/usr/bin/grafana-server \
|
||||
--config=/etc/grafana/grafana.ini \
|
||||
--pidfile=/run/grafana/grafana.pid \
|
||||
cfg:default.paths.logs=/var/log/grafana \
|
||||
cfg:default.paths.data=/var/lib/grafana \
|
||||
cfg:default.paths.plugins=/var/lib/grafana/plugins
|
||||
LimitNOFILE=10000
|
||||
TimeoutStopSec=20
|
||||
UMask=0027
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
63
www-apps/grafana-bin/grafana-bin-7.4.3.ebuild
Normal file
63
www-apps/grafana-bin/grafana-bin-7.4.3.ebuild
Normal file
|
@ -0,0 +1,63 @@
|
|||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=7
|
||||
|
||||
inherit systemd
|
||||
|
||||
MY_PN=${PN/-bin/}
|
||||
MY_PV=${PV/_beta/-beta}
|
||||
S=${WORKDIR}/${MY_PN}-${MY_PV}
|
||||
|
||||
DESCRIPTION="Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB"
|
||||
HOMEPAGE="https://grafana.org"
|
||||
SRC_URI="https://dl.grafana.com/oss/release/grafana-${PV}.linux-${ARCH}.tar.gz -> ${P}.tar.gz"
|
||||
LICENSE="Apache-2.0"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm64"
|
||||
|
||||
DEPEND="acct-group/grafana
|
||||
acct-user/grafana"
|
||||
RDEPEND="${DEPEND}
|
||||
media-libs/fontconfig"
|
||||
|
||||
QA_PREBUILT="usr/bin/grafana-*"
|
||||
QA_PRESTRIPPED=${QA_PREBUILT}
|
||||
|
||||
src_install() {
|
||||
keepdir /etc/grafana
|
||||
insinto /etc/grafana
|
||||
newins "${S}"/conf/sample.ini grafana.ini
|
||||
rm "${S}"/conf/sample.ini || die
|
||||
|
||||
# Frontend assets
|
||||
insinto /usr/share/${MY_PN}
|
||||
doins -r public conf
|
||||
|
||||
dobin bin/grafana-cli
|
||||
dobin bin/grafana-server
|
||||
|
||||
newconfd "${FILESDIR}"/grafana-r1.confd grafana
|
||||
newinitd "${FILESDIR}"/grafana.initd grafana
|
||||
systemd_newunit "${FILESDIR}"/grafana.service grafana.service
|
||||
|
||||
keepdir /var/{lib,log}/grafana
|
||||
keepdir /var/lib/grafana/{dashboards,plugins}
|
||||
fowners grafana:grafana /var/{lib,log}/grafana
|
||||
fowners grafana:grafana /var/lib/grafana/{dashboards,plugins}
|
||||
fperms 0750 /var/{lib,log}/grafana
|
||||
fperms 0750 /var/lib/grafana/{dashboards,plugins}
|
||||
}
|
||||
|
||||
postinst() {
|
||||
if [[ -z "${REPLACING_VERSIONS}" ]]; then
|
||||
# This is a new installation
|
||||
|
||||
elog "${PN} has built-in log rotation. Please see [log.file] section of"
|
||||
elog "/etc/grafana/grafana.ini for related settings."
|
||||
elog
|
||||
elog "You may add your own custom configuration for app-admin/logrotate if you"
|
||||
elog "wish to use external rotation of logs. In this case, you also need to make"
|
||||
elog "sure the built-in rotation is turned off."
|
||||
fi
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue