summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-02-21 20:18:01 +0100
committerThomas Deutschmann <whissi@gentoo.org>2021-02-21 20:18:47 +0100
commit173e640d52754cb0bc24338555cdf8ee185ba2f7 (patch)
tree58ab96a1ff5b3ce4ddbb12aebf2565cfada8fb38 /www-apps/grafana-bin/files
parentwww-apps/grafana-bin: bump to v7.4.2 (diff)
downloadgentoo-173e640d52754cb0bc24338555cdf8ee185ba2f7.tar.gz
gentoo-173e640d52754cb0bc24338555cdf8ee185ba2f7.tar.bz2
gentoo-173e640d52754cb0bc24338555cdf8ee185ba2f7.zip
www-apps/grafana-bin: add multi-instance support
Thanks-to: Kim Jahn <kim@maisspace.org> Closes: https://github.com/gentoo/gentoo/pull/18821 Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'www-apps/grafana-bin/files')
-rw-r--r--www-apps/grafana-bin/files/grafana-r1.confd27
-rw-r--r--www-apps/grafana-bin/files/grafana.initd36
2 files changed, 63 insertions, 0 deletions
diff --git a/www-apps/grafana-bin/files/grafana-r1.confd b/www-apps/grafana-bin/files/grafana-r1.confd
new file mode 100644
index 000000000000..fffd31d43b65
--- /dev/null
+++ b/www-apps/grafana-bin/files/grafana-r1.confd
@@ -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"
diff --git a/www-apps/grafana-bin/files/grafana.initd b/www-apps/grafana-bin/files/grafana.initd
new file mode 100644
index 000000000000..ec72725100f8
--- /dev/null
+++ b/www-apps/grafana-bin/files/grafana.initd
@@ -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
+}