webbuilder_pel7ppc64lebuilder0
6 years ago
4 changed files with 148 additions and 0 deletions
@ -0,0 +1,10 @@
@@ -0,0 +1,10 @@
|
||||
# gogs logs: |
||||
/var/log/grafana/*.log { |
||||
daily |
||||
missingok |
||||
rotate 14 |
||||
compress |
||||
delaycompress |
||||
notifempty |
||||
copytruncate |
||||
} |
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
[Unit] |
||||
Description=Grafana instance |
||||
Documentation=http://docs.grafana.org |
||||
Wants=network-online.target |
||||
After=network-online.target |
||||
After=postgresql.service mariadb.service mysql.service |
||||
|
||||
[Service] |
||||
EnvironmentFile=/etc/sysconfig/grafana |
||||
User=grafana |
||||
Group=grafana |
||||
Type=notify |
||||
Restart=on-failure |
||||
WorkingDirectory=/usr/share/grafana |
||||
RuntimeDirectory=grafana |
||||
RuntimeDirectoryMode=0750 |
||||
ExecStart=/usr/sbin/grafana-server \ |
||||
--config=${CONF_FILE} \ |
||||
--pidfile=${PID_FILE_DIR}/grafana-server.pid \ |
||||
--packaging=rpm \ |
||||
cfg:default.paths.logs=${LOG_DIR} \ |
||||
cfg:default.paths.data=${DATA_DIR} \ |
||||
cfg:default.paths.plugins=${PLUGINS_DIR} \ |
||||
cfg:default.paths.provisioning=${PROVISIONING_CFG_DIR} |
||||
LimitNOFILE=10000 |
||||
TimeoutStopSec=20 |
||||
|
||||
[Install] |
||||
WantedBy=multi-user.target |
@ -0,0 +1,14 @@
@@ -0,0 +1,14 @@
|
||||
#!grafana.sysconfig |
||||
|
||||
GRAFANA_USER=grafana |
||||
GRAFANA_GROUP=grafana |
||||
GRAFANA_HOME=/usr/share/grafana |
||||
LOG_DIR=/var/log/grafana |
||||
DATA_DIR=/var/lib/grafana |
||||
MAX_OPEN_FILES=10000 |
||||
CONF_DIR=/etc/grafana |
||||
CONF_FILE=/etc/grafana/grafana.ini |
||||
RESTART_ON_UPGRADE=true |
||||
PLUGINS_DIR=/var/lib/grafana/plugins |
||||
PROVISIONING_CFG_DIR=/etc/grafana/provisioning |
||||
PID_FILE_DIR=/var/run/grafana |
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
%global _hardened_build 1 |
||||
%define grafana_user grafana |
||||
%define grafana_group grafana |
||||
%define grafana_home /var/lib/grafana |
||||
%define grafana_logdir /var/log/grafana |
||||
#%define debug_package %{nil} |
||||
|
||||
Name : grafana |
||||
Version : 6.0.0 |
||||
Release : 1%{dist} |
||||
License : MIT |
||||
URL : http://gogs.io |
||||
Summary : The tool for beautiful monitoring and metric analytics & dashboards |
||||
Source0 : grafana.service |
||||
Source1 : grafana.sysconfig |
||||
Source2 : grafana.logrotate |
||||
BuildRequires: golang |
||||
BuildRequires: git |
||||
Requires : git |
||||
|
||||
|
||||
%description |
||||
The open platform for beautiful |
||||
analytics and monitoring |
||||
|
||||
|
||||
%prep |
||||
%setup -T -q -c %{name}-%{version} |
||||
export GOPATH=`pwd` |
||||
#go get -u -v github.com/grafana/grafana |
||||
mkdir -p src/github.com/grafana/ |
||||
cd src/github.com/grafana/ |
||||
git clone https://github.com/grafana/grafana/ |
||||
|
||||
|
||||
%build |
||||
export GOPATH=`pwd` |
||||
cd src/github.com/grafana/grafana |
||||
git checkout tags/v%{version} |
||||
go run build.go setup |
||||
go run build.go build |
||||
|
||||
|
||||
%install |
||||
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/grafana.service |
||||
mkdir -p %{buildroot}%{_sysconfdir}/grafana/ |
||||
cp -r src/github.com/grafana/grafana/conf/* %{buildroot}%{_sysconfdir}/grafana/ |
||||
#install -p -D -m 0644 src/github.com/grafana/grafana/conf/* %{buildroot}%{_sysconfdir}/grafana/ |
||||
install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/grafana |
||||
install -p -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/grafana |
||||
mkdir -p %{buildroot}%{_datadir}/%{name}/ |
||||
cp -r src/github.com/grafana/grafana/public/ %{buildroot}%{_datadir}/%{name}/ |
||||
cp -r src/github.com/grafana/grafana/scripts/ %{buildroot}%{_datadir}/%{name}/ |
||||
cp -r src/github.com/grafana/grafana/tools/ %{buildroot}%{_datadir}/%{name}/ |
||||
echo %{version} > %{buildroot}%{_datadir}/%{name}/VERSION |
||||
install -p -D -m 0555 src/github.com/grafana/grafana/bin/linux-%{_arch}/grafana-server %{buildroot}%{_sbindir}/grafana-server |
||||
install -p -D -m 0555 src/github.com/grafana/grafana/bin/linux-%{_arch}/grafana-cli %{buildroot}%{_bindir}/grafana-cli |
||||
install -p -d -m 0700 %{buildroot}%{grafana_home} |
||||
install -p -d -m 0700 %{buildroot}%{grafana_logdir} |
||||
|
||||
|
||||
%pre |
||||
getent group %{grafana_group} > /dev/null || groupadd -r %{grafana_group} |
||||
getent passwd %{grafana_user} > /dev/null || \ |
||||
useradd -r -d %{grafana_home} -g %{grafana_group} \ |
||||
-s /bin/bash -c "Grafana user" %{grafana_user} |
||||
exit 0 |
||||
|
||||
|
||||
%post |
||||
%systemd_post grafana.service |
||||
|
||||
|
||||
%preun |
||||
%systemd_preun grafana.service |
||||
|
||||
|
||||
%postun |
||||
%systemd_postun grafana.service |
||||
|
||||
|
||||
%files |
||||
%attr(775,%{grafana_user},%{grafana_group}) %{_sysconfdir}/%{name}/ |
||||
%config(noreplace) %{_sysconfdir}/sysconfig/%{name} |
||||
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} |
||||
%{_sbindir}/grafana-server |
||||
%{_bindir}/grafana-cli |
||||
%{_unitdir}/grafana.service |
||||
%{_datadir}/%{name}/VERSION |
||||
%{_datadir}/%{name}/public/ |
||||
%{_datadir}/%{name}/scripts/ |
||||
%{_datadir}/%{name}/tools/ |
||||
|
||||
|
||||
%changelog |
Loading…
Reference in new issue