diff --git a/package/rpm/README.md b/package/rpm/README.md new file mode 100644 index 000000000..515980295 --- /dev/null +++ b/package/rpm/README.md @@ -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 +``` diff --git a/package/rpm/victoriametrics-rpm.spec b/package/rpm/victoriametrics-rpm.spec new file mode 100644 index 000000000..359121d01 --- /dev/null +++ b/package/rpm/victoriametrics-rpm.spec @@ -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 + diff --git a/package/rpm/victoriametrics.service b/package/rpm/victoriametrics.service new file mode 100644 index 000000000..c4965ab41 --- /dev/null +++ b/package/rpm/victoriametrics.service @@ -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