77 lines
2.5 KiB
Plaintext
77 lines
2.5 KiB
Plaintext
%global _hardened_build 1
|
|
%define linuxuser carbon
|
|
%define linuxgroup carbon
|
|
|
|
|
|
Name : go-carbon
|
|
Version : 0.18.0
|
|
Release : 1%{dist}
|
|
License : MIT
|
|
URL : https://github.com/go-graphite/go-carbon
|
|
Summary : Golang implementation of Graphite/Carbon server
|
|
BuildRequires: golang
|
|
BuildRequires: git
|
|
Requires : git
|
|
|
|
|
|
%description
|
|
Golang implementation of Graphite/Carbon server with classic architecture: Agent -> Cache -> Persister
|
|
|
|
|
|
%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/go-carbon
|
|
|
|
|
|
%build
|
|
export GOPATH=`pwd`
|
|
cd src/github.com/go-graphite/go-carbon
|
|
git checkout tags/v%{version}
|
|
go build -v -mod vendor -ldflags "-extldflags -s -w -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n') -X main.BuildVersion=$(BUILD)" go-carbon.go
|
|
|
|
|
|
%install
|
|
install -p -D -m 0755 src/github.com/go-graphite/go-carbon/go-carbon %{buildroot}%{_bindir}/go-carbon
|
|
install -p -D -m 0644 src/github.com/go-graphite/go-carbon/deploy/go-carbon.service %{buildroot}%{_unitdir}/go-carbon.service
|
|
install -p -D -m 0644 src/github.com/go-graphite/go-carbon/deploy/go-carbon.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/go-carbon
|
|
install -p -D -m 0644 src/github.com/go-graphite/go-carbon/go-carbon.conf.example %{buildroot}%{_sysconfdir}/go-carbon/go-carbon.conf
|
|
install -p -D -m 0644 src/github.com/go-graphite/go-carbon/deploy/storage-schemas.conf %{buildroot}%{_sysconfdir}/go-carbon/storage-schemas.conf
|
|
install -p -D -m 0644 src/github.com/go-graphite/go-carbon/deploy/storage-aggregation.conf %{buildroot}%{_sysconfdir}/go-carbon/storage-aggregation.conf
|
|
mkdir -p %{buildroot}/var/lib/graphite/whisper/
|
|
|
|
|
|
%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 go-carbon.service
|
|
|
|
|
|
%preun
|
|
%systemd_preun go-carbon.service
|
|
|
|
|
|
%postun
|
|
%systemd_postun go-carbon.service
|
|
|
|
|
|
%files
|
|
%config(noreplace) %attr(0644,%{linuxuser},%{linuxgroup}) %{_sysconfdir}/go-carbon/go-carbon.conf
|
|
%config(noreplace) %attr(0640,%{linuxuser},%{linuxgroup}) %{_sysconfdir}/go-carbon/storage-schemas.conf
|
|
%config(noreplace) %attr(0640,%{linuxuser},%{linuxgroup}) %{_sysconfdir}/go-carbon/storage-aggregation.conf
|
|
%{_bindir}/go-carbon
|
|
%{_sysconfdir}/logrotate.d/%{name}
|
|
%{_unitdir}/go-carbon.service
|
|
%attr(0770,%{linuxuser},%{linuxgroup}) %dir /var/lib/graphite/whisper/
|
|
|
|
|
|
%changelog
|