forked from jfroche/solr-rpm
-
Notifications
You must be signed in to change notification settings - Fork 9
/
jetty-solr.spec
282 lines (237 loc) · 9.81 KB
/
jetty-solr.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
%define _prefix /opt/solr
%define _logprefix /var/log/solr
%define _javaprefix /usr/lib/jvm
%define _core01_name core01
%define _core01_enabled true
%define _core02_name core02
%define _core02_enabled false
%define _notify_email youremail@yourdomain.com
%define _solr_gid 8983
%define _solr_uid 8983
# Prevent brp-java-repack-jars from being run.
%define __jar_repack %{nil}
Name: jetty-solr
Version: %{sver}
Release: 1%{?dist}
Summary: Solr
License: GPL
URL: http://lucene.apache.org/solr/
Source: http://www.us.apache.org/dist/lucene/solr/%{version}/solr-%{version}.tgz
Source1: http://download.eclipse.org/jetty/%{jver}/dist/jetty-distribution-%{jver}.tar.gz
Source2: http://archive.apache.org/dist/logging/log4j/extras/%{l4xver}/apache-log4j-extras-%{l4xver}-bin.tar.gz
Source3: etc.default.jetty-solr
Source4: jmx.passwd
Source5: jmx.access
Source6: java_error.sh
Source7: java_oom.sh
Source8: log4j.xml
Patch0: jetty.xml-remove_requestlog.patch
Patch1: jetty-requestlog.xml-configure_filenaming.patch
Patch2: jetty-jmx.xml-enable_rmi_tcp1099.patch
Patch3: jetty.sh-redirect_init_output.patch
Patch4: jetty.sh-use_etc_default_jetty-solr.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Requires(pre): shadow-utils
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts
Requires: java7 => 1:1.7.0
Requires: mailx
%description
RPM build for Solr using builtin Jetty
https://github.com/boogieshafer/jetty-solr-rpm
%prep
%setup -q -n solr-%{version}
#rm -r example/example-DIH
#rm -r example/exampledocs
#rm -r example/example-schemaless
#rm -r example/multicore
#rm example/resources/log4j.properties
#rm example/scripts/cloud-scripts/zkcli.bat
#rm dist/solr-%{version}.war
mkdir -p server/solr/%{_core01_name}
cp -R server/solr/configsets/basic_configs/conf server/solr/%{_core01_name}
mv server/solr/%{_core01_name}/conf/schema.xml server/solr/%{_core01_name}/conf/schema-%{_core01_name}.xml
mv server/solr/%{_core01_name}/conf/solrconfig.xml server/solr/%{_core01_name}/conf/solrconfig-%{_core01_name}.xml
echo "name="%{_core01_name} > server/solr/%{_core01_name}/core.properties.unloaded
echo "schema=schema-"%{_core01_name}".xml" >> server/solr/%{_core01_name}/core.properties.unloaded
echo "config=solrconfig-"%{_core01_name}".xml" >> server/solr/%{_core01_name}/core.properties.unloaded
echo "loadOnStartup="%{_core01_enabled} >> server/solr/%{_core01_name}/core.properties.unloaded
%if "%{_core01_enabled}" == "true"
mv server/solr/%{_core01_name}/core.properties.unloaded server/solr/%{_core01_name}/core.properties
%else
# no need to rename
%endif
#%patch0 -p0
%setup -q -D -T -b 1 -n jetty-distribution-%{jver}
#%patch1 -p0
#%patch2 -p0
#%patch3 -p0
#%patch4 -p0
%setup -q -D -T -b 2 -n apache-log4j-extras-%{l4xver}
%build
%install
rm -rf $RPM_BUILD_ROOT
%__install -d "%{buildroot}%{_prefix}"
cp -p $RPM_BUILD_DIR/solr-%{version}/*.txt "%{buildroot}%{_prefix}"
cp -pr $RPM_BUILD_DIR/solr-%{version}/bin "%{buildroot}%{_prefix}"
cp -pr $RPM_BUILD_DIR/solr-%{version}/contrib "%{buildroot}%{_prefix}"
cp -pr $RPM_BUILD_DIR/solr-%{version}/dist "%{buildroot}%{_prefix}"
cp -pr $RPM_BUILD_DIR/solr-%{version}/docs "%{buildroot}%{_prefix}"
cp -pr $RPM_BUILD_DIR/solr-%{version}/licenses "%{buildroot}%{_prefix}"
%__install -d "%{buildroot}%{_prefix}/jetty-solr"
cp -pr $RPM_BUILD_DIR/solr-%{version}/server/* "%{buildroot}%{_prefix}/jetty-solr"
mkdir -p "%{buildroot}%{_prefix}/jetty-solr/.java/.systemPrefs"
cp -p $RPM_BUILD_DIR/apache-log4j-extras-%{l4xver}/apache-log4j-extras-%{l4xver}.jar "%{buildroot}%{_prefix}/jetty-solr/lib/ext"
%__install -d "%{buildroot}%{_prefix}"/jetty-solr/solr/"%{_core01_name}"/data
%__install -d "%{buildroot}%{_prefix}"/jetty-solr/solr/lib
%__install -d "%{buildroot}"/etc/default
%__install -d "%{buildroot}"/etc/init.d
%__install -d "%{buildroot}%{_logprefix}"
%__install -D -m0644 "%{SOURCE3}" %{buildroot}/etc/default/jetty-solr
%__install -D -m0600 "%{SOURCE4}" %{buildroot}%{_prefix}/jetty-solr/resources/jmx.passwd
%__install -D -m0644 "%{SOURCE5}" %{buildroot}%{_prefix}/jetty-solr/resources/jmx.access
%__install -D -m0755 "%{SOURCE6}" %{buildroot}%{_prefix}/jetty-solr/etc/java_error.sh
%__install -D -m0755 "%{SOURCE7}" %{buildroot}%{_prefix}/jetty-solr/etc/java_oom.sh
%__install -D -m0644 "%{SOURCE8}" %{buildroot}%{_prefix}/jetty-solr/resources/log4j.xml
%__install -D -m0755 $RPM_BUILD_DIR/jetty-distribution-%{jver}/bin/jetty.sh %{buildroot}/etc/init.d/jetty-solr
%__install -D -m0644 $RPM_BUILD_DIR/jetty-distribution-%{jver}/etc/jetty-requestlog.xml %{buildroot}%{_prefix}/jetty-solr/etc/jetty-requestlog.xml
%__install -D -m0644 $RPM_BUILD_DIR/jetty-distribution-%{jver}/etc/jetty-jmx.xml %{buildroot}%{_prefix}/jetty-solr/etc/jetty-jmx.xml
sed -i "s|JETTY_HOME_REPLACE|%{_prefix}|g" "%{buildroot}/etc/default/jetty-solr"
sed -i "s|JETTY_LOGS_REPLACE|%{_logprefix}|g" "%{buildroot}/etc/default/jetty-solr"
sed -i "s|JAVA_HOME_REPLACE|%{_javaprefix}|g" "%{buildroot}/etc/default/jetty-solr"
sed -i "s|./logs|%{_logprefix}|g" "%{buildroot}%{_prefix}/jetty-solr/etc/jetty-requestlog.xml"
sed -i "s|notify@domain.com|%{_notify_email}|g" "%{buildroot}%{_prefix}/jetty-solr/etc/java_error.sh"
sed -i "s|notify@domain.com|%{_notify_email}|g" "%{buildroot}%{_prefix}/jetty-solr/etc/java_oom.sh"
sed -i "s|./logs|%{_logprefix}|g" "%{buildroot}%{_prefix}/jetty-solr/resources/log4j.xml"
%clean
#rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,solr,solr,-)
%attr(0755,solr,solr) %dir %{_prefix}
%if "%{_logprefix}" == "%{_prefix}/jetty-solr/logs"
# do nothing
%else
%attr(0755,solr,solr) %dir %{_logprefix}
%endif
%{_prefix}/bin
%{_prefix}/contrib
%{_prefix}/dist
%doc %{_prefix}/docs
%{_prefix}/example
%{_prefix}/jetty-solr
%doc %{_prefix}/licenses
%doc %{_prefix}/CHANGES.txt
%doc %{_prefix}/LICENSE.txt
%doc %{_prefix}/LUCENE_CHANGES.txt
%doc %{_prefix}/NOTICE.txt
%doc %{_prefix}/README.txt
%attr(0755,root,root) /etc/init.d/jetty-solr
%config %attr(0644,root,root) /etc/default/jetty-solr
%pre
mkdir -p %{_prefix}
getent group solr >/dev/null || groupadd -g %{_solr_gid} solr
getent passwd solr >/dev/null || \
useradd -g %{_solr_gid} -u %{_solr_uid} -d %{_prefix}/jetty-solr -s /bin/bash \
-c "Solr User" solr
exit 0
%post
chkconfig --add jetty-solr
echo "Installation complete."
%preun
if [ $1 = 0 ] ; then
service jetty-solr stop >/dev/null 2>&1 || :
chkconfig --del jetty-solr
fi
%postun
if [ "$1" -ge "1" ] ; then
service jetty-solr restart >/dev/null 2>&1 || :
fi
%changelog
* Thu Oct 15 2015 Boogie Shafer <boogieshafer@yahoo.com>
- 5.3.1-1
- initial 5.x update
* Thu Mar 26 2015 Boogie Shafer <boogieshafer@yahoo.com>
- 4.10.4-1
- update for 4.10.4
* Thu Jan 08 2015 Boogie Shafer <boogieshafer@yahoo.com>
- 4.10.3-1
- update for 4.10.3
- upgrade log4jextras to 1.2.17 to match bundled log4j
* Thu Nov 06 2014 Boogie Shafer <boogieshafer@yahoo.com>
- 4.10.2-1
- update for 4.10.2
* Tue May 20 2014 Boogie Shafer <boogieshafer@yahoo.com>
- 4.8.1-1
- update for 4.8.1
* Wed Apr 02 2014 Boogie Shafer <boogieshafer@yahoo.com>
- 4.7.1-1
- update for solr 4.7.x
- disable jar repack during rpmbuild process
* Fri Nov 15 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.5.1-4
- add lib4j extras to enable compression on rotation
- make name of second core more obvious
- clean up log naming
- remove extra solr war file from rpm
* Fri Nov 15 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.5.1-3
- replace log4j.properties with log4j.xml
- fix problem with SOLR GUI logging by sending solr logs to root logger
- create second, disabled core02
- fix URL to archived jetty build
* Thu Nov 14 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.5.1-1
- update for solr 4.5.1 release
* Wed Jul 31 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.4.0-1
- update for solr 4.4.0 release
- remove logback and slf4j updates in favor of bundled log4j
* Thu Jun 20 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.3.1-1
- changed java GC to CMS
* Fri Jun 14 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.3.0-4
- rename /etc/default/jetty to /etc/default/jetty-solr
* Thu May 14 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.3.0-3
- upgrade logback components to 1.0.13 release
- add java option for gc.log rotation
* Wed May 8 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.3.0-2
- remove solr bundled log4j 1.2.16 and slf4j 1.6.6 jars, replace with logback 1.0.12 and slf4j 1.7.5 jars
- fix jetty init script hangs for remote restarts via ssh
* Mon Apr 29 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.2.1-6
- move logging jars to ext dir to match future location in 4.3.x solr releases
- add GC printing options to startup
- add lib dir support for solr/lib area
- add recommeded java options from jetty's start.ini to etc/default/jetty. most commented out for now
* Mon Apr 22 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.2.1-4
- remove logging jars from solr.war
- adjust logback settings
* Fri Apr 19 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.2.1-3
- configure JMX support in jetty
* Thu Apr 18 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.2.1-2
- switch logging to logback
* Wed Apr 17 2013 Boogie Shafer <boogieshafer@yahoo.com>
- 4.2.1-1
- make collection name configurable
- build using 4.2.1 solr binary release
- change default installation location to /opt/solr
- pull jetty init script and logging configs from jetty 8.x distribution
* Mon Mar 25 2013 Boogie Shafer <boogieshafer@yahoo.com>
- adjust version for 4.2.0
* Wed Feb 20 2013 Boogie Shafer <boogieshafer@yahoo.com>
- change path to data directory to place it under collection1
- adjust logging settings for solr
* Tue Feb 12 2013 Boogie Shafer <boogieshafer@yahoo.com>
- edits to configure jetty logging
* Tue Jan 29 2013 Boogie Shafer <boogieshafer@yahoo.com>
- edits for 4.1.0 solr using bundled jetty and zookeeper
* Tue Jan 18 2012 Jean-Francois Roche <jfroche@affinitic.be>
- Initial implementation