72 lines
1.8 KiB
Plaintext
72 lines
1.8 KiB
Plaintext
%global _hardened_build 1
|
|
%define linuxuser carbon
|
|
%define linuxgroup carbon
|
|
|
|
|
|
Name : carbonapi
|
|
Version : 0.17.0
|
|
Release : 1%{dist}
|
|
License : MIT
|
|
URL : https://github.com/go-graphite/carbonapi
|
|
Summary : Implementation of graphite API (graphite-web) in golang
|
|
Source0 : carbonapi.service
|
|
BuildRequires: golang
|
|
BuildRequires: git
|
|
Requires : git
|
|
|
|
|
|
%description
|
|
Implementation of graphite API (graphite-web) in golang
|
|
|
|
|
|
%prep
|
|
%setup -T -q -c %{name}-%{version}
|
|
export GOPATH=`pwd`
|
|
mkdir -p src/github.com/go-graphite/
|
|
cd src/github.com/go-graphite/
|
|
git clone https://github.com/go-graphite/carbonapi
|
|
|
|
|
|
%build
|
|
export GOPATH=`pwd`
|
|
cd src/github.com/go-graphite/carbonapi
|
|
git checkout tags/v%{version}
|
|
go build -v -mod vendor -tags cairo -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X main.BuildVersion=%{version}" -o carbonapi ./cmd/carbonapi
|
|
|
|
|
|
%install
|
|
install -p -D -m 0755 src/github.com/go-graphite/carbonapi/carbonapi %{buildroot}%{_bindir}/carbonapi
|
|
install -p -D -m 0644 %{SOURCE0} %{buildroot}%{_unitdir}/carbonapi.service
|
|
#install -p -D -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/go-carbon
|
|
install -p -D -m 0644 src/github.com/go-graphite/carbonapi/cmd/carbonapi/carbonapi.example.yaml %{buildroot}%{_sysconfdir}/carbonapi/config.yaml
|
|
|
|
|
|
%pre
|
|
getent group %{linuxgroup} > /dev/null || groupadd -r %{linuxgroup}
|
|
getent passwd %{linuxuser} > /dev/null || \
|
|
useradd -r -d %{linuxhome} -g %{linuxgroup} \
|
|
-s /bin/bash -c "carbon user" %{linuxuser}
|
|
exit 0
|
|
|
|
|
|
%post
|
|
%systemd_post carbonapi.service
|
|
|
|
|
|
%preun
|
|
%systemd_preun carbonapi.service
|
|
|
|
|
|
%postun
|
|
%systemd_postun carbonapi.service
|
|
|
|
|
|
%files
|
|
%config(noreplace) %attr(0644,%{linuxuser},%{linuxgroup}) %{_sysconfdir}/carbonapi/config.yaml
|
|
%{_bindir}/carbonapi
|
|
#%{_sysconfdir}/logrotate.d/%{name}
|
|
%{_unitdir}/carbonapi.service
|
|
|
|
|
|
%changelog
|