PilotGo-plugin-prometheus/PilotGo-plugin-prometheus.spec
2024-04-02 16:12:56 +08:00

71 lines
2.5 KiB
RPMSpec

%define debug_package %{nil}
Name: PilotGo-plugin-prometheus
Version: 1.1.0
Release: 1
Summary: PilotGo prometheus plugin provides cluster monitor and alert.
License: MulanPSL-2.0
URL: https://gitee.com/openeuler/PilotGo-plugin-prometheus
Source0: https://gitee.com/openeuler/PilotGo-plugin-prometheus/repository/archive/v%{version}.tar.gz
# tar -xvf Source0
# cd %{name}-v%{version}/web
# run 'yarn install and yarn build' in it
# tar -czvf %{name}-web.tar.gz ../web/dist/
Source1: PilotGo-plugin-prometheus-web.tar.gz
BuildRequires: systemd
BuildRequires: golang
Requires: prometheus2
Requires: golang-github-prometheus-node_exporter
Provides: pilotgo-plugin-prometheus = %{version}-%{release}
%description
PilotGo prometheus plugin provides cluster monitor and alert.
%prep
%setup -n %{name}-v%{version}
tar -xzvf %{SOURCE1}
%build
pushd server
GO111MODULE=on go build -mod=vendor -o PilotGo-plugin-prometheus main.go
popd
%install
mkdir -p %{buildroot}/opt/PilotGo/plugin/prometheus/{server/{scripts,log},web/dist}
pushd server
install -D -m 0755 PilotGo-plugin-prometheus %{buildroot}/opt/PilotGo/plugin/prometheus/server
install -D -m 0644 scripts/init_prometheus_yml.sh %{buildroot}/opt/PilotGo/plugin/prometheus/server/scripts/init_prometheus_yml.sh
install -D -m 0644 scripts/prometheus.yml %{buildroot}/opt/PilotGo/plugin/prometheus/server/scripts/prometheus.yml
install -D -m 0644 config.yml.templete %{buildroot}/opt/PilotGo/plugin/prometheus/server/config.yml
install -D -m 0644 scripts/PilotGo-plugin-prometheus.service %{buildroot}%{_unitdir}/PilotGo-plugin-prometheus.service
popd
cp -rf web/dist %{buildroot}/opt/PilotGo/plugin/prometheus/web
%post
%systemd_post PilotGo-plugin-prometheus.service
%preun
%systemd_preun PilotGo-plugin-prometheus.service
%postun
%systemd_postun PilotGo-plugin-prometheus.service
# Clear all installed files when uninstalling
rm -rf /opt/PilotGo/plugin/prometheus
%files
/opt/PilotGo/plugin/prometheus/server/PilotGo-plugin-prometheus
/opt/PilotGo/plugin/prometheus/server/scripts/init_prometheus_yml.sh
/opt/PilotGo/plugin/prometheus/server/scripts/prometheus.yml
/opt/PilotGo/plugin/prometheus/server/config.yml
/opt/PilotGo/plugin/prometheus/server/log
/opt/PilotGo/plugin/prometheus/web
%{_unitdir}/PilotGo-plugin-prometheus.service
%changelog
* Tue Apr 02 2024 jianxinyu <jiangxinyu@kylinos.cn> - 1.1.0-1
- Update package to version 1.1.0
* Fri Sep 01 2023 jianxinyu <jiangxinyu@kylinos.cn> - 1.0.1-1
- Package init