You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sk...@apache.org on 2022/10/20 12:21:43 UTC
[ignite-3] branch main updated: IGNITE-17781 Added RPM/DEB for CLI. Fixes #1219
This is an automated email from the ASF dual-hosted git repository.
sk0x50 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 616780915a IGNITE-17781 Added RPM/DEB for CLI. Fixes #1219
616780915a is described below
commit 616780915a86d5bf728bf2b64655cfc870693745
Author: Aleksandr Pakhomov <ap...@gmail.com>
AuthorDate: Thu Oct 20 15:21:22 2022 +0300
IGNITE-17781 Added RPM/DEB for CLI. Fixes #1219
Signed-off-by: Slava Koptilin <sl...@gmail.com>
---
assembly/README.md | 4 +-
modules/cli/build.gradle | 2 +-
packaging/build.gradle | 180 ++------------------
packaging/cli/build.gradle | 160 ++++++++++++++++++
packaging/{zip/stop.sh => cli/postInstall.sh} | 21 +--
packaging/cli/start.sh | 87 ++++++++++
.../config/ignite.java.util.logging.properties | 2 +-
packaging/db/build.gradle | 182 +++++++++++++++++++++
.../ignite.java.util.logging.properties | 0
packaging/linux/common.sh | 2 +-
packaging/linux/service/ignite3db.conf | 2 +-
packaging/linux/service/ignite3db.service | 2 +-
.../zip/{bootstrap-config => bootstrap-config.env} | 0
.../{scripts/ignite3-db.sh => zip/ignite3db.sh} | 2 +-
packaging/zip/start.sh | 60 -------
settings.gradle | 4 +
16 files changed, 462 insertions(+), 248 deletions(-)
diff --git a/assembly/README.md b/assembly/README.md
index 430c36bc4c..bca0841cb7 100644
--- a/assembly/README.md
+++ b/assembly/README.md
@@ -55,12 +55,12 @@ To run any other example, do the following:
3. (optional) Setup ignite3-cli in your terminal:
```
cd ignite3-cli-3.0.0-beta1
- alias ignite="$(pwd)/bin/ignite3-cli" >> ~/.bash_profile
+ alias ignite3="$(pwd)/bin/ignite3" >> ~/.bash_profile
source bin/ignite_completion.sh
```
4. (optional) If the cluster is not initialized then initialize the cluster:
```
- ignite cluster init --cluster-name=ignite-cluster --cluster-endpoint-url=http://localhost:10300 --meta-storage-node=defauldNode
+ ignite3 cluster init --cluster-name=ignite-cluster --cluster-endpoint-url=http://localhost:10300 --meta-storage-node=defauldNode
```
5. Run the preferred example in the IDE.
diff --git a/modules/cli/build.gradle b/modules/cli/build.gradle
index 95e2e133e9..33e6b2a0ac 100644
--- a/modules/cli/build.gradle
+++ b/modules/cli/build.gradle
@@ -142,7 +142,7 @@ task generateAutocompletionScript(type: JavaExec) {
"--completionScript",
"${buildDir}/ignite_completion.sh",
"-n",
- "ignite",
+ "ignite3",
"org.apache.ignite.internal.cli.commands.TopLevelCliCommand"]
outputs.file "${buildDir}/ignite_completion.sh"
}
diff --git a/packaging/build.gradle b/packaging/build.gradle
index 7076fe9923..56aea01448 100644
--- a/packaging/build.gradle
+++ b/packaging/build.gradle
@@ -17,7 +17,6 @@
plugins {
id 'java'
- id 'distribution'
alias(libs.plugins.docker)
alias(libs.plugins.nebula)
}
@@ -26,84 +25,16 @@ configurations {
dbArtifacts
cliArtifacts
cliScripts
+ cliZip
+ dbZip
}
-import org.apache.tools.ant.filters.ReplaceTokens
-
dependencies {
dbArtifacts(project(':ignite-runner'))
cliArtifacts(project(':ignite-cli'))
cliScripts(project(path: ':ignite-cli', configuration: 'cliScripts'))
-}
-
-// task that generates start script for cli
-task cliStartScript(type: CreateStartScripts) {
- // will be passed to exec "java ... <mainClassName>"
- mainClass = "org.apache.ignite.internal.cli.Main"
- // forms a classpath string that will be passed to exec "java -cp <classpath> .."
- // it is expected to locate the "lib" dir together with "bin"
- classpath = files(new File("../lib/${project(':ignite-cli').name}-${project(':ignite-cli').version}.jar"), new File("../lib/*"))
- outputDir = file "$buildDir/scripts"
- applicationName = 'ignite3-cli'
-}
-
-distributions {
- db {
- distributionBaseName = 'ignite3-db'
- contents {
- into('') {
- File.createTempDir().with {
- ["log", "etc", "work"].each { new File(absolutePath, it).mkdirs() }
- from(absolutePath) {
- includeEmptyDirs = true
- }
- }
- }
- into('') {
- from("$rootDir/LICENSE")
- from("$rootDir/NOTICE")
- from("$rootDir/assembly/README.md")
- }
- into('etc') {
- from("${buildDir}/scripts/bootstrap-config")
- from("${buildDir}/config/ignite-config.conf")
- from("${buildDir}/config/ignite.java.util.logging.properties")
- }
- into('bin') {
- fileMode 0755
- from("$rootDir/packaging/scripts/ignite3-db.sh")
- }
- into('lib') {
- from(configurations.dbArtifacts)
- }
- }
- }
-
- cli {
- distributionBaseName = 'ignite3-cli'
- contents {
- into('') {
- File.createTempDir().with {
- ["log"].each {new File(absolutePath, it).mkdirs() }
- from (absolutePath) {
- includeEmptyDirs = true
- }
- }
- from ("$rootDir/LICENSE")
- from ("$rootDir/NOTICE")
- from ("$rootDir/assembly/README.md")
- }
- into('bin') {
- duplicatesStrategy= DuplicatesStrategy.EXCLUDE
- from(configurations.cliScripts)
- from(cliStartScript)
- fileMode = 0755
- }
- into('lib') {
- from(configurations.cliArtifacts)
- }
- }
- }
+ cliZip(project(path: ':packaging-cli', configuration: 'cliZip'))
+ dbZip(project(path: ':packaging-db', configuration: 'dbZip'))
}
docker {
@@ -137,101 +68,22 @@ docker {
}
// create an uber zip with all distributions
+
+task copyCliAndDbZip(type: Copy) {
+ from(configurations.cliZip)
+ from(configurations.dbZip)
+ into("$buildDir/tmp/zip/")
+}
+
task allDistZip(type: Zip) {
archiveBaseName = "ignite3"
- def allZipFiles = cliDistZip.outputs.files + dbDistZip.outputs.files
+ def allZipFiles = configurations.cliZip + configurations.dbZip
allZipFiles.each {
from(zipTree(it))
}
}
-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}"
-}
+// copyCliAndDbZi depends on configurations.cliZip and configurations.dbZip
+// it makes allDistZip be depended on configurations.cliZip and configurations.dbZip
+// https://issues.apache.org/jira/browse/IGNITE-17918
+allDistZip.dependsOn copyCliAndDbZip
diff --git a/packaging/cli/build.gradle b/packaging/cli/build.gradle
new file mode 100644
index 0000000000..7f732898ce
--- /dev/null
+++ b/packaging/cli/build.gradle
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ */
+
+plugins {
+ id 'java'
+ id 'distribution'
+ alias(libs.plugins.nebula)
+}
+
+import org.apache.tools.ant.filters.ReplaceTokens
+
+configurations {
+ cliArtifacts
+ cliScripts
+}
+
+dependencies {
+ cliArtifacts(project(':ignite-cli'))
+ cliScripts(project(path: ':ignite-cli', configuration: 'cliScripts'))
+}
+
+// Common for ZIP and RPM/DEB
+
+def tokens = [
+ PRODUCT_NAME : 'ignite3cli',
+ PRODUCT_DISPLAY_NAME: 'Apache Ignite CLI',
+ INSTALL_DIR : '/usr/bin',
+ LIB_DIR : '/usr/lib/ignite3',
+ LOG_DIR : '${HOME}/.ignite3',
+ APP_JAR : "${project(':ignite-cli').name}-${project(':ignite-cli').version}.jar".toString(),
+ MAIN_CLASS : 'org.apache.ignite.internal.cli.Main',
+ JAVA_OPTS : '',
+ ADDITIONAL_OPTS : '',
+ ARGS : '$@'
+
+]
+
+task replaceScriptVars(type: Copy) {
+ from("start.sh")
+ filter(ReplaceTokens, tokens: tokens)
+ fileMode 0755
+ into("${buildDir}")
+ rename {
+ "ignite3"
+ }
+}
+
+task replacePostInstallScriptVars(type: Copy) {
+ from("postInstall.sh")
+ filter(ReplaceTokens, tokens: tokens)
+ into("${buildDir}")
+}
+
+distTar.dependsOn replaceScriptVars
+distZip.dependsOn replaceScriptVars
+
+// task that generates start script for cli
+task cliStartScript(type: CreateStartScripts) {
+ // will be passed to exec "java ... <mainClassName>"
+ mainClass = "org.apache.ignite.internal.cli.Main"
+ // forms a classpath string that will be passed to exec "java -cp <classpath> .."
+ // it is expected to locate the "lib" dir together with "bin"
+ classpath = files(new File("../lib/${project(':ignite-cli').name}-${project(':ignite-cli').version}.jar"), new File("../lib/*"))
+ outputDir = file "$buildDir/scripts"
+ applicationName = 'ignite3'
+}
+
+
+// ZIP packaging
+
+distributions {
+ main {
+ distributionBaseName = 'ignite3cli'
+ contents {
+ into('') {
+ from("$rootDir/LICENSE")
+ from("$rootDir/NOTICE")
+ from("$rootDir/assembly/README.md")
+ }
+ into('bin') {
+ duplicatesStrategy= DuplicatesStrategy.EXCLUDE
+ from(configurations.cliScripts)
+ from(cliStartScript)
+ fileMode = 0755
+ }
+ into('lib') {
+ from(configurations.cliArtifacts)
+ }
+ }
+ }
+}
+
+buildRpm.dependsOn replaceScriptVars, replacePostInstallScriptVars
+buildDeb.dependsOn replaceScriptVars, replacePostInstallScriptVars
+
+// Expose zip artifacts to be consumed by others
+configurations {
+ cliZip {
+ canBeConsumed = true
+ canBeResolved = false
+ }
+}
+
+artifacts {
+ cliZip(distZip) {
+ builtBy(distZip)
+ }
+}
+
+
+// DEB/RPM packaging
+
+buildDeb {
+ into("/usr/share/bash-completion/completions/") {
+ from configurations.cliScripts
+ fileMode 0755
+ }
+}
+
+buildRpm {
+ into("/etc/bash_completion.d/") {
+ from configurations.cliScripts
+ fileMode 0755
+ }
+}
+
+ospackage {
+ license "ASL 2.0"
+ packageName tokens.PRODUCT_NAME
+ packageGroup "CLI"
+ url "https://ignite.apache.org"
+ packageDescription "This package will install Apache Ignite CLI"
+ os LINUX
+ user 'root'
+
+ into(tokens.INSTALL_DIR) {
+ from("$buildDir/ignite3")
+ fileMode = 0755
+ }
+
+ into(tokens.LIB_DIR) {
+ from configurations.cliArtifacts
+ }
+
+ postInstall file("${buildDir}/postInstall.sh")
+}
diff --git a/packaging/zip/stop.sh b/packaging/cli/postInstall.sh
similarity index 63%
rename from packaging/zip/stop.sh
rename to packaging/cli/postInstall.sh
index 8fdb08c459..582f285a7a 100644
--- a/packaging/zip/stop.sh
+++ b/packaging/cli/postInstall.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -16,19 +16,8 @@
# limitations under the License.
#
-set -o nounset; set -o errexit; set -o pipefail; set -o errtrace; set -o functrace
+setup_directories() {
+ [ -d '@LOG_DIR@' ] || install -d '@LOG_DIR@'
+}
-
-## VARS ##
-SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
-PATH__RPM="${1}"
-FILE__RPM=$(basename "${PATH__RPM}")
-
-
-## START ##
-cd "${SCRIPT_DIR}"
-mv -fv "${PATH__RPM}" ./
-alien --scripts --verbose --keep-version --single "${FILE__RPM}"
-rm -rf "${FILE__RPM}"
-cd apache-ignite-*
-fakeroot debian/rules binary
+setup_directories
diff --git a/packaging/cli/start.sh b/packaging/cli/start.sh
new file mode 100644
index 0000000000..288e0deb9d
--- /dev/null
+++ b/packaging/cli/start.sh
@@ -0,0 +1,87 @@
+#!/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.
+#
+
+# LOAD VARIABLES
+if [ -f "@ENV_FILE@" ]; then
+ . "@ENV_FILE@"
+fi
+
+LOG_DIR="@LOG_DIR@"
+JAVA_OPTS="@JAVA_OPTS@"
+ADDITIONAL_OPTS="@ADDITIONAL_OPTS@"
+CLASSPATH="@LIB_DIR@/@APP_JAR@:@LIB_DIR@/*"
+MAIN_CLASS="@MAIN_CLASS@"
+ARGS="@ARGS@"
+
+DEFAULT_JVM_OPTS="--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"
+
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+ Please set the JAVA_HOME variable in your environment to match the
+ location of your Java installation."
+ fi
+else
+ JAVACMD=java
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+ Please set the JAVA_HOME variable in your environment to match the
+ location of your Java installation."
+fi
+
+
+CMD="${JAVACMD} \
+${DEFAULT_JVM_OPTS} \
+${JAVA_OPTS} \
+${ADDITIONAL_OPTS} \
+-classpath ${CLASSPATH} \
+${MAIN_CLASS} \
+${ARGS}"
+
+${CMD}
+
diff --git a/packaging/config/ignite.java.util.logging.properties b/packaging/config/ignite.java.util.logging.properties
index c173554dd5..5825d44f4d 100644
--- a/packaging/config/ignite.java.util.logging.properties
+++ b/packaging/config/ignite.java.util.logging.properties
@@ -41,7 +41,7 @@ handlers=java.util.logging.FileHandler
# into standard error stream (`System.err`).
#
java.util.logging.FileHandler.formatter = org.apache.ignite.lang.JavaLoggerFormatter
-java.util.logging.FileHandler.pattern = @LOG_DIR@/ignite3db-%g.log
+java.util.logging.FileHandler.pattern = ./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/db/build.gradle b/packaging/db/build.gradle
new file mode 100644
index 0000000000..0c00d11483
--- /dev/null
+++ b/packaging/db/build.gradle
@@ -0,0 +1,182 @@
+/*
+ * 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.
+ */
+
+plugins {
+ id 'java'
+ id 'distribution'
+ alias(libs.plugins.nebula)
+}
+
+configurations {
+ dbArtifacts
+}
+
+import org.apache.tools.ant.filters.ReplaceTokens
+
+dependencies {
+ dbArtifacts(project(':ignite-runner'))
+}
+
+// ZIP packaging
+
+distributions {
+ main {
+ distributionBaseName = 'ignite3db'
+ contents {
+ // create empty dirs that are required to start Ignite
+ into('') {
+ File.createTempDir().with {
+ ["log", "etc", "work"].each { new File(absolutePath, it).mkdirs() }
+ from(absolutePath) {
+ includeEmptyDirs = true
+ }
+ }
+ }
+ into('') {
+ from("$rootDir/LICENSE")
+ from("$rootDir/NOTICE")
+ from("$rootDir/assembly/README.md")
+ }
+ into('etc') {
+ from("$rootDir/packaging/zip/bootstrap-config.env")
+ from("$rootDir/packaging/config/ignite-config.conf")
+ from("$rootDir/packaging/config/ignite.java.util.logging.properties")
+ }
+ into('bin') {
+ fileMode 0755
+ from("$rootDir/packaging/zip/ignite3db.sh")
+ }
+ into('lib') {
+ from configurations.dbArtifacts
+ }
+ }
+ }
+}
+
+// Expose zip artifacts to be consumed by others
+configurations {
+ dbZip {
+ canBeConsumed = true
+ canBeResolved = false
+ }
+}
+
+artifacts {
+ dbZip(distZip) {
+ builtBy(distZip)
+ }
+}
+
+// RPM/DEB packaging
+
+def javaArgs = '-Dio.netty.tryReflectionSetAccessible=true ' +
+ '-Djava.util.logging.config.file=$CONFIG_PATH/ignite.java.util.logging.properties'
+
+def args = '--config-path $IGNITE_CONFIG_FILE --work-dir $WORK_PATH $NODE_NAME'
+
+def tokens = [
+ PRODUCT_NAME : 'ignite3db',
+ PRODUCT_DISPLAY_NAME: 'Apache Ignite',
+ APP_JAR : "${project(':ignite-runner').name}-${project(':ignite-runner').version}.jar".toString(),
+ MAIN_CLASS : 'org.apache.ignite.app.IgniteCliRunner',
+ ADDITIONAL_OPTS : '',
+ JAVA_OPTS : javaArgs,
+ ARGS : args
+]
+
+def packageTokens = tokens + [
+ USERNAME : 'ignite3',
+ GROUPNAME : 'ignite3',
+ INSTALL_DIR : '/usr/share/ignite3db',
+ CONF_DIR : '/usr/share/ignite3db/etc',
+ LOG_DIR : '/var/log/ignite3db',
+ PID_DIR : '/var/run/ignite3db',
+ LIB_DIR : '/usr/share/ignite3db/lib',
+ IGNITE_WORK_DIR : '/usr/share/ignite3db/work',
+ VARS_FILE_NAME : 'vars.env',
+ IGNITE_CONF_FILE : 'ignite-config.conf',
+ ENV_FILE : '/usr/share/ignite3db/etc/vars.env'
+]
+
+
+task replacePackageScriptVars(type: Copy) {
+ from("${rootDir}/packaging/linux")
+ from("${rootDir}/packaging/db/ignite.java.util.logging.properties")
+ filter(ReplaceTokens, tokens: packageTokens)
+ into("${buildDir}/linux")
+}
+
+buildRpm {
+ dependsOn replacePackageScriptVars
+ 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 replacePackageScriptVars
+ 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 packageTokens.PRODUCT_NAME
+ packageGroup "System Environment/Daemons"
+ url "https://ignite.apache.org"
+ user packageTokens.USERNAME
+ packageDescription "This package will install Apache Ignite"
+ os LINUX
+
+ into(packageTokens.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}/linux/ignite.java.util.logging.properties"
+ from "${rootDir}/packaging/config/ignite-config.conf"
+ }
+
+ into("etc") {
+ from sourceSets.main.resources
+ }
+ }
+ link "/etc/ignite3db", "${packageTokens.INSTALL_DIR}/etc/"
+ link "/opt/ignite3db", "${packageTokens.INSTALL_DIR}"
+}
diff --git a/packaging/config/ignite.java.util.logging.properties b/packaging/db/ignite.java.util.logging.properties
similarity index 100%
copy from packaging/config/ignite.java.util.logging.properties
copy to packaging/db/ignite.java.util.logging.properties
diff --git a/packaging/linux/common.sh b/packaging/linux/common.sh
index 41c98c8515..e172a7e8da 100644
--- a/packaging/linux/common.sh
+++ b/packaging/linux/common.sh
@@ -29,7 +29,7 @@ source_user_group() {
sudo usermod -a -G "${GROUPNAME}" "${USERNAME}"
fi
- if [ -f "@CONF_DIR@/@VARS_FILE_NAME@" ]; then . "@CONF_DIR@/@VARS_FILE_NAME@"; fi
+ if [ -f "@CONF_DIR@/@VARS_FILE@" ]; then . "@CONF_DIR@/@VARS_FILE@"; fi
}
pre_uninstall() {
diff --git a/packaging/linux/service/ignite3db.conf b/packaging/linux/service/ignite3db.conf
index fd8b3379e6..dd8f7c8f14 100644
--- a/packaging/linux/service/ignite3db.conf
+++ b/packaging/linux/service/ignite3db.conf
@@ -28,7 +28,7 @@ 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"
+ exec "$0" "$@"' "${USERNAME}" -- '@INSTALL_DIR@/start.sh'
end script
post-stop script
diff --git a/packaging/linux/service/ignite3db.service b/packaging/linux/service/ignite3db.service
index 928398e589..7a55464c39 100644
--- a/packaging/linux/service/ignite3db.service
+++ b/packaging/linux/service/ignite3db.service
@@ -22,7 +22,7 @@ Description=Apache Ignite is a distributed database for high-performance computi
User=@USERNAME@
Group=@GROUPNAME@
WorkingDirectory=@INSTALL_DIR@
-ExecStart=@INSTALL_DIR@/start.sh %i
+ExecStart=@INSTALL_DIR@/start.sh
SuccessExitStatus=143
Type=simple
Restart=on-failure
diff --git a/packaging/zip/bootstrap-config b/packaging/zip/bootstrap-config.env
similarity index 100%
rename from packaging/zip/bootstrap-config
rename to packaging/zip/bootstrap-config.env
diff --git a/packaging/scripts/ignite3-db.sh b/packaging/zip/ignite3db.sh
similarity index 98%
rename from packaging/scripts/ignite3-db.sh
rename to packaging/zip/ignite3db.sh
index d2a5a9c73c..4aefeefe14 100755
--- a/packaging/scripts/ignite3-db.sh
+++ b/packaging/zip/ignite3db.sh
@@ -22,7 +22,7 @@
# LOAD VARIABLES
if [ -z ${IGNITE_HOME+x} ]; then IGNITE_HOME=$(pwd); fi
- . $IGNITE_HOME/etc/bootstrap-config
+ . $IGNITE_HOME/etc/bootstrap-config.env
# Export these variables so that IgniteCliRunner can use them as default values
export IGNITE_NODE_NAME=$NODE_NAME
diff --git a/packaging/zip/start.sh b/packaging/zip/start.sh
deleted file mode 100644
index 51f33b204d..0000000000
--- a/packaging/zip/start.sh
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/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/settings.gradle b/settings.gradle
index 96269b2b50..a718d1ac64 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -60,6 +60,8 @@ include(':ignite-compute')
include(':ignite-metrics')
include(':ignite-binary-tuple')
include(':platforms')
+include(':packaging-cli')
+include(':packaging-db')
include(':packaging')
include(':ignite-replicator')
@@ -108,4 +110,6 @@ project(":ignite-metrics").projectDir = file('modules/metrics')
project(":ignite-binary-tuple").projectDir = file('modules/binary-tuple')
project(":platforms").projectDir = file('modules/platforms')
project(":ignite-replicator").projectDir = file('modules/replicator')
+project(":packaging-cli").projectDir = file('packaging/cli')
+project(":packaging-db").projectDir = file('packaging/db')
project(":packaging").projectDir = file('packaging')