#!/sbin/openrc-run

supervisor=supervise-daemon

name="Grafana"
description="Metrics Dashboard and Graph Editor"

command="/usr/bin/grafana"
command_args="server $GRAFANA_OPTS"

command_user=grafana:grafana

depend() {
	need net
	after firewall
}

start_pre() {
	checkpath -d -o grafana:grafana -m755 $GRAFANA_HOME \
		$GRAFANA_HOME/provisioning \
		$GRAFANA_HOME/provisioning/alerting \
		$GRAFANA_HOME/provisioning/dashboards \
		$GRAFANA_HOME/provisioning/datasources \
		$GRAFANA_HOME/provisioning/notifiers \
		$GRAFANA_HOME/provisioning/plugins
}
