diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..3c8fe05b096 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +*.sh text eol=lf +*.env text eol=lf +*.service text eol=lf +*.conf text eol=lf diff --git a/NOTICE b/NOTICE index 1dd5ce4aa01..1aae3088f23 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache Ignite -Copyright 2021 The Apache Software Foundation +Copyright 2022 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c614f5e7ea9..ffe77013393 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -83,6 +83,7 @@ javacc = "com.intershop.gradle.javacc:4.0.1" shadow = "com.github.johnrengelman.shadow:7.1.2" cmake = "net.freudasoft.gradle-cmake-plugin:0.0.4" modernizer = "com.github.andygoossens.modernizer:1.6.2" +nebula = "nebula.ospackage:9.1.1" docker = "com.palantir.docker:0.34.0" [libraries] diff --git a/modules/runner/build.gradle b/modules/runner/build.gradle index fa345487114..8f0c743de51 100644 --- a/modules/runner/build.gradle +++ b/modules/runner/build.gradle @@ -99,3 +99,11 @@ dependencies { checkstyleMain { enabled = false } + +jar { + manifest { + attributes( + 'Main-Class': 'org.apache.ignite.app.IgniteCliRunner' + ) + } +} diff --git a/packaging/build.gradle b/packaging/build.gradle index a9ab66d713f..aeed596bc1f 100644 --- a/packaging/build.gradle +++ b/packaging/build.gradle @@ -19,6 +19,7 @@ plugins { id 'java' id 'distribution' alias(libs.plugins.docker) + alias(libs.plugins.nebula) } configurations { @@ -27,6 +28,8 @@ configurations { cliScripts } +import org.apache.tools.ant.filters.ReplaceTokens + dependencies { dbArtifacts(project(':ignite-runner')) cliArtifacts(project(':ignite-cli')) @@ -60,9 +63,9 @@ def dbContents = spec -> { from ("$rootDir/assembly/README.md") } into('etc') { - from ("$rootDir/packaging/scripts/bootstrap-config") - from ("$rootDir/packaging/config/ignite-config.conf") - from ("$rootDir/packaging/config/ignite.java.util.logging.properties") + from ("${buildDir}/scripts/bootstrap-config") + from ("${buildDir}/config/ignite-config.conf") + from ("${buildDir}/config/ignite.java.util.logging.properties") } into('bin') { fileMode 0755 @@ -129,3 +132,92 @@ task allDistZip(type: Zip) { } allDistZip.dependsOn cliDistZip, dbDistZip + +def tokens = [ + PRODUCT_NAME : 'ignite3db', + PRODUCT_DISPLAY_NAME : 'Apache Ignite', + USERNAME : 'ignite3', + GROUPNAME : 'ignite3', + INSTALL_DIR : '/usr/share/ignite3db', + CONF_DIR : '/etc/ignite3db', + LOG_DIR : '/var/log/ignite3db', + PID_DIR : '/var/run/ignite3db', + VARS_FILE_NAME : 'vars.env', + MIN_PRODUCT_VERSION : project.version.toString(), + PRODUCT_VERSION : project.version.toString(), + IGNITE_CONF_FILE : 'ignite-config.conf', + IGNITE_WORK_DIR : '/usr/share/ignite3db/work' +] + +task replaceConfigVars(type: Copy) { + from("${projectDir}/config") + filter(ReplaceTokens, tokens: tokens) + into("${buildDir}/config") +} + +task replaceScriptVars(type: Copy) { + from("${projectDir}/linux") + filter(ReplaceTokens, tokens: tokens) + into("${buildDir}/linux") +} + +buildRpm { + dependsOn replaceScriptVars, replaceConfigVars + configurationFile = "/etc/ignite3/vars.env" + + installUtils file("${buildDir}/linux/service/vars.env") + installUtils file("${buildDir}/linux/common.sh") + preInstall file("${buildDir}/linux/preInstall.sh") + postInstall file("${buildDir}/linux/postInstall.sh") + preUninstall file("${buildDir}/linux/rpm/preUninstall.sh") + postUninstall file("${buildDir}/linux/rpm/postUninstall.sh") +} + +buildDeb { + dependsOn replaceScriptVars, replaceConfigVars + configurationFile = "/etc/ignite3/vars.env" + + installUtils file("${buildDir}/linux/service/vars.env") + installUtils file("${buildDir}/linux/common.sh") + preInstall file("${buildDir}/linux/preInstall.sh") + postInstall file("${buildDir}/linux/postInstall.sh") + preUninstall file("${buildDir}/linux/deb/preUninstall.sh") + postUninstall file("${buildDir}/linux/deb/postUninstall.sh") +} + +ospackage { + license "ASL 2.0" + packageName 'ignite3db' + packageGroup "System Environment/Daemons" + url "https://ignite.apache.org" + user tokens.USERNAME + packageDescription "This package will install Apache Ignite" + os LINUX + + into(tokens.INSTALL_DIR) { + into("") { + from "${buildDir}/linux/service/ignite3db.service" + from "${buildDir}/linux/service/ignite3db.conf" + from("${buildDir}/linux/start.sh") { + fileMode 0755 + } + } + + into("lib") { + from configurations.dbArtifacts + } + + into("etc") { + fileType CONFIG + from "${buildDir}/linux/service/vars.env" + from "${buildDir}/config/ignite.java.util.logging.properties" + from "${buildDir}/config/ignite-config.conf" + } + + into("etc") { + from sourceSets.main.resources + } + } + link "/etc/ignite3db", "${tokens.INSTALL_DIR}/etc/" + link "/opt/ignite3db", "${tokens.INSTALL_DIR}" +} diff --git a/packaging/config/ignite.java.util.logging.properties b/packaging/config/ignite.java.util.logging.properties index 312b25682e5..c173554dd53 100644 --- a/packaging/config/ignite.java.util.logging.properties +++ b/packaging/config/ignite.java.util.logging.properties @@ -25,7 +25,7 @@ # # Comma-separated list of logging "handlers". Note that some of them may be # reconfigured (or even removed) at runtime according to system properties. -handlers=java.util.logging.ConsoleHandler +handlers=java.util.logging.FileHandler # # Default global logging level. @@ -37,9 +37,11 @@ handlers=java.util.logging.ConsoleHandler # .level=INFO -# Console handler logs all messages with importance level `INFO` and above +# Console handler logs all messages with importance level `SEVERE` and above # into standard error stream (`System.err`). # -java.util.logging.ConsoleHandler.formatter = org.apache.ignite.lang.JavaLoggerFormatter -java.util.logging.ConsoleHandler.level = INFO -java.util.logging.ConsoleHandler.encoding = UTF-8 +java.util.logging.FileHandler.formatter = org.apache.ignite.lang.JavaLoggerFormatter +java.util.logging.FileHandler.pattern = @LOG_DIR@/ignite3db-%g.log +java.util.logging.FileHandler.level = INFO +java.util.logging.FileHandler.limit = 10485760 +java.util.logging.FileHandler.count = 10 diff --git a/packaging/deb/changelog b/packaging/deb/changelog deleted file mode 100644 index ede72c0f3fb..00000000000 --- a/packaging/deb/changelog +++ /dev/null @@ -1,5 +0,0 @@ -apache-ignite (3.0.0-1) unstable; urgency=low - - * Apache Ignite 3 initial release - - -- Petr Ivanov Mon, 25 Oct 2021 17:19:00 +0300 diff --git a/packaging/deb/control b/packaging/deb/control deleted file mode 100644 index 35b34734734..00000000000 --- a/packaging/deb/control +++ /dev/null @@ -1,14 +0,0 @@ -Source: apache-ignite -Maintainer: Petr Ivanov -Section: misc -Priority: optional -Standards-Version: 4.1.1.1 - -Package: apache-ignite -Architecture: all -Section: misc -Priority: optional -Depends: openjdk-11-jdk | default-jdk | java-sdk, passwd -Description: Apache Ignite is a distributed database for high-performance - computing with in-memory speed. -Homepage: https://ignite.apache.org diff --git a/packaging/deb/copyright b/packaging/deb/copyright deleted file mode 100644 index 51fca54c2a0..00000000000 --- a/packaging/deb/copyright +++ /dev/null @@ -1,11 +0,0 @@ -Licensed 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. diff --git a/packaging/deb/rules b/packaging/deb/rules deleted file mode 100644 index 53ba30e7af0..00000000000 --- a/packaging/deb/rules +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/make -f -# debian/rules for alien - -PACKAGE=$(shell dh_listpackages) - -clean: - dh_testdir - dh_testroot - dh_clean -d - -binary-arch: clean - dh_testdir - dh_testroot - dh_prep - dh_installdirs - - dh_installdocs - dh_installchangelogs - - # Copy the packages's files. - find . -maxdepth 1 -mindepth 1 -not -name debian -print0 | \ - xargs -0 -r -i cp -a {} debian/$(PACKAGE) - - # - # If you need to move files around in debian/$(PACKAGE) or do some - # binary patching, do it here - # - - dh_compress - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-arch diff --git a/packaging/linux/common.sh b/packaging/linux/common.sh new file mode 100644 index 00000000000..41c98c85158 --- /dev/null +++ b/packaging/linux/common.sh @@ -0,0 +1,79 @@ +#!/bin/sh +# +# 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. +# + +source_user_group() { + USERNAME="@USERNAME@" + GROUPNAME="@GROUPNAME@" + + if [ ! "$(getent passwd ${USERNAME})" ]; then + /usr/sbin/useradd "${USERNAME}" + fi + + if [ ! "$(getent group ${GROUPNAME})" ]; then + sudo groupadd "${GROUPNAME}" + sudo usermod -a -G "${GROUPNAME}" "${USERNAME}" + fi + + if [ -f "@CONF_DIR@/@VARS_FILE_NAME@" ]; then . "@CONF_DIR@/@VARS_FILE_NAME@"; fi +} + +pre_uninstall() { + if command -v initctl >/dev/null && initctl version | grep upstart >/dev/null; then + if test -f '@PID_DIR@/@PRODUCT_NAME@.pid'; then + initctl stop '@PRODUCT_NAME@' >/dev/null 2>&1 + fi + elif command -v systemctl >/dev/null && systemctl --version | grep systemd >/dev/null; then + if (systemctl is-active --quiet '@PRODUCT_NAME@'); then + systemctl stop '@PRODUCT_NAME@' >/dev/null 2>&1 + fi + if (systemctl is-enabled --quiet '@PRODUCT_NAME@'); then + systemctl disable '@PRODUCT_NAME@' + fi + else + pid=$(pgrep -f '@PRODUCT_NAME@') + [ -n "$pid" ] && kill "$pid" + sleep 5 + pid=$(pgrep -f '@PRODUCT_NAME@') + [ -n "$pid" ] && kill -9 "$pid" + fi +} + +post_uninstall_remove() { + /bin/rm -rf '@INSTALL_DIR@' >/dev/null 2>&1 + /bin/rm -rf '@LOG_DIR@' >/dev/null 2>&1 + if command -v initctl >/dev/null && initctl version | grep upstart >/dev/null; then + /bin/rm -f '/etc/init/@PRODUCT_NAME@.conf' >/dev/null 2>&1 + /bin/rm -rf '@PID_DIR@' >/dev/null 2>&1 + initctl reload-configuration + echo " @PRODUCT_DISPLAY_NAME@ uninstalled successfully." + elif command -v systemctl >/dev/null && systemctl --version | grep systemd >/dev/null; then + /bin/rm -f '/usr/lib/systemd/system/@PRODUCT_NAME@.service' >/dev/null 2>&1 + systemctl daemon-reload + echo " @PRODUCT_DISPLAY_NAME@ uninstalled successfully." +fi +} + +post_uninstall_upgrade() { + if command -v initctl >/dev/null && initctl version | grep upstart >/dev/null; then + initctl restart '@PRODUCT_NAME@' + echo " @PRODUCT_DISPLAY_NAME@ upgraded successfully." + elif command -v systemctl >/dev/null && systemctl --version | grep systemd >/dev/null; then + systemctl restart '@PRODUCT_NAME@' + echo " @PRODUCT_DISPLAY_NAME@ upgraded successfully." + fi +} diff --git a/packaging/linux/deb/postUninstall.sh b/packaging/linux/deb/postUninstall.sh new file mode 100644 index 00000000000..2149309b042 --- /dev/null +++ b/packaging/linux/deb/postUninstall.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# +# 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. +# + +case "$1" in + remove|purge) + post_uninstall_remove + ;; + upgrade) + post_uninstall_upgrade +esac diff --git a/packaging/linux/deb/preUninstall.sh b/packaging/linux/deb/preUninstall.sh new file mode 100644 index 00000000000..f521cf20978 --- /dev/null +++ b/packaging/linux/deb/preUninstall.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# 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. +# + +pre_uninstall diff --git a/packaging/linux/postInstall.sh b/packaging/linux/postInstall.sh new file mode 100644 index 00000000000..4abc440b417 --- /dev/null +++ b/packaging/linux/postInstall.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# 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. +# + +USERNAME='@USERNAME@' +GROUPNAME='@GROUPNAME@' + +setup_directories() { +# echo "setup directories" + [ -d '@CONF_DIR@' ] || install -d '@CONF_DIR@' --owner="${USERNAME}" --group="${GROUPNAME}" --mode=0775 + [ -d '@PID_DIR@' ] || install -d '@PID_DIR@' --owner="${USERNAME}" --group="${GROUPNAME}" + [ -d '@LOG_DIR@' ] || install -d '@LOG_DIR@' --owner="${USERNAME}" --group="${GROUPNAME}" + [ -d '@IGNITE_WORK_DIR@' ] || install -d '@IGNITE_WORK_DIR@' --owner="${USERNAME}" --group="${GROUPNAME}" + + /bin/chown -R "${USERNAME}:${GROUPNAME}" '@INSTALL_DIR@' + /bin/chown -R "${USERNAME}:${GROUPNAME}" '@LOG_DIR@' + /bin/chown -R "${USERNAME}:${GROUPNAME}" '@CONF_DIR@' + /bin/chown -R "${USERNAME}:${GROUPNAME}" '@PID_DIR@' +} + +setup_service_files() { + if command -v initctl >/dev/null && initctl version | grep upstart >/dev/null; then + ln -sf '@INSTALL_DIR@/@PRODUCT_NAME@.conf' /etc/init/ + initctl reload-configuration + elif command -v systemctl >/dev/null && systemctl --version | grep systemd >/dev/null; then + mkdir -p /usr/lib/systemd/system + ln -sf '@INSTALL_DIR@/@PRODUCT_NAME@.service' /usr/lib/systemd/system/ + systemctl daemon-reload + systemctl enable '@INSTALL_DIR@/@PRODUCT_NAME@.service' >/dev/null 2>&1 + else + echo + echo "We could not detect Upstart or Systemd. You can start the process manually using @INSTALL_DIR@/start.sh" + echo + fi +} + +setup_directories +setup_service_files + +echo +echo " @PRODUCT_DISPLAY_NAME@ installed successfully." +echo diff --git a/packaging/linux/preInstall.sh b/packaging/linux/preInstall.sh new file mode 100644 index 00000000000..e21edac9d88 --- /dev/null +++ b/packaging/linux/preInstall.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# +# 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. +# + +source_user_group diff --git a/packaging/linux/rpm/postUninstall.sh b/packaging/linux/rpm/postUninstall.sh new file mode 100644 index 00000000000..d20048a4209 --- /dev/null +++ b/packaging/linux/rpm/postUninstall.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# 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. +# + +if [ "$1" -eq 0 ]; then + post_uninstall_remove +elif [ "$1" -eq 1 ]; then + post_uninstall_upgrade +fi diff --git a/packaging/linux/rpm/preUninstall.sh b/packaging/linux/rpm/preUninstall.sh new file mode 100644 index 00000000000..db6d685e90c --- /dev/null +++ b/packaging/linux/rpm/preUninstall.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# +# 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. +# + +if [ "$1" -eq 0 ]; then + pre_uninstall +fi diff --git a/packaging/linux/service/ignite3db.conf b/packaging/linux/service/ignite3db.conf new file mode 100644 index 00000000000..fd8b3379e64 --- /dev/null +++ b/packaging/linux/service/ignite3db.conf @@ -0,0 +1,36 @@ +# +# 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. +# + +description "Apache Ignite is a distributed database for high-performance computing with in-memory speed" +author "Apache" + +start on filesystem or runlevel [345] +stop on shutdown + +respawn +respawn limit 5 60 + +script + . '@CONF_DIR@/vars.env' + echo $$ > '@PID_DIR@/@PRODUCT_NAME@.pid' + exec su -s /bin/sh -c 'cd @INSTALL_DIR@; + exec "$0" "$@"' "${USERNAME}" -- '@INSTALL_DIR@/start.sh' "$1" +end script + +post-stop script + rm '@PID_DIR@/@PRODUCT_NAME@.pid' +end script diff --git a/packaging/linux/service/ignite3db.service b/packaging/linux/service/ignite3db.service new file mode 100644 index 00000000000..928398e5897 --- /dev/null +++ b/packaging/linux/service/ignite3db.service @@ -0,0 +1,34 @@ +# +# 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. +# + +[Unit] +Description=Apache Ignite is a distributed database for high-performance computing with in-memory speed + +[Service] +User=@USERNAME@ +Group=@GROUPNAME@ +WorkingDirectory=@INSTALL_DIR@ +ExecStart=@INSTALL_DIR@/start.sh %i +SuccessExitStatus=143 +Type=simple +Restart=on-failure +RestartSec=5 +StartLimitBurst=5 +StartLimitInterval=60 + +[Install] +WantedBy=multi-user.target diff --git a/packaging/linux/service/vars.env b/packaging/linux/service/vars.env new file mode 100644 index 00000000000..094eb5d30c1 --- /dev/null +++ b/packaging/linux/service/vars.env @@ -0,0 +1,32 @@ +# +# 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. +# + +#Run props +NODE_NAME=node1 +WORK_DIR=@IGNITE_WORK_DIR@ +CONFIG_FILE=@CONF_DIR@/@IGNITE_CONF_FILE@ + +#JVM props +JVM_MAX_MEM="16384m" +JVM_MIN_MEM="16384m" +JVM_GC="G1GC" +JVM_G1HeapRegionSize="32M" +JVM_GC_LOG_NAME="gc.log.$(date -u +%Y%m%d_%H%M%S)" +JVM_GC_LOG_SIZE="104857600" +JVM_GC_NUM_LOGS="10" +##For any additional users settings +IGNITE3_EXTRA_JVM_ARGS= diff --git a/packaging/linux/start.sh b/packaging/linux/start.sh new file mode 100644 index 00000000000..c9d17b354f9 --- /dev/null +++ b/packaging/linux/start.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 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. +# + +. @CONF_DIR@/@VARS_FILE_NAME@ + +CMD="java \ +--add-opens java.base/java.lang=ALL-UNNAMED \ +--add-opens java.base/java.lang.invoke=ALL-UNNAMED \ +--add-opens java.base/java.lang.reflect=ALL-UNNAMED \ +--add-opens java.base/java.io=ALL-UNNAMED \ +--add-opens java.base/java.nio=ALL-UNNAMED \ +--add-opens java.base/java.math=ALL-UNNAMED \ +--add-opens java.base/java.util=ALL-UNNAMED \ +--add-opens java.base/jdk.internal.misc=ALL-UNNAMED \ +-Dfile.encoding=UTF-8 \ +-XX:+HeapDumpOnOutOfMemoryError \ +-XX:+ExitOnOutOfMemoryError \ +-XX:HeapDumpPath=@LOG_DIR@ \ +-Xlog:gc=info:file=@LOG_DIR@/${JVM_GC_LOG_NAME}::filecount=${JVM_GC_NUM_LOGS},filesize=${JVM_GC_LOG_SIZE} \ +-Dio.netty.tryReflectionSetAccessible=true \ +-Djava.util.logging.config.file=@CONF_DIR@/ignite.java.util.logging.properties \ +${IGNITE3_EXTRA_JVM_ARGS} \ +-classpath @INSTALL_DIR@/lib:@INSTALL_DIR@/lib/* org.apache.ignite.app.IgniteCliRunner \ +--config-path ${CONFIG_FILE} \ +--work-dir ${WORK_DIR} \ +${NODE_NAME}" + +${CMD} diff --git a/packaging/rpm/.gitignore b/packaging/rpm/.gitignore deleted file mode 100644 index 6760d345b89..00000000000 --- a/packaging/rpm/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -ignite -*.rpm diff --git a/packaging/rpm/Dockerfile b/packaging/rpm/Dockerfile deleted file mode 100644 index a5a66206e00..00000000000 --- a/packaging/rpm/Dockerfile +++ /dev/null @@ -1,42 +0,0 @@ -# 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. - - -FROM centos:8 - - -ENV TZ=Europe/Moscow -ARG RPM_WORK_DIR="/tmp" -ARG PACKAGE_VERSION - - -WORKDIR ${RPM_WORK_DIR} - - -# Install dependencies -RUN yum check-update || true && \ - yum install -y rpm-build - - -# Copy build required files -COPY apache-ignite.spec \ - ignite \ - build.sh \ - ./ - - -# Run build -RUN bash build.sh ${PACKAGE_VERSION} - diff --git a/packaging/rpm/README.md b/packaging/rpm/README.md deleted file mode 100644 index 2fabbd9bc85..00000000000 --- a/packaging/rpm/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# Apache Ignite RPM package build - - -### Prerequisites - -* **Operation system**: CentOS 8 - -* **Packages**: rpm-build - -* **Assembled and prepared Apache Ignite**: -```bash -cd -mvn clean package -Dmaven.test.skip -cp -rfv modules/cli/target/ignite \ - deliveries/rpm/ -``` - -* **Exported package version variable** -```bash -cd deliveries/rpm -PACKAGE_VERSION="$(grep -E '^\*' apache-ignite.spec | head -1 | sed -r 's|.*\s-\s||')" -``` - -
- - -### Building -Run build script (from RPM build directory): -```bash -bash build.sh "${PACKAGE_VERSION}" -``` -Built RPM package will be in RPM build directory - -
- -### Building in Docker -Run from RPM build directory: -```bash - -docker build . --pull \ - --build-arg PACKAGE_VERSION="${PACKAGE_VERSION}" \ - -t apache-ignite-rpm:${PACKAGE_VERSION} -docker run --rm \ - --entrypoint \ - cat apache-ignite-rpm:${PACKAGE_VERSION} /tmp/apache-ignite-${PACKAGE_VERSION}.noarch.rpm > apache-ignite-${PACKAGE_VERSION}.noarch.rpm -``` -Built RPM package will be in RPM build directory - diff --git a/packaging/rpm/apache-ignite.spec b/packaging/rpm/apache-ignite.spec deleted file mode 100644 index 3574569efc4..00000000000 --- a/packaging/rpm/apache-ignite.spec +++ /dev/null @@ -1,235 +0,0 @@ -# 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. - -%define __jar_repack %{nil} -%define user ignite -%define _libdir /usr/lib -%define _log %{_var}/log -%define _sharedstatedir /var/lib - - - -#------------------------------------------------------------------------------- -# -# Packages' descriptions -# -Name: apache-ignite -Version: 3.0.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 -Requires: java-11 which -Requires(pre): shadow-utils -Provides: %{name} -AutoReq: no -AutoProv: no -BuildArch: noarch -%description -Apache Ignite is a distributed database for high-performance computing with in-memory speed. - - - -%pre -#------------------------------------------------------------------------------- -# -# Preinstall scripts -# $1 can be: -# 1 - Initial installation -# 2 - Upgrade -# -echo "Preinstall mode: '$1'" -case $1 in - 1|install) - # Add service user - /usr/sbin/useradd -r -M -d /usr/share/apache-ignite -s /bin/bash ignite - ;; -esac - - - -%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 "=======================================================================================================" -} - -case $1 in - 1|configure) - # DEB postinst upgrade - if [ ! -z "${2}" ]; then - echoUpgradeMessage - fi - - # Set firewall rules - if [[ "$(type firewall-cmd &>/dev/null; echo $?)" -eq 0 && "$(systemctl is-active firewalld 2>/dev/null)" == "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 - ;; - 2) - # RPM postinst upgrade - echoUpgradeMessage -esac - -# Copy and configure skel -cp -rfv /etc/skel/.bash* %{_datadir}/%{name} -echo "cd ~" >> %{_datadir}/%{name}/.bashrc - -# Change ownership for work and log directories (yum resets permissions on upgrade nevertheless) -chown -R %{user}:%{user} %{_datadir}/%{name} \ - %{_sharedstatedir}/%{name} \ - %{_log}/%{name} \ - %{_bindir}/ignite - - - -%preun -#------------------------------------------------------------------------------- -# -# Pre-uninstall scripts -# $1 can be: -# 0 - Uninstallation -# 1 - Upgrade -# - -stopIgniteNodes () { - echo "Stopping ignite nodes" -} - -case $1 in - 0|remove) - # Stop all nodes (both service and standalone) - stopIgniteNodes - ;; - 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/%{name} \ - /usr/share/${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 - - - -%install -#------------------------------------------------------------------------------- -# -# Prepare packages' layout -# - -# Create base directory structure -mkdir -pv %{buildroot}%{_datadir}/%{name} -mkdir -pv %{buildroot}%{_libdir}/%{name} -mkdir -pv %{buildroot}%{_log}/%{name} -mkdir -pv %{buildroot}%{_sharedstatedir}/%{name} -mkdir -pv %{buildroot}%{_sysconfdir}/%{name} -mkdir -pv %{buildroot}%{_bindir} - -# Install binary -cp -rfv ignite %{buildroot}%{_bindir} -chmod +x %{buildroot}%{_bindir}/ignite - -# Install ignite-cli configuraton file -touch %{buildroot}%{_sysconfdir}/%{name}/cfg -echo "bin=%{_libdir}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}/cfg -echo "work=%{_sharedstatedir}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}/cfg -echo "config=%{_sysconfdir}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}/cfg -echo "log=%{_log}/%{name}" >> %{buildroot}%{_sysconfdir}/%{name}/cfg -ln -sfv %{_sysconfdir}/%{name}/cfg %{buildroot}%{_datadir}/%{name}/.ignitecfg - - - -%files -#------------------------------------------------------------------------------- -# -# Package file list check -# - -%dir %{_datadir}/%{name} -%dir %{_sysconfdir}/%{name} -%dir %{_sharedstatedir}/%{name} -%dir %{_log}/%{name} - -%{_libdir}/%{name} -%{_bindir}/ignite -%{_sysconfdir}/%{name} -%{_datadir}/%{name}/.ignitecfg - - -%changelog -#------------------------------------------------------------------------------- -# -# Changelog -# - -* Fri Dec 11 2020 Petr Ivanov - 3.0.0-1 -- Apache Ignite 3 initial release - diff --git a/packaging/rpm/build.sh b/packaging/rpm/build.sh deleted file mode 100644 index f4e8d11c623..00000000000 --- a/packaging/rpm/build.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env 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 -o nounset; set -o errexit; set -o pipefail; set -o errtrace; set -o functrace - - -## VARS ## -PACKAGE_VERSION="${1}" -RPM_WORK_DIR="/tmp/apache-ignite-rpm" -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - - -## START ## -cd ${SCRIPT_DIR} -mkdir -pv ${RPM_WORK_DIR}/{BUILD,RPMS,SOURCES,SPECS,SRPMS} -cp -rfv ignite ${RPM_WORK_DIR}/BUILD/ -cp -rfv apache-ignite.spec ${RPM_WORK_DIR}/SPECS/ -sed -r "4 i if [ \"\$(whoami)\" != \"ignite\" ]; then echo \"Ignite CLI can only be run by 'ignite' user.\"; echo \"Swith user to ignite by executing '(sudo) su ignite'\"; exit 1; fi" \ - -i ${RPM_WORK_DIR}/BUILD/ignite -rpmbuild -bb \ - --define "_topdir ${RPM_WORK_DIR}" \ - ${RPM_WORK_DIR}/SPECS/apache-ignite.spec -cp -rfv ${RPM_WORK_DIR}/RPMS/noarch/apache-ignite-${PACKAGE_VERSION}.noarch.rpm ./ - diff --git a/packaging/scripts/bootstrap-config b/packaging/scripts/bootstrap-config deleted file mode 100644 index e9030c15f2c..00000000000 --- a/packaging/scripts/bootstrap-config +++ /dev/null @@ -1,10 +0,0 @@ -NODE_NAME=defaultNode - -WORK_PATH=$IGNITE_HOME/work -LOGS_PATH=$IGNITE_HOME/log -LIBS_PATH=$IGNITE_HOME/lib -BIN_PATH=$IGNITE_HOME/bin -CONFIG_PATH=$IGNITE_HOME/etc - -IGNITE_CONFIG_FILE=$CONFIG_PATH/ignite-config.conf -LOG_OUT_FILE=$LOGS_PATH/${NODE_NAME}.log diff --git a/packaging/zip/bootstrap-config b/packaging/zip/bootstrap-config new file mode 100644 index 00000000000..2c224ff62ef --- /dev/null +++ b/packaging/zip/bootstrap-config @@ -0,0 +1,27 @@ +# +# 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. +# + +NODE_NAME=defaultNode + +WORK_PATH=$IGNITE_HOME/work +LOGS_PATH=$IGNITE_HOME/log +LIBS_PATH=$IGNITE_HOME/lib +BIN_PATH=$IGNITE_HOME/bin +CONFIG_PATH=$IGNITE_HOME/etc + +IGNITE_CONFIG_FILE=$CONFIG_PATH/ignite-config.conf +LOG_OUT_FILE=$LOGS_PATH/${NODE_NAME}.log diff --git a/packaging/zip/start.sh b/packaging/zip/start.sh new file mode 100644 index 00000000000..51f33b204d7 --- /dev/null +++ b/packaging/zip/start.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +# +# 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. +# + +############# STAGE 1: SETUP ENV ############### + +# LOAD VARIABLES +. $IGNITE_HOME/config/bootstrap-config + + + +############# STAGE 2: BUILD CMD ############### + +# FORM A START COMMAND +CMD="$JAVA_HOME/bin/java \ +--add-opens java.base/java.lang=ALL-UNNAMED \ +--add-opens java.base/java.lang.invoke=ALL-UNNAMED \ +--add-opens java.base/java.lang.reflect=ALL-UNNAMED \ +--add-opens java.base/java.io=ALL-UNNAMED \ +--add-opens java.base/java.nio=ALL-UNNAMED \ +--add-opens java.base/java.math=ALL-UNNAMED \ +--add-opens java.base/java.util=ALL-UNNAMED \ +--add-opens java.base/jdk.internal.misc=ALL-UNNAMED \ +-Dio.netty.tryReflectionSetAccessible=true \ +-Djava.util.logging.config.file=$CONFIG_PATH/ignite.java.util.logging.properties \ +-classpath $LIBS_PATH/ignite-runner.jar:$LIBS_PATH/* org.apache.ignite.app.IgniteCliRunner \ +--config-path $IGNITE_CONFIG_FILE \ +--work-dir $WORK_PATH \ +$NODE_NAME" + + + +############# STAGE 3: RUN CMD, REPORT ############### + +# RUN CMD +exec ${CMD} >>${LOG_OUT_FILE:-/dev/null} 2>&1 < /dev/null & jobs -p > pid + +# TODO: SAVE PROCESS PID AND LINK IT WITH THE NODE NAME + +# TODO: WAIT FOR NODE IS STARTED + +# TODO: REPORT SUCCESS OR FAILURE + +# TODO: SHOW HOW TO CONNECT TO THE STARTED NODE + diff --git a/packaging/deb/build.sh b/packaging/zip/stop.sh similarity index 100% rename from packaging/deb/build.sh rename to packaging/zip/stop.sh