From a03df1d5dd52a99ac96734b74e01b5fecfa1bdec Mon Sep 17 00:00:00 2001 From: cramakri <cramakri> Date: Thu, 16 May 2013 14:04:16 +0000 Subject: [PATCH] SWE-21 SP-638 : Added script to run installer SVN: 29157 --- .../python/nightly_upgrade/console.properties | 55 +++++++++++++++ .../download_installer.py | 0 .../nightly_upgrade/run_archived_installer.py | 68 +++++++++++++++++++ 3 files changed, 123 insertions(+) create mode 100644 openbis_all/source/python/nightly_upgrade/console.properties rename openbis_all/source/python/{ => nightly_upgrade}/download_installer.py (100%) create mode 100755 openbis_all/source/python/nightly_upgrade/run_archived_installer.py diff --git a/openbis_all/source/python/nightly_upgrade/console.properties b/openbis_all/source/python/nightly_upgrade/console.properties new file mode 100644 index 00000000000..6bc8aa8a7d6 --- /dev/null +++ b/openbis_all/source/python/nightly_upgrade/console.properties @@ -0,0 +1,55 @@ +# +# The path where openBIS will be installed. +# +# Example : +# INSTALL_PATH=/home/openbis/ +# +# will result in the following directory structure +# +# + /home/openbis +# + bin/ +# + servers/ +# + core-plugins/ +# + openBIS-server/ +# + datastore_server/ +# +INSTALL_PATH=/Users/cramakri/openbis + +# +# The path where openBIS will keep the imported data (e.g. images, analysis files) +# and its incoming folders. +# +DSS_ROOT_DIR=/Users/cramakri/openbis/ + +# Possible configuration options +# 'local' - if the openBIS servers will only be accessed from this machine +# 'server' - if the installation is meant to be accessible for remote users +INSTALLATION_TYPE=server + +# Path to the file which should replace the current Java key store file +#KEY_STORE_FILE = <path to key store> + +# Password of the key store +KEY_STORE_PASSWORD=changeit + +# Password of the key +KEY_PASSWORD=changeit + +# Standard technology PROTEOMICS is disabled by default +PROTEOMICS=true + +# Standard technology SCREENING is disabled by default +SCREENING=true + +# Standard technology ILLUMINA-NGS (ETH BSSE Setup) is disabled by default +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/openbis_all/source/python/download_installer.py b/openbis_all/source/python/nightly_upgrade/download_installer.py similarity index 100% rename from openbis_all/source/python/download_installer.py rename to openbis_all/source/python/nightly_upgrade/download_installer.py diff --git a/openbis_all/source/python/nightly_upgrade/run_archived_installer.py b/openbis_all/source/python/nightly_upgrade/run_archived_installer.py new file mode 100755 index 00000000000..4c0e9e8b4a0 --- /dev/null +++ b/openbis_all/source/python/nightly_upgrade/run_archived_installer.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python + +"""Run a .tar.gz installer. + +Unpack the installer, run it, and then clean up. + +""" + +import subprocess +import json +import os.path +import glob +import shutil + +def setup_and_preflight(): + """Define global variables and check that the environment is correct""" + global dest_dir + global installer, installer_folder + global config_file_path + dest_dir = os.path.expanduser("~") + installers = glob.glob(os.path.join(dest_dir, "openBIS-installation-standard-technologies-*-*.tar.gz")) + if len(installers) < 1: + print("No installer of the form 'openBIS-installation-standard-technologies-*-*.tar.gz' found in " + dest_dir) + exit(-1) + + if len(installers) > 1: + print("Multiple installers found : " + " ".join(installers)) + exit(-1) + + installer = installers[0] + installer_folder = installer[0:-7] + + config_file_path = os.path.join(os.path.dirname(__file__), "console.properties") + if not os.path.exists(config_file_path): + print("Could not find installer config file at : " + config_file_path) + exit(-1) + +def run_cmd(cmd): + print(" ".join(cmd)) + print("\n") + return subprocess.check_output(cmd) + +def unpack_installer(): + unpack_cmd = ["tar", "-zx", "-f", installer, "-C", dest_dir] + run_cmd(unpack_cmd) + +def run_installer(): + # Copy the canonical config file to the installer folder + shutil.copy(config_file_path, installer_folder) + install_cmd = [os.path.join(installer_folder, "run-console.sh")] + run_cmd(install_cmd) + + +def cleanup(): + if not os.path.exists(installer_folder): + return + + rm_cmd = ["rm", "-rf", installer_folder] + run_cmd(rm_cmd) + + + +# # # # # # # # # # # # # # # # # # # # # # # # # +# The Script +setup_and_preflight() +#unpack_installer() +run_installer() +#cleanup() -- GitLab