This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
Simplify, fix and clean up the spec file and related files #3
Open
thias
wants to merge
4
commits into
id:master
Choose a base branch
from
thias:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
85a3631
Simplify, fix and clean up the spec file and related files
thias 4dedce6
Add java-headless requirement and re-enable Makefile build
thias 41e81ce
Add nagios-plugins-zookeeper subpackage
60514b4
Merge pull request #1 from lisuml/nagios_plugin
thias File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
/var/log/zookeeper/*.log { | ||
weekly | ||
rotate 4 | ||
maxsize 100M | ||
minsize 10M | ||
copytruncate | ||
delaycompress | ||
compress | ||
notifempty | ||
missingok | ||
weekly | ||
rotate 4 | ||
maxsize 100M | ||
minsize 10M | ||
copytruncate | ||
compress | ||
missingok | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ After=network.target | |
|
||
[Service] | ||
User=zookeeper | ||
Group=zookeeper | ||
EnvironmentFile=/etc/sysconfig/zookeeper | ||
Environment=CLASSPATH=@CLASSPATH@ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suggest to change this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If that works, sure! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does. |
||
ExecStart=/bin/java -cp $CLASSPATH $LOG4J $JVMFLAGS $ZOOMAIN $ZOOCFG | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,88 @@ | ||
%define __jar_repack 0 | ||
%define debug_package %{nil} | ||
%define name zookeeper | ||
%define _prefix /opt | ||
%define _conf_dir %{_sysconfdir}/zookeeper | ||
%define _log_dir %{_var}/log/zookeeper | ||
%define _data_dir %{_sharedstatedir}/zookeeper | ||
|
||
Summary: ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. | ||
%global __jar_repack 0 | ||
%global zk_prefix %{_javadir}/zookeeper | ||
%global zk_confdir %{_sysconfdir}/zookeeper | ||
%global zk_logdir %{_var}/log/zookeeper | ||
%global zk_datadir %{_sharedstatedir}/zookeeper | ||
|
||
%{!?zk_version:%global zk_version 3.4.9} | ||
%{!?zk_release:%global zk_release 3} | ||
|
||
Summary: High-performance coordination service for distributed applications | ||
Name: zookeeper | ||
Version: %{version} | ||
Release: %{build_number} | ||
License: Apache License, Version 2.0 | ||
Version: %{zk_version} | ||
Release: %{zk_release}%{?dist} | ||
License: ASL 2.0 and BSD | ||
Group: Applications/Databases | ||
URL: http://zookeper.apache.org/ | ||
Source0: zookeeper-%{version}.tar.gz | ||
URL: https://zookeeper.apache.org/ | ||
Source0: https://www.apache.org/dyn/closer.cgi/zookeeper/zookeeper-%{version}/zookeeper-%{version}.tar.gz | ||
Source1: zookeeper.service | ||
Source2: zookeeper.logrotate | ||
Source3: zoo.cfg | ||
Source4: log4j.properties | ||
Source5: log4j-cli.properties | ||
Source6: zookeeper.sysconfig | ||
Source7: zkcli | ||
BuildRoot: %{_tmppath}/%{name}-%{version}-root | ||
Prefix: %{_prefix} | ||
Vendor: Apache Software Foundation | ||
Packager: Ivan Dyachkov <[email protected]> | ||
Provides: zookeeper | ||
Source2: zkcli | ||
Source3: zookeeper.logrotate | ||
Source4: zookeeper.sysconfig | ||
Source5: zoo.cfg | ||
Source6: log4j.properties | ||
Source7: log4j-cli.properties | ||
%{?systemd_requires} | ||
BuildRequires: systemd | ||
Requires(post): systemd | ||
Requires(preun): systemd | ||
Requires(postun): systemd | ||
BuildArch: noarch | ||
Requires: java-headless | ||
|
||
%description | ||
ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services. All of these kinds of services are used in some form or another by distributed applications. Each time they are implemented there is a lot of work that goes into fixing the bugs and race conditions that are inevitable. Because of the difficulty of implementing these kinds of services, applications initially usually skimp on them ,which make them brittle in the presence of change and difficult to manage. Even when done correctly, different implementations of these services lead to management complexity when the applications are deployed. | ||
ZooKeeper is a high-performance coordination service for distributed | ||
applications. It exposes common services - such as naming, configuration | ||
management, synchronization, and group services - in a simple interface so | ||
you don't have to write them from scratch. You can use it off-the-shelf to | ||
implement consensus, group management, leader election, and presence | ||
protocols. And you can build on it for your own, specific needs. | ||
|
||
|
||
%package -n nagios-plugins-zookeeper | ||
Group: Applications/System | ||
Summary: Provides check_zookeeper support for Nagios | ||
BuildArch: noarch | ||
Requires: nagios-plugins | ||
|
||
%description -n nagios-plugins-zookeeper | ||
Provides check_zookeeper support for Nagios. | ||
|
||
|
||
%prep | ||
%setup | ||
%setup -q | ||
|
||
%build | ||
|
||
%install | ||
mkdir -p $RPM_BUILD_ROOT%{_prefix}/zookeeper | ||
mkdir -p $RPM_BUILD_ROOT%{_log_dir} | ||
mkdir -p $RPM_BUILD_ROOT%{_data_dir} | ||
mkdir -p $RPM_BUILD_ROOT%{_unitdir}/zookeeper.service.d | ||
mkdir -p $RPM_BUILD_ROOT%{_conf_dir}/ | ||
install -p -D -m 644 zookeeper-%{version}.jar $RPM_BUILD_ROOT%{_prefix}/zookeeper/ | ||
install -p -D -m 644 lib/*.jar $RPM_BUILD_ROOT%{_prefix}/zookeeper/ | ||
install -p -D -m 755 %{S:1} $RPM_BUILD_ROOT%{_unitdir}/ | ||
install -p -D -m 644 %{S:2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zookeeper | ||
install -p -D -m 644 %{S:3} $RPM_BUILD_ROOT%{_conf_dir}/ | ||
install -p -D -m 644 %{S:4} $RPM_BUILD_ROOT%{_conf_dir}/ | ||
install -p -D -m 644 %{S:5} $RPM_BUILD_ROOT%{_conf_dir}/ | ||
install -p -D -m 644 %{S:6} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zookeeper | ||
install -p -D -m 755 %{S:7} $RPM_BUILD_ROOT/usr/local/bin/zkcli | ||
install -p -D -m 644 conf/configuration.xsl $RPM_BUILD_ROOT%{_conf_dir}/ | ||
# stupid systemd fails to expand file paths in runtime | ||
# JARs | ||
mkdir -p $RPM_BUILD_ROOT%{zk_prefix} | ||
install -p -m 0644 zookeeper-%{version}.jar lib/*.jar \ | ||
$RPM_BUILD_ROOT%{zk_prefix}/ | ||
# Service, systemd fails to expand file paths in runtime | ||
mkdir -p $RPM_BUILD_ROOT%{_unitdir} | ||
CLASSPATH= | ||
for i in $RPM_BUILD_ROOT%{_prefix}/zookeeper/*.jar | ||
do | ||
CLASSPATH="%{_prefix}/zookeeper/$(basename ${i}):${CLASSPATH}" | ||
for i in $RPM_BUILD_ROOT%{zk_prefix}/*.jar; do | ||
CLASSPATH="%{zk_prefix}/$(basename ${i}):${CLASSPATH}" | ||
done | ||
echo "[Service]" > $RPM_BUILD_ROOT%{_unitdir}/zookeeper.service.d/classpath.conf | ||
echo "Environment=CLASSPATH=${CLASSPATH}" >> $RPM_BUILD_ROOT%{_unitdir}/zookeeper.service.d/classpath.conf | ||
|
||
%clean | ||
rm -rf $RPM_BUILD_ROOT | ||
sed -e "s|@CLASSPATH@|${CLASSPATH}|" %{S:1} > \ | ||
$RPM_BUILD_ROOT%{_unitdir}/zookeeper.service | ||
# CLI | ||
install -p -D -m 0755 %{S:2} $RPM_BUILD_ROOT%{_bindir}/zkcli | ||
# Configuration | ||
install -p -D -m 0644 %{S:3} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zookeeper | ||
install -p -D -m 0644 %{S:4} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zookeeper | ||
mkdir -p $RPM_BUILD_ROOT%{zk_confdir}/ | ||
install -p -m 0644 %{S:5} %{S:6} %{S:7} conf/configuration.xsl \ | ||
$RPM_BUILD_ROOT%{zk_confdir}/ | ||
# Empty directories | ||
mkdir -p $RPM_BUILD_ROOT%{zk_logdir} | ||
mkdir -p $RPM_BUILD_ROOT%{zk_datadir} | ||
# Nagios plugin | ||
install -D -p -m 0755 src/contrib/monitoring/check_zookeeper.py \ | ||
$RPM_BUILD_ROOT%{_libdir}/nagios/plugins/check_zookeeper | ||
|
||
%pre | ||
/usr/bin/getent group zookeeper >/dev/null || /usr/sbin/groupadd -r zookeeper | ||
if ! /usr/bin/getent passwd zookeeper >/dev/null ; then | ||
/usr/sbin/useradd -r -g zookeeper -m -d %{_prefix}/zookeeper -s /bin/bash -c "Zookeeper" zookeeper | ||
if ! /usr/bin/getent passwd zookeeper >/dev/null; then | ||
/usr/sbin/useradd -r -g zookeeper -M -N -d %{zk_prefix} -s /bin/bash -c "Zookeeper" zookeeper | ||
fi | ||
|
||
%post | ||
|
@@ -80,22 +92,30 @@ fi | |
%systemd_preun zookeeper.service | ||
|
||
%postun | ||
# When the last version of a package is erased, $1 is 0 | ||
# Otherwise it's an upgrade and we need to restart the service | ||
if [ $1 -ge 1 ]; then | ||
/usr/bin/systemctl restart zookeeper.service | ||
fi | ||
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || : | ||
%systemd_postun_with_restart zookeeper.service | ||
|
||
%files | ||
%defattr(-,root,root) | ||
%license LICENSE.txt | ||
%{zk_prefix}/ | ||
%{_unitdir}/zookeeper.service | ||
%{_unitdir}/zookeeper.service.d/classpath.conf | ||
/usr/local/bin/zkcli | ||
%{_bindir}/zkcli | ||
%config(noreplace) %{_sysconfdir}/logrotate.d/zookeeper | ||
%config(noreplace) %{_sysconfdir}/sysconfig/zookeeper | ||
%config(noreplace) %{_conf_dir}/* | ||
%attr(-,zookeeper,zookeeper) %{_prefix}/zookeeper | ||
%attr(0755,zookeeper,zookeeper) %dir %{_log_dir} | ||
%attr(0700,zookeeper,zookeeper) %dir %{_data_dir} | ||
%dir %{zk_confdir}/ | ||
%config(noreplace) %{zk_confdir}/* | ||
%attr(0755,zookeeper,zookeeper) %dir %{zk_logdir}/ | ||
%attr(0700,zookeeper,zookeeper) %dir %{zk_datadir}/ | ||
|
||
%files -n nagios-plugins-zookeeper | ||
%{_libdir}/nagios/plugins/check_zookeeper | ||
|
||
%changelog | ||
* Tue Nov 22 2016 Michał Lisowski <[email protected]> - 3.4.9-3 | ||
- Add nagios-plugins-zookeeper subpackage | ||
|
||
* Wed Oct 26 2016 Matthias Saou <[email protected]> 3.4.9-2 | ||
- Add java-headless requirement. | ||
|
||
* Tue Oct 11 2016 Matthias Saou <[email protected]> 3.4.9-1 | ||
- Simplify, fix and clean up the spec file and related files. | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove delaycompress and notifempty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a minsize set, so notifempty becomes irrelevant. As for delaycompress, it's only really useful when you think the log file will still be written to for a short file after being rotated, and I don't think that can ever be the case with copytruncate.