From 084d420298c9c1d7b8ee2b8659ca0949a4419bcb Mon Sep 17 00:00:00 2001 From: David Moravek Date: Wed, 13 Jul 2016 16:29:11 +0200 Subject: [PATCH 1/4] BIGTOP-2492 Split flink debian packaging --- bigtop-packages/src/deb/flink/control | 10 ++++ .../src/deb/flink/flink-jobmanager.postinst | 33 ++++++++++++ .../src/deb/flink/flink-jobmanager.preinst | 51 +++++++++++++++++++ .../src/deb/flink/flink-jobmanager.prerm | 38 ++++++++++++++ .../src/deb/flink/flink-taskmanager.postinst | 33 ++++++++++++ .../src/deb/flink/flink-taskmanager.preinst | 51 +++++++++++++++++++ .../src/deb/flink/flink-taskmanager.prerm | 38 ++++++++++++++ bigtop-packages/src/deb/flink/flink.postinst | 1 + bigtop-packages/src/deb/flink/flink.prerm | 1 + bigtop-packages/src/deb/flink/rules | 5 -- 10 files changed, 256 insertions(+), 5 deletions(-) create mode 100644 bigtop-packages/src/deb/flink/flink-jobmanager.postinst create mode 100644 bigtop-packages/src/deb/flink/flink-jobmanager.preinst create mode 100644 bigtop-packages/src/deb/flink/flink-jobmanager.prerm create mode 100644 bigtop-packages/src/deb/flink/flink-taskmanager.postinst create mode 100644 bigtop-packages/src/deb/flink/flink-taskmanager.preinst create mode 100644 bigtop-packages/src/deb/flink/flink-taskmanager.prerm diff --git a/bigtop-packages/src/deb/flink/control b/bigtop-packages/src/deb/flink/control index a98bddc850..31d1e0ea11 100644 --- a/bigtop-packages/src/deb/flink/control +++ b/bigtop-packages/src/deb/flink/control @@ -27,3 +27,13 @@ Depends: bigtop-utils (>= 0.7), adduser Description: Flink’s core is a streaming dataflow engine that provides data distribution, communication, and fault tolerance for distributed computations over data streams. + +Package: flink-jobmanager +Architecture: all +Depends: flink +Description: Flink’s jobmanager. + +Package: flink-taskmanager +Architecture: all +Depends: flink +Description: Flink’s taskmanager. diff --git a/bigtop-packages/src/deb/flink/flink-jobmanager.postinst b/bigtop-packages/src/deb/flink/flink-jobmanager.postinst new file mode 100644 index 0000000000..767e3f62f3 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-jobmanager.postinst @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/bigtop-packages/src/deb/flink/flink-jobmanager.preinst b/bigtop-packages/src/deb/flink/flink-jobmanager.preinst new file mode 100644 index 0000000000..ed6263faf4 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-jobmanager.preinst @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# preinst script for flink +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/bigtop-packages/src/deb/flink/flink-jobmanager.prerm b/bigtop-packages/src/deb/flink/flink-jobmanager.prerm new file mode 100644 index 0000000000..4a65bf62f8 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-jobmanager.prerm @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/bigtop-packages/src/deb/flink/flink-taskmanager.postinst b/bigtop-packages/src/deb/flink/flink-taskmanager.postinst new file mode 100644 index 0000000000..767e3f62f3 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-taskmanager.postinst @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +case "$1" in + configure) + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/bigtop-packages/src/deb/flink/flink-taskmanager.preinst b/bigtop-packages/src/deb/flink/flink-taskmanager.preinst new file mode 100644 index 0000000000..ed6263faf4 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-taskmanager.preinst @@ -0,0 +1,51 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# preinst script for flink +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + install|upgrade) + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/bigtop-packages/src/deb/flink/flink-taskmanager.prerm b/bigtop-packages/src/deb/flink/flink-taskmanager.prerm new file mode 100644 index 0000000000..4a65bf62f8 --- /dev/null +++ b/bigtop-packages/src/deb/flink/flink-taskmanager.prerm @@ -0,0 +1,38 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/bigtop-packages/src/deb/flink/flink.postinst b/bigtop-packages/src/deb/flink/flink.postinst index 83b68af1a8..5d5ed9c856 100644 --- a/bigtop-packages/src/deb/flink/flink.postinst +++ b/bigtop-packages/src/deb/flink/flink.postinst @@ -1,4 +1,5 @@ #!/bin/bash +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. diff --git a/bigtop-packages/src/deb/flink/flink.prerm b/bigtop-packages/src/deb/flink/flink.prerm index bd4f28da98..295f5dbae9 100644 --- a/bigtop-packages/src/deb/flink/flink.prerm +++ b/bigtop-packages/src/deb/flink/flink.prerm @@ -1,4 +1,5 @@ #!/bin/bash +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. diff --git a/bigtop-packages/src/deb/flink/rules b/bigtop-packages/src/deb/flink/rules index 53a62fd629..f62d679ff6 100644 --- a/bigtop-packages/src/deb/flink/rules +++ b/bigtop-packages/src/deb/flink/rules @@ -39,8 +39,3 @@ override_dh_auto_install: jobmanager taskmanager --build-dir=`pwd`/build-target \ --source-dir=debian \ --prefix=debian/tmp - -# This should be fixed. Split flink in three packages: flink, flink-taskmanager, flink-jobmanager -override_dh_installinit: jobmanager taskmanager - dh_installinit --name=flink-taskmanager - dh_installinit --name=flink-jobmanager From 6cfd2b89788ed02b9bfa24be55267aa4ddbe553c Mon Sep 17 00:00:00 2001 From: David Moravek Date: Wed, 13 Jul 2016 19:41:08 +0200 Subject: [PATCH 2/4] BIGTOP-2492 Split flink rpm packaging --- .../src/rpm/flink/SPECS/flink.spec | 70 ++++++++++++++----- 1 file changed, 51 insertions(+), 19 deletions(-) diff --git a/bigtop-packages/src/rpm/flink/SPECS/flink.spec b/bigtop-packages/src/rpm/flink/SPECS/flink.spec index 0ef42a9a9a..df7aaafca4 100644 --- a/bigtop-packages/src/rpm/flink/SPECS/flink.spec +++ b/bigtop-packages/src/rpm/flink/SPECS/flink.spec @@ -27,10 +27,11 @@ %define doc_flink %{_docdir}/%{flink_name}-%{flink_version} %define alternatives_cmd alternatives %define build_flink %{_builddir}/%{flink_name}-%{flink_version}/flink-dist/target/%{flink_name}-%{flink_version}-bin/%{flink_name}-%{flink_version}/ - +%global initd_dir %{_sysconfdir}/rc.d/init.d %else %define doc_flink %{_docdir}/%{flink_name}-%{flink_version} %define alternatives_cmd update-alternatives +%global initd_dir %{_sysconfdir}/rc.d %endif Name: %{flink_name} @@ -53,6 +54,14 @@ Source6: bigtop.bom Requires: bigtop-utils >= 0.7 Requires(preun): /sbin/service +%if %{?suse_version:1}0 +# Required for init scripts +Requires: insserv +%else +# Required for init scripts +Requires: /lib/lsb/init-functions +%endif + %description Apache Flink is an open source platform for distributed stream and batch data processing. Flink’s core is a streaming dataflow engine that provides data distribution, communication, @@ -72,19 +81,38 @@ Some of the key features of Apache Flink includes. * Fault-tolerance via Lightweight Distributed Snapshots * Hadoop-native YARN & HDFS implementation -# Additions for master-worker configuration # +%package jobmanager +Summary: Provides the Apache Flink Job Manager service. +Group: System/Daemons +Requires: %{name} = %{version}-%{release} +Requires(pre): %{name} = %{version}-%{release} -%global initd_dir %{_sysconfdir}/init.d +%description jobmanager +Apache Flink Job Manager service. %if %{?suse_version:1}0 # Required for init scripts Requires: insserv -%global initd_dir %{_sysconfdir}/rc.d +%else +# Required for init scripts +Requires: /lib/lsb/init-functions +%endif + +%package taskmanager +Summary: Provides the Apache Flink Task Manager service. +Group: System/Daemons +Requires: %{name} = %{version}-%{release} +Requires(pre): %{name} = %{version}-%{release} +%description taskmanager +Apache Flink Task Manager service. + +%if %{?suse_version:1}0 +# Required for init scripts +Requires: insserv %else # Required for init scripts Requires: /lib/lsb/init-functions -%global initd_dir %{_sysconfdir}/rc.d/init.d %endif ############################################## @@ -106,8 +134,6 @@ bash $RPM_SOURCE_DIR/do-component-build sh -x %{SOURCE2} --prefix=$RPM_BUILD_ROOT --source-dir=$RPM_SOURCE_DIR --build-dir=`pwd`/build-target - - for service in %{flink_services} do # Install init script @@ -115,20 +141,10 @@ do bash %{SOURCE3} $RPM_SOURCE_DIR/${service}.svc rpm $init_file done - -%preun -for service in %{flink_services}; do - /sbin/service ${service} status > /dev/null 2>&1 - if [ $? -eq 0 ]; then - /sbin/service ${service} stop > /dev/null 2>&1 - fi -done - %pre getent group flink >/dev/null || groupadd -r flink getent passwd flink >/dev/null || useradd -c "Flink" -s /sbin/nologin -g flink -r -d %{lib_flink} flink 2> /dev/null || : - %post %{alternatives_cmd} --install %{config_flink} %{flink_name}-conf %{config_flink}.dist 30 systemctl daemon-reload @@ -140,10 +156,26 @@ systemctl daemon-reload %config(noreplace) %{config_flink}.dist %dir %{_sysconfdir}/%{flink_name} -%config(noreplace) %{initd_dir}/flink-jobmanager -%config(noreplace) %{initd_dir}/flink-taskmanager #%doc %{doc_flink} %attr(0755,flink,flink) %{var_log_flink} %attr(0767,flink,flink) /var/log/flink-cli %{lib_flink} %{bin_flink}/flink + +%define service_macro() \ +%files %1 \ +%config(noreplace) %{initd_dir}/%{name}-%1 \ +%post %1 \ +chkconfig --add %{name}-%1 \ +%preun %1 \ +/sbin/service ${name}-%1 status > /dev/null 2>&1 \ +if [ "$?" -eq 0 ]; then \ + service ${name}-%1 stop > /dev/null 2>&1 \ + chkconfig --del %{name}-%1 \ +fi \ +%postun %1 \ +if [ "$?" -ge 1 ]; then \ + service %{name}-%1 condrestart > /dev/null 2>&1 || : \ +fi +%service_macro jobmanager +%service_macro taskmanager From 327f54ad1452194533447af7e62afd1dc5963bfc Mon Sep 17 00:00:00 2001 From: David Moravek Date: Thu, 14 Jul 2016 09:17:16 +0200 Subject: [PATCH 3/4] BIGTOP-2492 Code review --- bigtop-packages/src/deb/flink/control | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/bigtop-packages/src/deb/flink/control b/bigtop-packages/src/deb/flink/control index 31d1e0ea11..c28c55039c 100644 --- a/bigtop-packages/src/deb/flink/control +++ b/bigtop-packages/src/deb/flink/control @@ -24,16 +24,15 @@ Homepage: http://flink.apache.org Package: flink Architecture: all Depends: bigtop-utils (>= 0.7), adduser -Description: Flink’s core is a streaming dataflow engine that provides data - distribution, communication, and fault tolerance for distributed - computations over data streams. +Description: Apache Flink is an open source platform for distributed stream + and batch data processing. Package: flink-jobmanager Architecture: all -Depends: flink -Description: Flink’s jobmanager. +Depends: flink (= ${source:Version}) +Description: Apache Flink Job Manager service. Package: flink-taskmanager Architecture: all -Depends: flink -Description: Flink’s taskmanager. +Depends: flink (= ${source:Version}) +Description: Apache Flink Task Manager Service. From ad06193bf16e9def55b6089b7ee83264b147bd87 Mon Sep 17 00:00:00 2001 From: David Moravek Date: Thu, 1 Sep 2016 17:38:04 +0200 Subject: [PATCH 4/4] BIGTOP-2492 Simplify and remove systemctl reload --- bigtop-packages/src/rpm/flink/SPECS/flink.spec | 9 --------- 1 file changed, 9 deletions(-) diff --git a/bigtop-packages/src/rpm/flink/SPECS/flink.spec b/bigtop-packages/src/rpm/flink/SPECS/flink.spec index df7aaafca4..a6465d3400 100644 --- a/bigtop-packages/src/rpm/flink/SPECS/flink.spec +++ b/bigtop-packages/src/rpm/flink/SPECS/flink.spec @@ -54,14 +54,6 @@ Source6: bigtop.bom Requires: bigtop-utils >= 0.7 Requires(preun): /sbin/service -%if %{?suse_version:1}0 -# Required for init scripts -Requires: insserv -%else -# Required for init scripts -Requires: /lib/lsb/init-functions -%endif - %description Apache Flink is an open source platform for distributed stream and batch data processing. Flink’s core is a streaming dataflow engine that provides data distribution, communication, @@ -147,7 +139,6 @@ getent passwd flink >/dev/null || useradd -c "Flink" -s /sbin/nologin -g flink - %post %{alternatives_cmd} --install %{config_flink} %{flink_name}-conf %{config_flink}.dist 30 -systemctl daemon-reload ###### FILES ###########