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