From 57ee4ec6914fe4503819b64682e62d4127c4b08c Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Wed, 13 Feb 2013 09:12:01 +0000 Subject: [PATCH] SP-80, BIS-55: Allow to backup no database in GUI version of installer. Also switch on/off processing task 'path-info-db-consistency-check'. SVN: 28358 --- .../installer/bin/backup-databases.sh | 18 +++++++++-- .../installer/bin/backup-installation.sh | 3 +- .../installer/bin/common-functions.sh | 10 ++---- .../resource/tarball/console.properties | 12 ++++++- installation/resource/tarball/run-console.sh | 4 +-- .../installer/izpack/ExecuteBackupAction.java | 18 +++++++++-- .../izpack/ExecuteSetupScriptsAction.java | 31 ++++++++++--------- 7 files changed, 64 insertions(+), 32 deletions(-) diff --git a/installation/resource/installer/bin/backup-databases.sh b/installation/resource/installer/bin/backup-databases.sh index b02381f2297..acb1231d3de 100755 --- a/installation/resource/installer/bin/backup-databases.sh +++ b/installation/resource/installer/bin/backup-databases.sh @@ -34,6 +34,19 @@ function getProperty() { echo $properties | tr ";" "\n" | grep "$propName=" | sed "s/$propName=//" } +function checkForBackup() +{ + local database=$1 + if [ $CONSOLE ]; then + if [ "$(trim "$DATABASES_TO_BACKUP")" == "" ]; then + echo "TRUE" + return + fi + fi + echo $(contains "$DATABASES_TO_BACKUP" $database) + return +} + # # Backs up database specified by a string as returned # in the function listDatabases. @@ -42,8 +55,8 @@ function backupDatabase() { DB_PROPS=$1 - database=$(getProperty $DB_PROPS "database") - if [ $(isEmptyOrContains "$DATABASES_TO_BACKUP" $database) == "FALSE" ]; then + local database=$(getProperty $DB_PROPS "database") + if [ $(checkForBackup $database) == "FALSE" ]; then return fi if [ $(databaseExist $database) == "TRUE" ]; then @@ -73,6 +86,7 @@ if [ "$BACKUP_DIR" == "" ]; then exit 1 fi DATABASES_TO_BACKUP="$2" +CONSOLE=$3 SERVERS=$BASE/../servers AS_SERVER=$SERVERS/openBIS-server/ diff --git a/installation/resource/installer/bin/backup-installation.sh b/installation/resource/installer/bin/backup-installation.sh index 4ed307f35d7..5aa5f9f1c7a 100755 --- a/installation/resource/installer/bin/backup-installation.sh +++ b/installation/resource/installer/bin/backup-installation.sh @@ -22,6 +22,7 @@ if [ "$BACKUP_DIR" == "" ]; then exit 1 fi DATABASES_TO_BACKUP="$2" +CONSOLE=$3 $BASE/alldown.sh @@ -32,7 +33,7 @@ echo "Creating backup folder $BACKUP_DIR ..." mkdir -p $CONFIG $BASE/backup-config.sh $CONFIG -$BASE/backup-databases.sh $BACKUP_DIR "$DATABASES_TO_BACKUP" +$BASE/backup-databases.sh $BACKUP_DIR "$DATABASES_TO_BACKUP" $CONSOLE if [ $? -ne "0" ]; then echo "Creating database backups had failed. Aborting ..." exit 1 diff --git a/installation/resource/installer/bin/common-functions.sh b/installation/resource/installer/bin/common-functions.sh index a5f952a7bc1..756336c3cee 100644 --- a/installation/resource/installer/bin/common-functions.sh +++ b/installation/resource/installer/bin/common-functions.sh @@ -14,19 +14,15 @@ trim() # # Checks whether the first argument, a comma-separated list of items contains the second argument -# as an item. Returns TRUE if this is the case or the list is empty. Trailing and leading +# as an item. Returns TRUE if this is the case. Trailing and leading # whitespace of list items are ignored. # # This function should be used as follows: # -# result=$(isEmptyOrContains " abc, def , ghi " "abc") +# result=$(contains " abc, def , ghi " "abc") # -isEmptyOrContains() +contains() { - if [ "$(trim "$1")" == "" ]; then - echo "TRUE" - return - fi local list="$1" local item="$2" while true; do diff --git a/installation/resource/tarball/console.properties b/installation/resource/tarball/console.properties index bd5cf280de6..053f74ebc8b 100644 --- a/installation/resource/tarball/console.properties +++ b/installation/resource/tarball/console.properties @@ -42,4 +42,14 @@ KEY_PASSWORD = changeit #SCREENING = true # Standard technology ILLUMINA-NGS (ETH BSSE Setup) is disabled by default -#ILLUMINA-NGS = true \ No newline at end of file +#ILLUMINA-NGS = true + +# Fast data set file browsing improves the performance of browsing of data sets with a large number of files. +# We recommend leaving it on for all instances, and especially screening instances. +# Default value is true. +#PATHINFO_DB_ENABLED = true + +# +# Comma-separated list of databases to backup. If the list is empty or undefined all databases +# will be backauped. +#DATABASES_TO_BACKUP = \ No newline at end of file diff --git a/installation/resource/tarball/run-console.sh b/installation/resource/tarball/run-console.sh index de53b5299bb..13665502284 100755 --- a/installation/resource/tarball/run-console.sh +++ b/installation/resource/tarball/run-console.sh @@ -43,8 +43,6 @@ if [ ${BASE#/} == ${BASE} ]; then fi ensureToolOnPath "java" -ensureToolOnPath "psql" -ensureToolOnPath "pg_dump" install_path=$( grep -e "^INSTALL_PATH=.*$" $BASE/console.properties | sed "s/INSTALL_PATH=//" ) if [ -z "$install_path" ]; then @@ -65,4 +63,4 @@ else readAdminPassword fi -java -Djava.util.logging.config.file=$BASE/jul.config -DADMIN_PASSWORD=$ADMIN_PASSWORD -Dmerge.props.to.installation.vars=true -jar $BASE/openBIS-installer.jar -options-auto $BASE/console.properties +java -Djava.util.logging.config.file=$BASE/jul.config -DADMIN_PASSWORD=$ADMIN_PASSWORD -DCONSOLE=true -Dmerge.props.to.installation.vars=true -jar $BASE/openBIS-installer.jar -options-auto $BASE/console.properties diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteBackupAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteBackupAction.java index 31f90f58a56..4ae5ce6dde0 100644 --- a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteBackupAction.java +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteBackupAction.java @@ -39,13 +39,25 @@ public class ExecuteBackupAction extends AbstractScriptExecutor implements Panel String script = getAdminScript(data, CREATE_BACKUP_SCRIPT); String backupFolder = data.getVariable(GlobalInstallationContext.BACKUP_FOLDER_VARNAME); String dataBasesToBackup = data.getVariable(SetDatabasesToBackupAction.DATABASES_TO_BACKUP_VARNAME); - System.out.println("dbs:"+dataBasesToBackup+"<"); + String console = data.getVariable("SYSTEM_CONSOLE"); if (dataBasesToBackup == null) { - executeAdminScript(null, script, backupFolder); + if (console == null) + { + executeAdminScript(null, script, backupFolder); + } else + { + executeAdminScript(null, script, backupFolder, "", console); + } } else { - executeAdminScript(null, script, backupFolder, dataBasesToBackup); + if (console == null) + { + executeAdminScript(null, script, backupFolder, dataBasesToBackup); + } else + { + executeAdminScript(null, script, backupFolder, dataBasesToBackup, console); + } } } diff --git a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteSetupScriptsAction.java b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteSetupScriptsAction.java index 3eea038137e..cf7c25e338a 100644 --- a/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteSetupScriptsAction.java +++ b/installation/source/java/ch/systemsx/cisd/openbis/installer/izpack/ExecuteSetupScriptsAction.java @@ -48,6 +48,11 @@ public class ExecuteSetupScriptsAction extends AbstractScriptExecutor implements static final String PATHINFO_DB_FEEDING_TASK = "pathinfo-feeding"; static final String MAINTENANCE_PLUGINS_KEY = "maintenance-plugins"; static final String PATHINFO_DB_DELETION_TASK = "path-info-deletion"; + static final String PROCESSING_PLUGINS_KEY = "processing-plugins"; + static final String PATHINFO_DB_CHECK = "path-info-db-consistency-check"; + + private final String[] KEYS = {DATA_SOURCES_KEY, POST_REGISTRATION_TASKS_KEY, MAINTENANCE_PLUGINS_KEY, PROCESSING_PLUGINS_KEY}; + private final String[] TERMS = {PATHINFO_DB_DATA_SOURCE, PATHINFO_DB_FEEDING_TASK, PATHINFO_DB_DELETION_TASK, PATHINFO_DB_CHECK}; /** * executed for first time installations. @@ -78,9 +83,9 @@ public class ExecuteSetupScriptsAction extends AbstractScriptExecutor implements File installDir = GlobalInstallationContext.installDir; try { - enablePathinfoDB( - "true".equals(data.getVariable(GlobalInstallationContext.PATHINFO_DB_ENABLED)), - installDir); + String pathinfoDBEnabled = + data.getVariable(GlobalInstallationContext.PATHINFO_DB_ENABLED); + enablePathinfoDB("false".equalsIgnoreCase(pathinfoDBEnabled) == false, installDir); installKeyStore(keyStoreFileName, installDir); injectPasswords(keyStorePassword, certificatePassword, installDir); } catch (Exception ex) @@ -116,20 +121,16 @@ public class ExecuteSetupScriptsAction extends AbstractScriptExecutor implements new File(installDir, Utils.DSS_PATH + Utils.SERVICE_PROPERTIES_PATH); if (enableFlag) { - Utils.addTermToPropertyList(dssServicePropertiesFile, DATA_SOURCES_KEY, - PATHINFO_DB_DATA_SOURCE); - Utils.addTermToPropertyList(dssServicePropertiesFile, POST_REGISTRATION_TASKS_KEY, - PATHINFO_DB_FEEDING_TASK); - Utils.addTermToPropertyList(dssServicePropertiesFile, MAINTENANCE_PLUGINS_KEY, - PATHINFO_DB_DELETION_TASK); + for (int i = 0; i < KEYS.length; i++) + { + Utils.addTermToPropertyList(dssServicePropertiesFile, KEYS[i], TERMS[i]); + } } else { - Utils.removeTermFromPropertyList(dssServicePropertiesFile, DATA_SOURCES_KEY, - PATHINFO_DB_DATA_SOURCE); - Utils.removeTermFromPropertyList(dssServicePropertiesFile, POST_REGISTRATION_TASKS_KEY, - PATHINFO_DB_FEEDING_TASK); - Utils.removeTermFromPropertyList(dssServicePropertiesFile, MAINTENANCE_PLUGINS_KEY, - PATHINFO_DB_DELETION_TASK); + for (int i = 0; i < KEYS.length; i++) + { + Utils.removeTermFromPropertyList(dssServicePropertiesFile, KEYS[i], TERMS[i]); + } } } -- GitLab