Add package/rpm/ (#121)

This commit is contained in:
Anton Patsev 2019-07-25 14:21:55 +06:00 committed by Aliaksandr Valialkin
parent 8aa474d685
commit 106ab78a47
3 changed files with 87 additions and 0 deletions

16
package/rpm/README.md Normal file
View file

@ -0,0 +1,16 @@
# victoriametrics-rpm
RPM for VictoriaMetrics - the best long-term remote storage for Prometheus
*Get and started*
```
yum -y install yum-plugin-copr
yum copr enable antonpatsev/VictoriaMetrics
yum makecache
yum -y install victoriametrics
systemctl start victoriametrics
```

View file

@ -0,0 +1,55 @@
%global _prefix /usr/local
Name: victoriametrics
Version: 1.22.2
Release: 1
Summary: The best long-term remote storage for Prometheus
Group: Development Tools
License: ASL 2.0
URL: https://github.com/VictoriaMetrics/VictoriaMetrics/releases/download/v%{version}/victoria-metrics-v%{version}.tar.gz
Source0: %{name}.service
# Use systemd for fedora >= 18, rhel >=7, SUSE >= 12 SP1 and openSUSE >= 42.1
%define use_systemd (0%{?fedora} && 0%{?fedora} >= 18) || (0%{?rhel} && 0%{?rhel} >= 7) || (!0%{?is_opensuse} && 0%{?suse_version} >=1210) || (0%{?is_opensuse} && 0%{?sle_version} >= 120100)
%description
VictoriaMetrics - the best long-term remote storage for Prometheus
%prep
curl -L %{url} > victoria-metrics.tar.gz
tar -zxf victoria-metrics.tar.gz
%install
%{__install} -m 0755 -d %{buildroot}%{_bindir}
cp victoria-metrics-prod %{buildroot}%{_bindir}/%{name}
%{__install} -m 0755 -d %{buildroot}/var/lib/victoria-metrics-data
%if %{use_systemd}
%{__mkdir} -p %{buildroot}%{_unitdir}
%{__install} -m644 %{SOURCE0} \
%{buildroot}%{_unitdir}/%{name}.service
%endif
%post
%if %use_systemd
/usr/bin/systemctl daemon-reload
%endif
%preun
%if %use_systemd
/usr/bin/systemctl stop %{name}
%endif
%postun
%if %use_systemd
/usr/bin/systemctl daemon-reload
%endif
%files
%{_bindir}/%{name}
/var/lib/victoria-metrics-data
%if %{use_systemd}
%{_unitdir}/%{name}.service
%endif

View file

@ -0,0 +1,16 @@
[Unit]
Description=High-performance, cost-effective and scalable time series database, long-term remote storage for Prometheus
After=network.target
[Service]
Type=simple
StartLimitBurst=5
StartLimitInterval=0
Restart=on-abort
ExecStart=/usr/local/bin/victoriametrics -storageDataPath=/var/lib/victoria-metrics-data start
ExecStop=/bin/kill -s SIGTERM $MAINPID
LimitNOFILE=65536
LimitNPROC=32000
[Install]
WantedBy=multi-user.target