diff --git a/2.9.0.tar.gz b/2.9.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e85e61ddb4e3227e460d6fb60379d9ccdbb9dda1 Binary files /dev/null and b/2.9.0.tar.gz differ diff --git a/ignite.spec b/ignite.spec new file mode 100644 index 0000000000000000000000000000000000000000..a96fb01029b5b15b9fcec7131d2ca473cbe6d59f --- /dev/null +++ b/ignite.spec @@ -0,0 +1,253 @@ +%define __jar_repack %{nil} +%define user ignite +%define _log %{_var}/log + + +Name: ignite +Version: 2.9.0 +Release: 1 +Summary: Apache Ignite In-Memory Computing, Database and Caching Platform +Group: Development/System +License: ASL 2.0 +URL: https://ignite.apache.org/ +Source0: https://github.com/apache/ignite/archive/%{version}.tar.gz +Source1: name.service +Source2: service.sh +Source3: settings.xml +BuildRequires: java-1.8.0-openjdk-devel maven +Requires: java-1.8.0, systemd +Requires(pre): shadow-utils +Provides: apache-%{name} +Provides: %{name} +AutoReq: no +AutoProv: no +BuildArch: noarch +%description +Ignite™ is a memory-centric distributed database, caching, and processing +platform for transactional, analytical, and streaming workloads, delivering +in-memory speeds at petabyte scale + +%prep +%autosetup -p1 -n ignite-%{version} + +%build +cp %{SOURCE3} ./ +mvn initialize -Prelease -DskipTests install -Pall-java,all-scala,licenses # -s settings.xml + +%install +cd target/bin/ +unzip apache-%{name}-%{version}-bin.zip +cd apache-%{name}-%{version}-bin +mkdir -p %{buildroot}%{_datadir}/apache-%{name} +mkdir -p %{buildroot}%{_libdir}/apache-%{name} +mkdir -p %{buildroot}%{_datadir}/doc/apache-%{name}-%{version}/bin +mkdir -p %{buildroot}%{_log}/apache-%{name} +mkdir -p %{buildroot}%{_sharedstatedir}/apache-%{name} +mkdir -p %{buildroot}%{_sysconfdir}/systemd/system +mkdir -p %{buildroot}%{_bindir} + +# Copy nessessary files and remove *.bat files +cp -rf benchmarks bin platforms %{buildroot}%{_datadir}/apache-%{name} +cp -rf examples %{buildroot}%{_datadir}/doc/apache-%{name}-%{version} +mv -f %{buildroot}%{_datadir}/apache-%{name}/bin/ignitevisorcmd.sh %{buildroot}%{_datadir}/doc/apache-%{name}-%{version}/bin/ +find %{buildroot}%{_datadir}/apache-%{name}/ -name *.bat -exec rm -rf {} \; + +# Copy libs to /usr/lib and map them to IGNITE_HOME +cp -rf libs/* %{buildroot}%{_libdir}/apache-%{name} +ln -sf %{_libdir}/apache-%{name} %{buildroot}%{_datadir}/apache-%{name}/libs + +# Setup configuration +cp -rf config %{buildroot}%{_sysconfdir}/apache-%{name} +ln -sf %{_sysconfdir}/apache-%{name} %{buildroot}%{_datadir}/apache-%{name}/config + +# Setup systemctl service +cp -rf %{SOURCE1} %{buildroot}%{_sysconfdir}/systemd/system/apache-%{name}@.service +cp -rf %{SOURCE2} %{buildroot}%{_datadir}/apache-%{name}/bin/ +chmod +x %{buildroot}%{_datadir}/apache-%{name}/bin/service.sh +for file in %{buildroot}%{_sysconfdir}/systemd/system/apache-%{name}@.service %{buildroot}%{_datadir}/apache-%{name}/bin/service.sh +do + sed -i -r -e "s|#name#|apache-%{name}|g" \ + -e "s|#user#|%{user}|g" \ + ${file} +done + +# Map work and log directories +ln -sf %{_sharedstatedir}/apache-%{name} %{buildroot}%{_datadir}/apache-%{name}/work +ln -sf %{_log}/apache-%{name} %{buildroot}%{_sharedstatedir}/apache-%{name}/log + + +#%pre +#------------------------------------------------------------------------------- +# +# Preinstall scripts +# $1 can be: +# 1 - Initial install +# 2 - Upgrade +# + + +%post +#------------------------------------------------------------------------------- +# +# Postinstall scripts +# $1 can be: +# 1 - Initial installation +# 2 - Upgrade +# + +echoUpgradeMessage () { + echo "=======================================================================================================" + echo " WARNING: Updating Apache Ignite's cluster version requires updating every node before starting grid " + echo "=======================================================================================================" +} + +setPermissions () { + chown -R %{user}:%{user} %{_sharedstatedir}/apache-%{name} %{_log}/apache-%{name} +} + +case $1 in + 1|configure) + # DEB postinst upgrade + if [ ! -z "${2}" ]; then + echoUpgradeMessage + fi + + # Add user for service operation + useradd -r -d %{_datadir}/apache-%{name} -s /usr/sbin/nologin %{user} + + # Change ownership for work and log directories + setPermissions + + # Install alternatives + # Commented out until ignitevisorcmd / ignitesqlline is ready to work from any user + #update-alternatives --install %{_bindir}/ignitevisorcmd ignitevisorcmd %{_datadir}/apache-%{name}/bin/ignitevisorcmd.sh 0 + #update-alternatives --auto ignitevisorcmd + #update-alternatives --display ignitevisorcmd + #update-alternatives --install %{_bindir}/ignitesqlline ignitesqlline %{_datadir}/apache-%{name}/bin/sqlline.sh 0 + #update-alternatives --auto ignitesqlline + #update-alternatives --display ignitesqlline + ;; + 2) + # RPM postinst upgrade + echoUpgradeMessage + + # Workaround for upgrade from 2.4.0 + if [ -d /usr/com/apache-ignite/ ]; then + for file in /usr/com/apache-ignite/*; do + if [ ! -h $file ]; then + cp -rf $file %{_sharedstatedir}/apache-%{name}/ + fi + done + fi + + # Change ownership for work and log directories (yum resets permissions on upgrade nevertheless) + setPermissions + ;; +esac + + +%preun +#------------------------------------------------------------------------------- +# +# Pre-uninstall scripts +# $1 can be: +# 0 - Uninstallation +# 1 - Upgrade +# + +stopIgniteNodes () { + if ! $(grep -q "Microsoft" /proc/version); then + systemctl stop 'apache-ignite@*' + fi + ps ax | grep '\-DIGNITE_HOME' | head -n-1 | awk {'print $1'} | while read pid; do + kill -INT ${pid} + done +} + +case $1 in + 0|remove) + # Stop all nodes (both service and standalone) + stopIgniteNodes + + # Remove alternatives + # Commented out until ignitevisorcmd / ignitesqlline is ready to work from any user + #update-alternatives --remove ignitevisorcmd /usr/share/apache-%{name}/bin/ignitevisorcmd.sh + #update-alternatives --display ignitevisorcmd || true + #update-alternatives --remove ignitesqlline /usr/share/apache-%{name}/bin/sqlline.sh + #update-alternatives --display ignitesqlline || true + ;; + 1|upgrade) + # Stop all nodes (both service and standalone) + echo "==================================================================================" + echo " WARNING: All running Apache Ignite's nodes will be stopped upon package update " + echo "==================================================================================" + stopIgniteNodes + ;; +esac + + +%postun +#------------------------------------------------------------------------------- +# +# Post-uninstall scripts +# $1 can be: +# 0 - Uninstallation +# 1 - Upgrade +# + +case $1 in + 0|remove) + # Remove user + userdel %{user} + + # Remove service PID directory + rm -rfv /var/run/apache-%{name} + + # Remove firewalld rules if firewalld is installed and running + if [[ "$(type firewall-cmd &>/dev/null; echo $?)" -eq 0 && "$(systemctl is-active firewalld)" == "active" ]] + then + for port in s d + do + firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -p tcp -m multiport --${port}ports 11211:11220,47500:47509,47100:47109 -j ACCEPT &>/dev/null + firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -p udp -m multiport --${port}ports 47400:47409 -j ACCEPT &>/dev/null + done + firewall-cmd --permanent --direct --remove-rule ipv4 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT &>/dev/null + systemctl restart firewalld + fi + ;; + 1|upgrade) + : + ;; +esac + + +%files + +%dir %{_datadir}/apache-%{name} +%dir %{_sysconfdir}/apache-%{name} +%dir %{_sharedstatedir}/apache-%{name} +%dir %{_log}/apache-%{name} + +%{_datadir}/apache-%{name}/benchmarks +%{_datadir}/apache-%{name}/bin +%{_datadir}/apache-%{name}/config +%{_datadir}/apache-%{name}/libs +%{_datadir}/apache-%{name}/platforms +%{_datadir}/apache-%{name}/work +%{_datadir}/doc/apache-%{name}-%{version} +%{_libdir}/apache-%{name} +%{_sysconfdir}/systemd/system/apache-%{name}@.service +%{_sharedstatedir}/apache-%{name}/log + +%config(noreplace) %{_sysconfdir}/apache-%{name}/* + +%doc README.txt +%doc NOTICE +%doc RELEASE_NOTES.txt +%doc MIGRATION_GUIDE.txt +%license LICENSE + + +%changelog +* Mon Dec 14 2020 weidong - 2.9.0-1 +- Initial package. diff --git a/name.service b/name.service new file mode 100644 index 0000000000000000000000000000000000000000..78b5d252464dd9b48fe075f93d3c9d5ea1dc1121 --- /dev/null +++ b/name.service @@ -0,0 +1,17 @@ +[Unit] +Description=Apache Ignite In-Memory Computing Platform Service +After=syslog.target network.target + +[Service] +Type=forking +User=#user# +WorkingDirectory=/usr/share/#name#/work +PermissionsStartOnly=true +ExecStartPre=-/usr/bin/mkdir -p /var/run/#name# +ExecStartPre=-/usr/bin/chown #user#:#user# /var/run/#name# +ExecStartPre=-/usr/bin/env bash /usr/share/#name#/bin/service.sh set-firewall +ExecStart=/usr/share/#name#/bin/service.sh start %i +PIDFile=/var/run/#name#/%i.pid + +[Install] +WantedBy=multi-user.target diff --git a/service.sh b/service.sh new file mode 100644 index 0000000000000000000000000000000000000000..454478d7a7b85a830736d1d65486f8bde234a036 --- /dev/null +++ b/service.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +firewallCmd="firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0" + +# Define function to check whether firewalld is present and started and apply firewall rules for grid nodes +setFirewall () +{ + if [[ "$(type firewall-cmd &>/dev/null; echo $?)" -eq 0 && "$(systemctl is-active firewalld)" == "active" ]] + then + for port in s d + do + ${firewallCmd} -p tcp -m multiport --${port}ports 11211:11220,47500:47509,47100:47109 -j ACCEPT &>/dev/null + ${firewallCmd} -p udp -m multiport --${port}ports 47400:47409 -j ACCEPT &>/dev/null + done + ${firewallCmd} -m pkttype --pkt-type multicast -j ACCEPT &>/dev/null + + systemctl restart firewalld + fi +} + +case $1 in + start) + /usr/share/#name#/bin/ignite.sh /etc/#name#/$2 & echo $! >> /var/run/#name#/$2.pid + ;; + set-firewall) + setFirewall + ;; +esac diff --git a/settings.xml b/settings.xml new file mode 100644 index 0000000000000000000000000000000000000000..5c9d68e8af193ee9dd4bf497242ee9f0bfb05ba9 --- /dev/null +++ b/settings.xml @@ -0,0 +1,264 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + nexus-aliyun + central + Nexus aliyun + http://maven.aliyun.com/nexus/content/groups/public/ + + + + + + + + + + + + +