]>
Commit | Line | Data |
---|---|---|
1 | Summary: Back-end data caching and persistence daemon for Graphite | |
2 | Name: carbon | |
3 | Version: 0.9.12 | |
4 | Release: 1 | |
5 | License: Apache v2.0 | |
6 | Group: Daemons | |
7 | # https://codeload.github.com/graphite-project/carbon/tar.gz/0.9.12 | |
8 | Source0: https://codeload.github.com/graphite-project/carbon/tar.gz/%{version} | |
9 | # Source0-md5: 674c7376be70b07a90eecf013dad6600 | |
10 | Source1: %{name}-cache.init | |
11 | Source2: %{name}-relay.init | |
12 | Source3: %{name}-aggregator.init | |
13 | Source4: %{name}.sysconfig | |
14 | Source5: %{name}.conf | |
15 | URL: https://launchpad.net/graphite/ | |
16 | BuildRequires: python-devel | |
17 | BuildRequires: python-setuptools | |
18 | BuildRequires: rpm-pythonprov | |
19 | BuildRequires: rpmbuild(macros) >= 1.710 | |
20 | Provides: group(carbon) | |
21 | Provides: user(carbon) | |
22 | Requires(postun): /usr/sbin/groupdel | |
23 | Requires(postun): /usr/sbin/userdel | |
24 | Requires(pre): /bin/id | |
25 | Requires(pre): /usr/bin/getgid | |
26 | Requires(pre): /usr/sbin/groupadd | |
27 | Requires(pre): /usr/sbin/useradd | |
28 | Requires: python-TwistedCore >= 8.0 | |
29 | Requires: python-whisper >= %{version} | |
30 | Requires: rc-scripts >= 0.4.6 | |
31 | BuildArch: noarch | |
32 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
33 | ||
34 | %define no_install_post_check_tmpfiles 1 | |
35 | ||
36 | %description | |
37 | Twisted daemon that listens for time-series data and writes this data | |
38 | out to whisper databases, relays the data or aggregates the data. | |
39 | Carbon is a data collection and storage agent. | |
40 | ||
41 | %prep | |
42 | %setup -q | |
43 | ||
44 | %build | |
45 | %py_build | |
46 | ||
47 | ||
48 | %install | |
49 | rm -rf $RPM_BUILD_ROOT | |
50 | ||
51 | # http://graphite.readthedocs.org/en/0.9.12/install-source.html#installing-carbon-in-a-custom-location | |
52 | %py_install \ | |
53 | --install-scripts=%{_bindir} \ | |
54 | --install-lib=%{py_sitescriptdir}/ \ | |
55 | --install-data=%{_sharedstatedir}/%{name} \ | |
56 | --root=$RPM_BUILD_ROOT | |
57 | ||
58 | %py_postclean -x amqp_publisher.py,amqp_listener.py | |
59 | ||
60 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name} | |
61 | install -d $RPM_BUILD_ROOT%{_localstatedir}/log/carbon | |
62 | install -d $RPM_BUILD_ROOT%{_localstatedir}/run/carbon | |
63 | install -d $RPM_BUILD_ROOT%{_sharedstatedir}/carbon | |
64 | ||
65 | # Install system configuration and init scripts | |
66 | install -Dp %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-cache | |
67 | install -Dp %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-relay | |
68 | install -Dp %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/carbon-aggregator | |
69 | install -Dp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/carbon | |
70 | ||
71 | # Install default configuration files | |
72 | install -d $RPM_BUILD_ROOT%{_sysconfdir}/%{name} | |
73 | #install -Dp conf/carbon.conf.example | |
74 | install -Dp %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/carbon.conf | |
75 | ||
76 | install -Dp conf/storage-schemas.conf.example $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/storage-schemas.conf | |
77 | ||
78 | # Temp mv to non .py locations | |
79 | cd $RPM_BUILD_ROOT%{_bindir} | |
80 | %{__mv} carbon-aggregator.py carbon-aggregator | |
81 | %{__mv} carbon-cache.py carbon-cache | |
82 | %{__mv} carbon-client.py carbon-client | |
83 | %{__mv} carbon-relay.py carbon-relay | |
84 | %{__mv} validate-storage-schemas.py validate-storage-schemas | |
85 | ||
86 | # Delete conf examples as they go to doc anyway | |
87 | # /var/lib/carbon/conf/aggregation-rules.conf.example | |
88 | %{__rm} $RPM_BUILD_ROOT/var/lib/carbon/conf/*conf.example | |
89 | %{__rmdir} $RPM_BUILD_ROOT/var/lib/carbon/conf | |
90 | ||
91 | # Delete bogus logs | |
92 | %{__rmdir} $RPM_BUILD_ROOT/var/lib/carbon/storage/log | |
93 | ||
94 | # Mv /var/lib/carbon/storage one lever higher | |
95 | %{__mv} $RPM_BUILD_ROOT/var/lib/carbon/storage/* $RPM_BUILD_ROOT/var/lib/carbon | |
96 | %{__rmdir} $RPM_BUILD_ROOT/var/lib/carbon/storage | |
97 | ||
98 | ||
99 | %clean | |
100 | rm -rf $RPM_BUILD_ROOT | |
101 | ||
102 | %pre | |
103 | %groupadd -g 290 -r carbon | |
104 | %useradd -u 290 -r -g carbon -d %{_sharedstatedir}/carbon -s /sbin/nologin -c "Carbon cache daemon" carbon | |
105 | ||
106 | %post | |
107 | /sbin/chkconfig --add carbon-aggregator | |
108 | /sbin/chkconfig --add carbon-cache | |
109 | /sbin/chkconfig --add carbon-relay | |
110 | %service carbon-aggregator restart | |
111 | %service carbon-cache restart | |
112 | %service carbon-relay restart | |
113 | ||
114 | %preun | |
115 | if [ $1 -eq 0 ]; then | |
116 | /sbin/chkconfig --del carbon-aggregator | |
117 | /sbin/chkconfig --del carbon-cache | |
118 | /sbin/chkconfig --del carbon-relay | |
119 | %service carbon-aggregator stop | |
120 | %service carbon-cache stop | |
121 | %service carbon-relay stop | |
122 | fi | |
123 | ||
124 | %postun | |
125 | if [ $1 = 0 ]; then | |
126 | %userremove carbon | |
127 | %groupremove carbon | |
128 | fi | |
129 | ||
130 | %files | |
131 | %defattr(644,root,root,755) | |
132 | %doc conf/* | |
133 | %dir %{_sysconfdir}/%{name} | |
134 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/carbon.conf | |
135 | %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/storage-schemas.conf | |
136 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/carbon | |
137 | %attr(754,root,root) /etc/rc.d/init.d/carbon-aggregator | |
138 | %attr(754,root,root) /etc/rc.d/init.d/carbon-cache | |
139 | %attr(754,root,root) /etc/rc.d/init.d/carbon-relay | |
140 | %attr(755,root,root) %{_bindir}/carbon-aggregator | |
141 | %attr(755,root,root) %{_bindir}/carbon-cache | |
142 | %attr(755,root,root) %{_bindir}/carbon-client | |
143 | %attr(755,root,root) %{_bindir}/carbon-relay | |
144 | %attr(755,root,root) %{_bindir}/validate-storage-schemas | |
145 | ||
146 | %dir %{py_sitescriptdir}/%{name} | |
147 | %attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_publisher.py | |
148 | %attr(755,root,root) %{py_sitescriptdir}/%{name}/amqp_listener.py | |
149 | %{py_sitescriptdir}/%{name}/*.py[co] | |
150 | %{py_sitescriptdir}/%{name}/amqp0-8.xml | |
151 | %dir %{py_sitescriptdir}/%{name}/aggregator | |
152 | %{py_sitescriptdir}/%{name}/aggregator/*.py[co] | |
153 | %{py_sitescriptdir}/%{name}-%{version}-py*.egg-info | |
154 | ||
155 | # FIXME/CHECKME: twisted itself packages %{py_sitedir}/twisted/plugins dir | |
156 | %dir %{py_sitescriptdir}/twisted | |
157 | %dir %{py_sitescriptdir}/twisted/plugins | |
158 | %{py_sitescriptdir}/twisted/plugins/carbon_*.py[co] | |
159 | ||
160 | %dir %{_localstatedir}/run/%{name} | |
161 | %dir %attr(775,root,carbon) %{_localstatedir}/log/%{name} | |
162 | %dir %attr(775,root,root) %{_sharedstatedir}/%{name} | |
163 | %dir %attr(775,root,carbon) %{_sharedstatedir}/%{name}/rrd | |
164 | %dir %attr(775,root,carbon) %{_sharedstatedir}/%{name}/whisper | |
165 | %dir %attr(775,root,carbon) %{_sharedstatedir}/%{name}/lists |