summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2012-07-24 16:04:34 +0200
committerAndreas Maunz <andreas@maunz.de>2012-07-24 16:04:34 +0200
commitf7345788b7dde028f1600194ba8f668fd6295ceb (patch)
tree784955848f811adb8dfee30537a8febbce9e4511
parent365ad4e93288b96233e38c6bc732c197315d41cf (diff)
parent6f799b8fb74e662970f8f5a2112a4a75cbcc5ead (diff)
Initial version of modular
-rw-r--r--README35
-rw-r--r--aa-local.yaml41
-rw-r--r--aa-server.yaml41
-rwxr-xr-x[-rw-r--r--]base-install.sh31
-rwxr-xr-xconfig.sh47
-rwxr-xr-xenvironment_update.sh77
-rwxr-xr-xinstall94
-rwxr-xr-xkernlab.sh68
-rw-r--r--nginx.conf43
-rwxr-xr-xnginx.sh78
-rwxr-xr-xopenbabel.sh100
-rwxr-xr-xopentox-ruby.sh92
-rwxr-xr-xopentox-webservices.sh92
-rw-r--r--ot-tools-root.sh88
-rw-r--r--ot-tools-user.sh97
-rw-r--r--packs.R6
-rw-r--r--production.yaml26
-rwxr-xr-xredis.sh79
-rwxr-xr-xruby.sh85
-rw-r--r--test-ob-rb.rb1
-rwxr-xr-xutils.sh79
21 files changed, 147 insertions, 1153 deletions
diff --git a/README b/README
index 7828109..2120c45 100644
--- a/README
+++ b/README
@@ -1,30 +1,23 @@
POSIX compatible Installer for OpenTox IST/ALU Services
=======================================================
-A) It is assumed that your system is configured for sudo to gain root privileges.
-B) It is assumed that your system is configured for using non-free packages.
-
-This is a POSIX-compliant (not limited to a particular shell) Opentox installer. Please report bugs always via GitHub.
+Author: Andreas Maunz
+This is a POSIX-compliant (not limited to a particular shell) OpenTox required packages installer for Debian. It also prepares the base directory (referred to as OT_PREFIX) for OpenTox REST services and provides libraries for the installation and shell integration of those services.
+Please report bugs via GitHub at http://github.com/opentox/install.
Here are some of my goals when writing the installer:
-- Safe (existence of all the binaries will be checked before running, apart from GNU Core Utils)
-- Idempotent (multiple execution does not change a thing)
-- Atomic (return value of each non-elemtary action is asserted to be TRUE)
-- Encapsulated (everything is installed in a sub-directory in $HOME)
-- Logged (all non-elemtary actions are logged)
-
-
-Configure your system in config.sh. NOTE for variable NGINX_PORT: leave this empty or set to ":80" to use port 80. If you do this, use the ot-scripts in "ot-tools-root.sh". Otherwise, if NGINX_PORT >1024, use ot-scripts in "ot-tools-user.sh".
-
-Even if we officially support only *one* distro (currently Debian 6.0.1), I tested the installer successfully on various Ubuntus. In this README at the top are the requirements of the installer. By default, everything is installed to $HOME/opentox-ruby (=OT_PREFIX). The configs go to OT_PREFIX/.sh_<Package>_ot.sh for each package.
-
-After running the installer, configure the system by editing the startup file of your favorite shell (in my case, BASH with the file ~ /. bashrc) to include ~/.opentox-ui.sh (in my case with 'source ...'). This file is the only one that the installer creates outside OT_PREFIX. Thus, the system is fully configured: If you now open a new shell, all environment variables will be adjusted.
+- Safe (existence of all binaries will be checked before running, apart from GNU Core Utils)
+- Idempotent (multiple execution incurs no changes to the system)
+- Atomic (return value of non-elementary actions asserted to be TRUE)
+- Encapsulated (everything installed in OT_PREFIX; applies to services)
+- Logged (all non-elementary actions are logged)
-To start the system I run the following (but that is not part of the installer):
-nohup $HOME/opentox-ruby/redis-2.2.2/src/redis-server $HOME/opentox-ruby/redis-2.2.2/redis.conf &
-nohup $HOME/opentox-ruby/nginx/sbin/nginx -c $HOME/opentox-ruby/nginx/conf/nginx.conf &
+Requirements:
+A) Debian or compatible (tested on Ubuntu 11.10).
+B) Users may gain root privileges using 'sudo'.
-To uninstall the system simply delete the link from the startup file: Done. To save disc space delete directory OT_PREFIX.
-Anyone can run multiple Opentox versions on the same machine: Just install again, but to a different OT_PREFIX. The switch works manually: Include the sh_<Package>_ot.sh files from the desired OT_PREFIX in $HOME/opentox-ui.sh (only one installation may be activated at any time).
+Usage:
+Configure the installer in config.sh, then run 'install'. Then configure your system by adding a line to the startup file of your favorite shell (e.g. BASH with the file '~/.bashrc') to read in '~/.opentox/.opentox-ui.sh' (e.g. with 'source ~/.opentox/.opentox-ui.sh'), so any newly started shell will be completely configured. To uninstall, simply remove the line from the startup file. To save disc space also remove directory OT_PREFIX. To remove also your configuration, remove $HOME/.opentox.
+You can run multiple Opentox versions on the same machine: Just install again as a different user.
diff --git a/aa-local.yaml b/aa-local.yaml
deleted file mode 100644
index 75cccd0..0000000
--- a/aa-local.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-# OpenSSO Authorization
-# set ":server: " to disable A&A
-:authorization:
- :server: AA
- :free_request: #request-method not controlled by A&A
- - "GET"
- - "POST"
- - "HEAD"
- - "DELETE"
- - "PUT"
- :authenticate_request: #only for authenticated user
- - ""
- :authorize_request: #only for authenticated and authorizeduser
- - ""
-# Exceptions:
- :free_uris: #request-method for uri not controlled by A&A
- ? - :GET
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/algorithm/
- - "http://SERVERNAMENGINX_PORT/model"
- - "http://SERVERNAMENGINX_PORT/dataset"
- - "http://SERVERNAMENGINX_PORT/validation"
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/resources/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/[a-z,A-Z,\/,_\-]*$/
- ? - :GET
- - :POST
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/toxcreate\/[a-z,A-Z,\/,_\-]*$/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/task/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/compound/
- - !ruby/regexp /sign_(in|out)$/
- ? - :PUT
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/task/
- ? - :DELETE
- : - "http://SERVERNAMENGINX_PORT/task/cleanup"
-
- :authorize_exceptions: #request-method for uri only authenticated, no authorization
- ? - :POST
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/algorithm/
- - "http://SERVERNAMENGINX_PORT/dataset"
- - "http://SERVERNAMENGINX_PORT/model"
- - "http://SERVERNAMENGINX_PORT/validation"
- - !ruby/regexp /http\:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/[a-z,A-Z,\/,_\-]*$/
diff --git a/aa-server.yaml b/aa-server.yaml
deleted file mode 100644
index 75cccd0..0000000
--- a/aa-server.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-# OpenSSO Authorization
-# set ":server: " to disable A&A
-:authorization:
- :server: AA
- :free_request: #request-method not controlled by A&A
- - "GET"
- - "POST"
- - "HEAD"
- - "DELETE"
- - "PUT"
- :authenticate_request: #only for authenticated user
- - ""
- :authorize_request: #only for authenticated and authorizeduser
- - ""
-# Exceptions:
- :free_uris: #request-method for uri not controlled by A&A
- ? - :GET
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/algorithm/
- - "http://SERVERNAMENGINX_PORT/model"
- - "http://SERVERNAMENGINX_PORT/dataset"
- - "http://SERVERNAMENGINX_PORT/validation"
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/resources/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/[a-z,A-Z,\/,_\-]*$/
- ? - :GET
- - :POST
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/toxcreate\/[a-z,A-Z,\/,_\-]*$/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/task/
- - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/compound/
- - !ruby/regexp /sign_(in|out)$/
- ? - :PUT
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/task/
- ? - :DELETE
- : - "http://SERVERNAMENGINX_PORT/task/cleanup"
-
- :authorize_exceptions: #request-method for uri only authenticated, no authorization
- ? - :POST
- : - !ruby/regexp /http:\/\/ESCAPEDSERVERNGINX_PORT\/algorithm/
- - "http://SERVERNAMENGINX_PORT/dataset"
- - "http://SERVERNAMENGINX_PORT/model"
- - "http://SERVERNAMENGINX_PORT/validation"
- - !ruby/regexp /http\:\/\/ESCAPEDSERVERNGINX_PORT\/validation\/[a-z,A-Z,\/,_\-]*$/
diff --git a/base-install.sh b/base-install.sh
index 66bb539..c9cebdd 100644..100755
--- a/base-install.sh
+++ b/base-install.sh
@@ -1,13 +1,13 @@
#!/bin/sh
-#
-# Installs base packages for Ubuntu
+
+# Installs required packages on Debian and compatible systems.
# Author: Andreas Maunz
-#
-# Your installed packages are safe and will not be updated.
-# A Java configuration is created and included in your '$OT_UI_CONF'.
-. "`pwd`/utils.sh"
-DIR="`pwd`"
+# NOTE: Your installed packages are safe and will not be updated.
+# Java configuration is included in '$OT_UI_CONF'.
+
+. ./utils.sh
+DIR=`pwd`
if [ "$(id -u)" = "0" ]; then
echo "This script must not be run as root" 1>&2
@@ -15,19 +15,12 @@ if [ "$(id -u)" = "0" ]; then
fi
# Utils
-APTITUDE="`which aptitude`"
-APT_CACHE="`which apt-cache`"
-DPKG="`which dpkg`"
-
-if [ ! -e "$APTITUDE" ]; then
- echo "Aptitude missing. Install aptitude first." 1>&2
- exit 1
-fi
+check_utils "aptitude git apt-cache dpkg"
touch $OT_UI_CONF
# Pkgs
-packs="binutils build-essential git-core gnuplot hostname libcurl4-openssl-dev libgsl0-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev libxml2-dev libxslt1-dev lsb-release openjdk-6-jdk psmisc pwgen raptor-utils r-base r-base-core r-base-dev sqlite3 wget xsltproc zlib1g-dev"
+packs="binutils build-essential cmake curl gnuplot hostname libcurl4-openssl-dev libgsl0-dev libopenbabel4 libopenbabel-dev libraptor1-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev libyaml-dev libxml2-dev libxslt1-dev lsb-release openjdk-6-jdk psmisc pwgen raptor-utils r-base r-base-core r-base-dev sqlite3 udev wget xsltproc zlib1g-dev"
echo
echo "Base Packages:"
@@ -42,9 +35,9 @@ if [ -n "$pack_arr" ]; then
echo "Checking availablity:"
for p in $pack_arr; do
if [ -n "`$APT_CACHE search $p`" ] ; then
- printf "%50s%30s\n" "'$p'" "Y"
+ printf "%30s%50s\n" $p Y
else
- printf "%50s%30s\n" "'$p'" "N"
+ printf "%30s%50s\n" $p N
pack_fail="$pack_fail $p"
fi
done
@@ -76,7 +69,7 @@ if [ ! -f $JAVA_CONF ]; then
echo "Java configuration has been stored in '$JAVA_CONF'."
if ! grep "$JAVA_CONF" $OT_UI_CONF >/dev/null 2>&1; then
- echo ". \"$JAVA_CONF\"" >> $OT_UI_CONF
+ echo '. '$JAVA_CONF >> $OT_UI_CONF
fi
fi
diff --git a/config.sh b/config.sh
index b8228c9..052fa32 100755
--- a/config.sh
+++ b/config.sh
@@ -1,52 +1,33 @@
#!/bin/sh
-#
+
# Configuration file for Opentox installer.
# Author: Christoph Helma, Andreas Maunz.
-#
+
# 1) Base setup
-OT_DIST="debian" # Linux distribution (debian)
-OT_INSTALL="local" # Type (gem, local, server)
-OT_BRANCH="development" # Maturity (development -you need SSH key at Github-, master)
+OT_DIST="debian" # Linux distribution (debian)
+OT_INSTALL="local" # Type (gem, local, server)
+OT_BRANCH="development" # Maturity (development -need SSH key at Github-, master)
-# 2) Where all binaries are installed.
+# 2) Where binaries are installed
OT_PREFIX="$HOME/opentox-ruby"
OT_JAVA_HOME="/usr/lib/jvm/java-6-openjdk"
# USE THIS FOR 64BIT: OT_JAVA_HOME="/usr/lib/jvm/java-6-openjdk-amd64"
-# 3) What versions to install.
-RUBY_NUM_VER="1.8.7-2012.02"
-OB_NUM_VER="2.2.3"
-KL_NUM_VER="0.9-11"
-REDIS_NUM_VER="2.4.4"
-
-# 4) Server settings.
-NGINX_SERVERNAME="toxcreate3.in-silico.ch"
-WWW_DEST="$OT_PREFIX/www"
-NGINX_PORT="" # set to empty string ("") for port 80 otherwise set to port *using colon* e.g. ":8080"
-OHM_PORT="6379" # set to port (no colon)
+# 3) What versions to install
+OB_NUM_VER="2.3.1"
+RUBY_DWL="http://ftp.ruby-lang.org/pub/ruby/1.9"
# Done.
### Nothing to gain from changes below this line.
-JAVA_CONF="$OT_PREFIX/.sh_java_ot"
-RUBY_CONF="$OT_PREFIX/.sh_ruby_ot"
-REDIS_CONF="$OT_PREFIX/.sh_redis_ot"
-NGINX_CONF="$OT_PREFIX/.sh_nginx_ot"
-OB_CONF="$OT_PREFIX/.sh_OB_ot"
-R_CONF="$OT_PREFIX/.sh_R_ot"
-
-RUBY_VER="ruby-enterprise-$RUBY_NUM_VER"
-OB_VER="openbabel-$OB_NUM_VER"
-REDIS_VER="$REDIS_NUM_VER"
+JAVA_CONF="$HOME/.opentox/sh_java"
+OB_CONF="$HOME/.opentox/sh_OB"
+R_CONF="$HOME/.opentox/sh_R"
+OT_UI_CONF="$HOME/.opentox/opentox-ui.sh"
-RUBY_DEST="$OT_PREFIX/$RUBY_VER"
+OB_VER="openbabel-$OB_NUM_VER"
OB_DEST="$OT_PREFIX/$OB_VER"
OB_DEST_BINDINGS="$OT_PREFIX/openbabel-ruby-install"
-R_DEST="$OT_PREFIX/r-packages"
-NGINX_DEST="$OT_PREFIX/nginx"
-REDIS_DEST="$OT_PREFIX/redis-$REDIS_VER"
-REDIS_SERVER_CONF="$REDIS_DEST/redis.conf"
-OT_UI_CONF="$HOME/.opentox-ui.sh"
diff --git a/environment_update.sh b/environment_update.sh
deleted file mode 100755
index d0beae4..0000000
--- a/environment_update.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/sh
-# Update script for OpenTox-ruby and webservices
-# Authors: Andreas Maunz, David Vorgrimmler
-# This script updates a productiv version of IST Opentox Services. All data will be saved and recovered.
-# Make sure your web services are down befor running this script.
-# You may modify some variables e.g. HOME, OTPREFIX, BACKUP_DIR.
-# opentox/install is needed and has to be configured
-
-HOME="/home/opentox"
-. $HOME/.opentox-ui.sh
-
-OTPREFIX="$HOME/opentox"
-BACKUP_DIR="$OTPREFIX/ot-server-backup"
-mkdir $BACKUP_DIR >/dev/null 2>&1
-mkdir -p $BACKUP_DIR/tmp/dataset/public >/dev/null 2>&1
-mkdir -p $BACKUP_DIR/tmp/model/public >/dev/null 2>&1
-mkdir -p $BACKUP_DIR/tmp/validation >/dev/null 2>&1
-#mkdir -p $BACKUP_DIR/tmp/log >/dev/null 2>&1
-
-
-echo "Creating backup of www..."
-TAR_NAME=$BACKUP_DIR/"www_`date +%y%m%d`.tar.gz"
-
-if [ -e $TAR_NAME ] || tar czvf $TAR_NAME "$OTPREFIX/opentox-ruby/www"; then
- echo
- echo "Will delete www in 10s! Press Ctrl+C to abort..."
- sleep 10
- sudo rm -rf "$OTPREFIX/opentox-ruby/www"
-fi
-
-
-NGINX="`which nginx`"
-RAKE="`which rake`"
-
-if ! [ -e "$RAKE" ]; then
- echo "Rake not found."
- exit 1
-fi
-if ! [ -e "$NGINX" ]; then
- echo "Nginx not found."
- exit 1
-fi
-if ! cd "$OTPREFIX/install"; then
- echo "$OTPREFIX/install dir not found"
-fi
-
-
-OTINSTALL="$OTPREFIX/install/opentox-webservices.sh"
-if ! [ -e "$OTINSTALL" ]; then
- echo "$OTINSTALL not found."
- exit 1
-fi
-chmod +x $OTINSTALL
-`$OTINSTALL`
-echo "$OTINSTALL script end."
-
-
-OTRUBYINSTALL="$OTPREFIX/install/opentox-ruby.sh"
-if ! [ -e "$OTRUBYINSTALL" ]; then
- echo "$OTRUBYINSTALL not found."
- exit 1
-fi
-chmod +x $OTRUBYINSTALL
-`$OTRUBYINSTALL`
-echo "$OTRUBYINSTALL script end."
-
-
-echo "Extracting backup of www..."
-cd /
-DEST_DATASET=`echo "$OTPREFIX/opentox-ruby/www/opentox/dataset/public/*yaml" | sed 's/.\(.*\)/\1/'`
-DEST_MODEL=`echo "$OTPREFIX/opentox-ruby/www/opentox/model/public/*yaml" | sed 's/.\(.*\)/\1/'`
-DEST_REPORTS=`echo "$OTPREFIX/opentox-ruby/www/opentox/validation/reports" | sed 's/.\(.*\)/\1/'`
-tar xzvf $TAR_NAME --wildcards $DEST_DATASET
-tar xzvf $TAR_NAME --wildcards $DEST_MODEL
-tar xzvf $TAR_NAME $DEST_REPORTS
-cd -
-echo "End of script."
diff --git a/install b/install
index b0422b5..5d0f9e3 100755
--- a/install
+++ b/install
@@ -8,59 +8,63 @@ if [ "$(id -u)" = "0" ]; then
fi
echo
-echo "Warning! If all IST services are stoppped press return, else <Ctrl+C> to stop installation."
-echo "Note: Your data will be backupped."
-read help_var
-echo
+echo "OpenTox Ruby"
+echo "Hit <Return> If all services are stoppped, else hit <Ctrl+C>."
+read delete_me
-mkdir -p $HOME/tmp/ >/dev/null 2>&1
+echo "Note: CONFIG (~/.opentox) will be backupped."
+mkdir -p $OT_PREFIX/tmp/ >/dev/null 2>&1
DATE=`date +_%Y%m%d_%H_%M`
-if [ -f "$HOME/.opentox-ui.sh" ]
-then
- mv -v --backup=numbered $HOME/.opentox-ui.sh $HOME/.opentox-ui.sh$DATE
-else
- echo "$HOME/.opentox-ui.sh not found (nothing to backup)."
-fi
-if [ -d "$HOME/.opentox" ]
-then
- mv -v --backup=numbered -T $HOME/.opentox $HOME/.opentox$DATE
-else
- echo "$HOME/.opentox not found (nothing to backup)."
-fi
-if [ -d "$HOME/opentox-ruby" ]
-then
- mv -v --backup=numbered -T $HOME/opentox-ruby $HOME/opentox-ruby$DATE
-else
- echo "$HOME/opentox-ruby not found (nothing to backup)."
-fi
-LOG="$HOME/tmp/`basename $0`-log.txt"
-. "./utils.sh"
+echo "Backups (if any):"
+backup_targets="$HOME/.opentox $HOME/opentox-ruby"
+for bt in $backup_targets; do
+ if [ -f $bt ]; then
+ mv -v --backup=numbered $bt $bt$DATE
+ elif [ -d $bt ]; then
+ mv -v --backup=numbered -T $bt $bt$DATE
+ fi
+done
+echo "Backup finished."
+
+. ./utils.sh
+
+LOG="$OT_PREFIX/tmp/`basename $0`.log"
echo
-echo "Opentox-ruby installation."
-echo "You may need to give root password for some privileged actions right now and later:"
+echo "Welcome to base installation for OpenTox compatible services on Ruby and Debian."
+echo "IMPORTANT: Hit <Ctrl+C> to adjust config.sh first (<Return> to continue)."
+read delete_me
+echo
+echo -n "We need to do some privileged action. "
+sudo echo -n ""
echo
-cmd="sudo echo -n \"\"" && run_cmd "$cmd" "Acquire privileges"
-echo "Cleaning up $HOME/tmp files."
-rm -rf $HOME/tmp/openbabel* $HOME/tmp/kernlab* $HOME/tmp/ruby*
+[ -f $OT_PREFIX/install/utils.sh ] || (cmd="mkdir -p $OT_PREFIX/install && cp utils.sh $OT_PREFIX/install" && run_cmd "$cmd" "Install utils.sh to OT_PREFIX")
+[ -f $HOME/.opentox/config/install/config.sh ] || (cmd="mkdir -p $HOME/.opentox/config/install && cp config.sh $HOME/.opentox/config/install" && run_cmd "$cmd" "Install config.sh to CONFIG (~/.opentox)")
+
+. ./base-install.sh # Debian specific; disable for others.
-. "./base-install.sh"
-. "./ruby.sh"
-. "./openbabel.sh"
-. "./kernlab.sh"
-. "./opentox-ruby.sh"
+if [ ! -d ~/.rbenv ]; then
+ cmd="$GIT clone git://github.com/sstephenson/rbenv.git ~/.rbenv" && run_cmd "$cmd" "rbenv"
+else
+ echo "NOTE: 'rbenv' already installed. Leaving untouched."
+fi
-if [ "$install" != "gem" ]
-then
- . "./nginx.sh"
- . "./redis.sh"
- . "./opentox-webservices.sh"
+if ! grep "rbenv" $OT_UI_CONF >/dev/null 2>&1 ; then
+ echo 'if ! echo "$PATH" | grep "$HOME/.rbenv/bin">/dev/null 2>&1; then export PATH="$HOME/.rbenv/bin:$PATH"; eval "$(rbenv init -)"; fi' >> $OT_UI_CONF
fi
+[ -f $HOME/.opentox/config/ambit_descriptors.yaml ] || (cmd="cp ambit_descriptors.yaml $HOME/.opentox/config/" && run_cmd "$cmd" "Ambit keys file")
+[ -f $HOME/.opentox/config/jl_keys.yaml ] || (cmd="cp jl_keys.yaml $HOME/.opentox/config/" && run_cmd "$cmd" "Joelib keys file")
+
+echo
+echo "Installation finished."
+echo "Destination (OT_PREFIX): '$OT_PREFIX'"
+echo
+echo "IMPORTANT: How to configure your system:"
+echo "IMPORTANT: a) Include '$OT_UI_CONF' in shell startup (e.g. ~/.bashrc)."
+echo "IMPORTANT: b) Manually source '$OT_UI_CONF' every time."
+echo "IMPORTANT: The command in both cases: '. $OT_UI_CONF'"
+echo "IMPORTANT: NOW would be the best time to configure!"
echo
-echo "Installation finished and system configured."
-echo "Destination: '$OT_PREFIX'"
-echo "Nginx: '$NGINX_DEST'"
-echo "Redis: '$REDIS_DEST'"
-echo "IMPORTANT: Include the file '$OT_UI_CONF' in your shell or system startup to have the system automatically configured."
+echo "Thank you for your attention."
echo
diff --git a/kernlab.sh b/kernlab.sh
deleted file mode 100755
index aad125d..0000000
--- a/kernlab.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/sh
-#
-# Installs Kernlab.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR="`pwd`"
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-WGET="`which wget`"
-if [ ! -e "$WGET" ]; then
- echo "'wget' missing. Install 'wget' first. Aborting..."
- exit 1
-fi
-
-R="`which R`"
-if [ ! -e "$R" ]; then
- echo "'R' missing. Install 'R' first. Aborting..."
- exit 1
-fi
-
-# Pkg
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Kernlab ('$LOG')."
-
-R_DONE=false
-mkdir "$R_DEST" >/dev/null 2>&1
-if [ ! -d "$R_DEST" ]; then
- echo "Install directory '$R_DEST' is not available! Aborting..."
- exit 1
-else
- if ! rmdir "$R_DEST" >/dev/null 2>&1; then # if not empty this will fail
- R_DONE=true
- else
- mkdir "$R_DEST" >/dev/null 2>&1
- fi
-fi
-
-
-if ! $R_DONE; then
- export R_LIBS="$R_DEST" # To install non-global
- cmd="$R CMD BATCH packs.R" && run_cmd "$cmd" "R packages"
- eval "$cmd"
-fi
-
-
-if [ ! -f $R_CONF ]; then
-
- echo "if echo \"\$R_LIBS\" | grep -v \"$R_DEST\">/dev/null 2>&1; then export R_LIBS=\"$R_DEST\"; fi" >> "$R_CONF"
- echo "if ! [ -d \"$R_DEST\" ]; then echo \"\$0: '$R_DEST' is not a directory!\"; fi" >> "$R_CONF"
- echo "R package destination has been stored in '$R_CONF'."
-
- if ! grep "$R_CONF" $OT_UI_CONF >/dev/null 2>&1 ; then
- echo ". \"$R_CONF\"" >> $OT_UI_CONF
- fi
-
-fi
-
-cd "$DIR"
-
diff --git a/nginx.conf b/nginx.conf
deleted file mode 100644
index c15dc02..0000000
--- a/nginx.conf
+++ /dev/null
@@ -1,43 +0,0 @@
-worker_processes 10;
-
-events {
- worker_connections 1024;
-}
-
-http {
-
- server_names_hash_bucket_size 256;
-
- passenger_root RUBY_DEST/lib/ruby/gems/1.8/gems/PASSENGER;
- passenger_ruby RUBY_DEST/bin/ruby;
- passenger_default_user USER;
- passenger_log_level 2;
- passenger_spawn_method conservative;
- #passenger_use_global_queue on;
- passenger_max_pool_size 30;
-
- include NGINX_DEST/conf/mime.types;
- default_type application/octet-stream;
-
- sendfile on;
- keepalive_timeout 65;
-
- # webservices
- server {
- listen NGINX_PORT;
- client_max_body_size 5000m;
- server_name SERVERNAME;
- location / {
- root WWW_DEST;
- passenger_enabled on;
- }
- passenger_base_uri /compound;
- passenger_base_uri /dataset;
- passenger_base_uri /algorithm;
- passenger_base_uri /model;
- passenger_base_uri /task;
- passenger_base_uri /validation;
- passenger_base_uri /toxcreate;
- }
-
-}
diff --git a/nginx.sh b/nginx.sh
deleted file mode 100755
index cb8c6b6..0000000
--- a/nginx.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-#
-# Installs Passenger.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR="`pwd`"
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-PIN="`which passenger-install-nginx-module`"
-if [ ! -e "$PIN" ]; then
- echo "'passenger-install-nginx-module' missing. Install 'passenger-install-nginx-module' first. Aborting..."
- exit 1
-fi
-
-GIT="`which git`"
-if [ ! -e "$GIT" ]; then
- echo "'git' missing. Install 'git' first. Aborting..."
- exit 1
-fi
-
-
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Nginx ('$LOG'):"
-
-NGINX_DONE=false
-mkdir "$NGINX_DEST" >/dev/null 2>&1
-if [ ! -d "$NGINX_DEST" ]; then
- echo "Install directory '$NGINX_DEST' is not available! Aborting..."
- exit 1
-else
- if ! rmdir "$NGINX_DEST" >/dev/null 2>&1; then # if not empty this will fail
- NGINX_DONE=true
- fi
-fi
-
-if ! $NGINX_DONE; then
- cmd="$PIN --auto-download --auto --prefix=$NGINX_DEST" && run_cmd "$cmd" "Install"
-fi
-
-cd "$RUBY_DEST/lib/ruby/gems/1.8/gems/" >>$LOG 2>&1
-passenger=`ls -d passenger*`
-cd - >>$LOG 2>&1
-servername=`hostname`
-$GIT checkout nginx.conf>>$LOG 2>&1
-cmd="sed -i -e \"s,PASSENGER,$passenger,;s,SERVERNAME,$servername,;s,RUBY_DEST,$RUBY_DEST,;s,NGINX_DEST,$NGINX_DEST,;s,WWW_DEST,$WWW_DEST,\" ./nginx.conf" && run_cmd "$cmd" "Config"
-cmd="sed -i -e \"s,USER,`whoami`,\" ./nginx.conf" && run_cmd "$cmd" "User"
-
-if [ -z "$NGINX_PORT" ]; then
- NGINX_PORT=80
-else
- NGINX_PORT=`echo "$NGINX_PORT" | sed 's/^.//g'`
-fi
-cmd="sed -i -e \"s,NGINX_PORT,$NGINX_PORT,\" ./nginx.conf" && run_cmd "$cmd" "NGINX_PORT"
-cmd="cp ./nginx.conf \"$NGINX_DEST/conf\"" && run_cmd "$cmd" "Copy"
-$GIT checkout nginx.conf>>$LOG 2>&1
-
-if [ ! -f $NGINX_CONF ]; then
- echo "if ! echo \"\$PATH\" | grep \"$NGINX_DEST\">/dev/null 2>&1; then export PATH=$NGINX_DEST/sbin:\$PATH; fi" >> "$NGINX_CONF"
- echo "Nginx configuration has been stored in '$NGINX_CONF'."
-
- if ! grep ". \"$NGINX_CONF\"" $OT_UI_CONF; then
- echo ". \"$NGINX_CONF\"" >> $OT_UI_CONF
- fi
-
-fi
-
-
-cd "$DIR"
-
diff --git a/openbabel.sh b/openbabel.sh
deleted file mode 100755
index 3016d95..0000000
--- a/openbabel.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/bin/sh
-#
-# Installs Openbabel.
-# A configuration file is created and included in your '$OT_UI_CONF'.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR="`pwd`"
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-WGET="`which wget`"
-if [ ! -e "$WGET" ]; then
- echo "'wget' missing. Install 'wget' first. Aborting..."
- exit 1
-fi
-
-# Pkg
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Openbabel ('$OB_DEST', '$LOG'):"
-
-
-mkdir "$OB_DEST" >/dev/null 2>&1
-if [ ! -d "$OB_DEST" ]; then
- echo "Install directory '$OB_DEST' is not available! Aborting..."
- exit 1
-else
- if ! rmdir "$OB_DEST" >/dev/null 2>&1; then # if not empty this will fail
- OB_DONE=true
- fi
-fi
-
-if [ ! $OB_DONE ]; then
- cd "$HOME/tmp">>$LOG 2>/dev/null
- URI="http://downloads.sourceforge.net/project/openbabel/openbabel/$OB_NUM_VER/$OB_VER.tar.gz?use_mirror=kent"
- if ! [ -d "$HOME/tmp/$OB_VER" ]; then
- cmd="$WGET $URI" && run_cmd "$cmd" "Download"
- cmd="tar zxf $OB_VER.tar.gz?use_mirror=kent $OB_VER" && run_cmd "$cmd" "Unpack"
- fi
- cd "$HOME/tmp/$OB_VER">>$LOG 2>/dev/null
-
- cmd="./configure --prefix=$OB_DEST" && run_cmd "$cmd" "Configure"
- cmd="make" && run_cmd "$cmd" "Make"
- cmd="make install" && run_cmd "$cmd" "Install"
-fi
-
-if [ ! -f "$OB_CONF" ]; then
-
- echo "if echo \"\$PATH\" | grep -v \"$OB_DEST\">/dev/null 2>&1; then export PATH=\"$OB_DEST/bin:\$PATH\"; fi" >> "$OB_CONF"
- echo "if echo \"\$LD_LIBRARY_PATH\" | grep -v \"$OB_DEST\">/dev/null 2>&1; then export LD_LIBRARY_PATH=\"$OB_DEST/lib:\$LD_LIBRARY_PATH\"; fi" >> "$OB_CONF"
- echo "if ! [ -d \"$OB_DEST\" ]; then echo \"\$0: '$OB_DEST' is not a directory!\"; fi" >> "$OB_CONF"
-
- echo "if [ -z \"\$BABEL_LIBDIR\" ]; then export BABEL_LIBDIR=\"$OB_DEST/lib/openbabel/$OB_NUM_VER\"; fi" >> "$OB_CONF"
- echo "if ! [ -d \"\$BABEL_LIBDIR\" ]; then echo \"\$0: '\$BABEL_LIBDIR' is not a directory!\"; fi" >> "$OB_CONF"
-
- echo "if [ -z \"\$BABEL_DATADIR\" ]; then export BABEL_DATADIR=\"$OB_DEST/share/openbabel/$OB_NUM_VER\"; fi" >> "$OB_CONF"
- echo "if ! [ -d \"\$BABEL_DATADIR\" ]; then echo \"\$0: '\$BABEL_DATADIR' is not a directory!\"; fi" >> "$OB_CONF"
-
- echo "if echo \"\$RUBYLIB\" | grep -v \"$OB_DEST_BINDINGS\">/dev/null 2>&1; then export RUBYLIB=\"$OB_DEST_BINDINGS:\$RUBYLIB\"; fi" >> "$RUBY_CONF"
- echo "if ! [ -d \"$OB_DEST_BINDINGS\" ]; then echo \"\$0: '$OB_DEST_BINDINGS' is not a directory!\"; fi" >> "$RUBY_CONF"
-
- echo "Openbabel configuration has been stored in '$OB_CONF'."
- if ! grep "$OB_CONF" $OT_UI_CONF >/dev/null 2>&1 ; then
- echo ". \"$OB_CONF\"" >> $OT_UI_CONF
- fi
-
-fi
-
-echo "Bindings:"
-OB_DONE=false
-. "$OT_UI_CONF"
-mkdir -p "$OB_DEST_BINDINGS">/dev/null 2>&1
-if [ ! -d "$OB_DEST_BINDINGS" ]; then
- echo "Install directory '$OB_DEST_BINDINGS' is not available! Aborting..."
- exit 1
-else
- if [ "`ls $OB_DEST_BINDINGS | wc -l`" -gt 0 ]; then
- OB_DONE=true
- fi
-fi
-
-if ! $OB_DONE ; then
- OB_SRC_DIR="$HOME/tmp/$OB_VER/scripts/ruby/"
- cd "$OB_SRC_DIR"
- cmd="ruby extconf.rb --with-openbabel-include=$OB_DEST/include/openbabel-2.0 --with-openbabel-lib=$OB_DEST/lib" && run_cmd "$cmd" "Code"
- cmd="make" && run_cmd "$cmd" "Make"
- cmd="cp openbabel.so $OB_DEST_BINDINGS" && run_cmd "$cmd" "Install"
- cmd="ln -sf $OB_DEST_BINDINGS/openbabel.so $RUBY_DEST/lib/ruby/site_ruby/1.8/`uname -m`-linux/" && run_cmd "$cmd" "Link"
- cd "$DIR"
- . "`pwd`/utils.sh"
- cmd="ruby test-ob-rb.rb" && run_cmd "$cmd" "Load"
-fi
-
diff --git a/opentox-ruby.sh b/opentox-ruby.sh
deleted file mode 100755
index f080373..0000000
--- a/opentox-ruby.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-#
-# Installs Opentox-ruby gem.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR="`pwd`"
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-GIT="`which git`"
-if [ ! -e "$GIT" ]; then
- echo "'git' missing. Install 'git' first. Aborting..."
- exit 1
-fi
-
-GEM="`which gem`"
-if [ ! -e "$GEM" ]; then
- echo "'gem' missing. Install 'gem' first. Aborting..."
- exit 1
-fi
-
-RAKE="`which rake`"
-if [ ! -e "$RAKE" ]; then
- echo "'rake' missing. Install 'rake' first. Aborting..."
- exit 1
-fi
-
-
-# Pkg
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Opentox-ruby ('$LOG'):"
-
-for mygem in opentox-ruby builder jeweler; do
- if ! $GEM list | sed 's/\ .*//g' | grep -x "$mygem" >/dev/null 2>&1; then
- cmd="$GEM install $mygem" && run_cmd "$cmd" "$mygem"
- fi
-done
-
-
-servername="`hostname`"
-serverdomain="`dnsdomainname`"
-if [ -n "$serverdomain" ]; then
- servername="$servername"."$serverdomain"
-fi
-escapedserver="`echo $servername | sed 's/\/\\\//'`"
-
-if [ "$OT_BRANCH" = "development" ]; then
- logger=":logger: backtrace"
-else
- logger=""
-fi
-
-if [ "$OT_INSTALL" = "server" ]; then
- aa="https:\/\/opensso.in-silico.ch"
-else
- aa=""
-fi
-
-mkdir -p "$HOME/.opentox/config" >>$LOG 2>&1
-mkdir -p "$HOME/.opentox/log" >>$LOG 2>&1
-mkdir -p "$HOME/.opentox/tmp" >>$LOG 2>&1
-
-$GIT checkout production.yaml >>$LOG 2>&1
-$GIT checkout aa-$OT_INSTALL.yaml >>$LOG 2>&1
-
-cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,;s,NGINX_PORT,$NGINX_PORT,;s,OHM_PORT,$OHM_PORT,\" production.yaml > $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 1"
-cmd="sed -e \"s,SERVERNAME,$servername,;s,ESCAPEDSERVER,$escapedserver,;s,LOGGER,$logger,;s,AA,$aa,;s,WWW_DEST,$WWW_DEST,;s,NGINX_PORT,$NGINX_PORT,;s,OHM_PORT,$OHM_PORT,\" aa-$OT_INSTALL.yaml >> $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config 2"
-cmd="cp pc_descriptors.yaml $HOME/.opentox/config/" && run_cmd "$cmd" "Ambit"
-
-if [ "$OT_BRANCH" = "development" ] || expr match "$OT_BRANCH" "release"; then
- mkdir -p $WWW_DEST/opentox >>$LOG 2>&1
- cd $WWW_DEST/opentox >>$LOG 2>&1
- rm -rf opentox-ruby >>$LOG 2>&1
- $GIT clone git://github.com/opentox/opentox-ruby.git >>$LOG 2>&1
- cd opentox-ruby >>$LOG 2>&1
- $GIT checkout -b $OT_BRANCH origin/$OT_BRANCH >>$LOG 2>&1
- cmd="$RAKE install" && run_cmd "$cmd" "Install"
- GEM_LIB=`$GEM which opentox-ruby | sed 's/\/opentox-ruby.rb//'`
- rm -rf "$GEM_LIB~" >>$LOG 2>&1
- mv "$GEM_LIB" "$GEM_LIB~" >>$LOG 2>&1
- cmd="ln -sf $WWW_DEST/opentox/opentox-ruby/lib $GEM_LIB" && run_cmd "$cmd" "Linking back"
-fi
-
-cd "$DIR"
diff --git a/opentox-webservices.sh b/opentox-webservices.sh
deleted file mode 100755
index f9a85e2..0000000
--- a/opentox-webservices.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/sh
-#
-# Installs Opentox Webservices.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR=`pwd`
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-WGET="`which wget`"
-if [ ! -e "$WGET" ]; then
- echo "'wget' missing. Install 'wget' first. Aborting..."
- exit 1
-fi
-
-RAKE="`which rake`"
-if [ ! -e "$RAKE" ]; then
- echo "'rake' missing. Install 'rake' first. Aborting..."
- exit 1
-fi
-
-GIT="`which git`"
-if [ ! -e "$GIT" ]; then
- echo "'git' missing. Install 'git' first. Aborting..."
- exit 1
-fi
-
-RUBY="`which ruby`"
-if [ ! -e "$RUBY" ]; then
- echo "'ruby' missing. Install 'ruby' first. Aborting..."
- exit 1
-fi
-
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Webservices ('$LOG'):"
-
-mkdir -p "$WWW_DEST/opentox" >>$LOG 2>&1
-cd "$WWW_DEST/opentox" >>$LOG 2>&1
-for s in compound dataset algorithm model toxcreate task validation; do
- rm -rf "$s" >>$LOG 2>&1
- $GIT clone "git://github.com/opentox/$s.git" "$s" >>$LOG 2>&1
- cd "$s" >>$LOG 2>&1
- $GIT checkout -b $OT_BRANCH origin/$OT_BRANCH >>$LOG 2>&1
- #rm -rf public >>$LOG 2>&1
- #mkdir public >>$LOG 2>&1
- mypath_from="$WWW_DEST/opentox/$s/public"
- mypath_to="$WWW_DEST/$s"
- cmd="ln -sf \"$mypath_from\" \"$mypath_to\"" && run_cmd "$cmd" "Linking $s"
- cd - >>$LOG 2>&1
-done
-
-# fminer etc
-cmd="test -f $HOME/.opentox/config/production.yaml" && run_cmd "$cmd" "Config present"
-cd "$WWW_DEST/opentox/algorithm" >>$LOG 2>&1
-cmd="$GIT submodule init" && run_cmd "$cmd" "Submodules init"
-cmd="$GIT submodule update" && run_cmd "$cmd" "Submodules update"
-cd "libfminer/libbbrc">>$LOG 2>&1
-$GIT checkout $OT_BRANCH>>$LOG 2>&1
-$GIT pull >>$LOG 2>&1
-cd - >>$LOG 2>&1
-cd "libfminer/liblast">>$LOG 2>&1
-$GIT checkout $OT_BRANCH>>$LOG 2>&1
-$GIT pull >>$LOG 2>&1
-cd - >>$LOG 2>&1
-for mylib in bbrc last; do
- cmd="sed -i 's,^INCLUDE_OB.*,INCLUDE_OB\ =\ -I$OB_DEST/include/openbabel-2.0,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile; sed -i 's,^LDFLAGS_OB.*,LDFLAGS_OB\ =\ -L$OB_DEST/lib,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile" && run_cmd "$cmd" "Makefile $mylib (OB)"
- cmd="sed -i 's,^INCLUDE_RB.*,INCLUDE_RB\ =\ -I$RUBY_DEST/lib/ruby/1.8/`uname -m`-linux,g' $WWW_DEST/opentox/algorithm/libfminer/lib$mylib/Makefile" && run_cmd "$cmd" "Makefile $mylib (RB)"
-done
-cd "libfminer/libbbrc">>$LOG 2>&1
-cmd="make ruby" && run_cmd "$cmd" "Make BBRC"
-cd - >>$LOG 2>&1
-cd "libfminer/liblast">>$LOG 2>&1
-cmd="make ruby" && run_cmd "$cmd" "Make LAST"
-cd - >>$LOG 2>&1
-cd "last-utils">>$LOG 2>&1
-$GIT checkout $OT_BRANCH>>$LOG 2>&1
-$GIT pull >>$LOG 2>&1
-cd - >>$LOG 2>&1
-cd "bbrc-sample">>$LOG 2>&1
-$GIT checkout $OT_BRANCH>>$LOG 2>&1
-$GIT pull >>$LOG 2>&1
-
-cd "$DIR"
-
diff --git a/ot-tools-root.sh b/ot-tools-root.sh
deleted file mode 100644
index 9198f83..0000000
--- a/ot-tools-root.sh
+++ /dev/null
@@ -1,88 +0,0 @@
-# Some useful scripts to put in your ~/.bashrc in case you are using bash (assuming OT_PREFIX is '~/opentox-ruby'):
-# USE ONLY IF YOUR NGINX PORT IS less or equal to 1024 (PRIVILEGED)
-
-# Load server config
-otconfig() {
- source $HOME/.opentox-ui.sh
-}
-
-# Update the version
-otupdate() {
- START_DIR=`pwd`
- otconfig
- cd $HOME/opentox-ruby/www/opentox
- for d in `find -not -name "." -type d -maxdepth 1 2>/dev/null`; do echo ; echo $d ; cd $d ; MYBRANCH=`git branch | grep "*" | sed 's/.*\ //g'`; git pull origin $MYBRANCH ; cd - ; done
- cd $HOME/opentox-ruby/www/opentox/algorithm/libfminer
- mv libbbrc/Makefile libbbrc/Makefile~
- mv liblast/Makefile liblast/Makefile~
- if ! git pull; then
- echo "Error! Pull for Fminer failed."
- return 1
- fi
- mv libbbrc/Makefile~ libbbrc/Makefile
- mv liblast/Makefile~ liblast/Makefile
- make -C libbbrc/ clean
- make -C libbbrc/ ruby
- make -C liblast/ clean
- make -C liblast/ ruby
- cd -
- cd $HOME/opentox-ruby/www/opentox/algorithm/last-utils
- if ! git pull; then
- echo "Error! Pull for Last-Utils failed."
- return 1
- fi
- cd -
- cd $HOME/opentox-ruby/www/opentox/algorithm/bbrc-sample
- if ! git pull; then
- echo "Error! Pull for Bbrc-Sample failed."
- return 1
- fi
- cd -
- cd opentox-ruby
- LINK_DIR=`gem which opentox-ruby | sed 's/\/opentox-ruby.rb//'`
- if [ -h $LINK_DIR ]; then
- rm -f $LINK_DIR
- fi
- rake install
- if ! [ -h $LINK_DIR ]; then
- echo "Warning! Your lib $LINK_DIR is no symlink. Linking back for you..."
- rm -rf "$LINK_DIR~"
- mv "$LINK_DIR" "$LINK_DIR~"
- ln -sf $HOME/opentox-ruby/www/opentox/opentox-ruby/lib `echo ${LINK_DIR::${#LINK_DIR}-3}`
- fi
- echo "Please execute 'otstart' to restart."
- cd "$START_DIR"
-}
-
-# Start the server
-otstart() {
- otconfig
- otkill
- sudo bash -c "source $HOME/.opentox-ui.sh; nohup redis-server $HOME/opentox-ruby/redis-*/redis.conf >/dev/null 2>&1 &"
- sudo bash -c "source $HOME/.opentox-ui.sh; nohup nginx -c $HOME/opentox-ruby/nginx/conf/nginx.conf >/dev/null 2>&1 &"
- sleep 2
- if ! pgrep -u root nginx>/dev/null 2>&1; then echo "Failed to start nginx."; fi
- if ! pgrep -u root redis-server>/dev/null 2>&1; then echo "Failed to start redis."; fi
-}
-
-# Display log
-alias otless='less $HOME/.opentox/log/production.log'
-
-# Tail log
-alias ottail='tail -f $HOME/.opentox/log/production.log'
-
-# Reload the server
-otreload() {
- otconfig
- sudo bash -c "source $HOME/.opentox-ui.sh; nginx -s reload"
-}
-
-# Kill the server
-otkill() {
- otconfig
- sudo killall -u root nginx >/dev/null 2>&1
- sudo bash -c "source $HOME/.opentox-ui.sh; redis-cli -p $OHM_PORT shutdown >/dev/null 2>&1"
- while sudo ps x | grep PassengerWatchdog | grep -v grep >/dev/null 2>&1; do sleep 1; done
- while sudo ps x | grep Rack | grep -v grep >/dev/null 2>&1; do sleep 1; done
- for p in `pgrep -u root R 2>/dev/null`; do sudo kill -9 $p; done
-}
diff --git a/ot-tools-user.sh b/ot-tools-user.sh
deleted file mode 100644
index 49278a1..0000000
--- a/ot-tools-user.sh
+++ /dev/null
@@ -1,97 +0,0 @@
-# Some useful scripts to put in your ~/.bashrc in case you are using bash (assuming OT_PREFIX is '~/opentox-ruby'):
-# USE ONLY IF YOUR NGINX PORT IS >1024 (NOT PRIVILEGED)
-
-# Load server config
-otconfig() {
- source $HOME/.opentox-ui.sh
-}
-
-# Update the version
-otupdate() {
- START_DIR=`pwd`
- otconfig
- cd $HOME/opentox-ruby/www/opentox
- for d in `find -not -name "." -type d -maxdepth 1 2>/dev/null`; do echo ; echo $d ; cd $d ; MYBRANCH=`git branch | grep "*" | sed 's/.*\ //g'`; git pull origin $MYBRANCH ; cd - ; done
- cd $HOME/opentox-ruby/www/opentox/algorithm/libfminer
- mv libbbrc/Makefile libbbrc/Makefile~
- mv liblast/Makefile liblast/Makefile~
- if ! git pull; then
- echo "Error! Pull for Fminer failed."
- return 1
- fi
- mv libbbrc/Makefile~ libbbrc/Makefile
- mv liblast/Makefile~ liblast/Makefile
- make -C libbbrc/ clean
- make -C libbbrc/ ruby
- make -C liblast/ clean
- make -C liblast/ ruby
- cd -
- cd $HOME/opentox-ruby/www/opentox/algorithm/last-utils
- if ! git pull; then
- echo "Error! Pull for Last-Utils failed."
- return 1
- fi
- cd -
- cd $HOME/opentox-ruby/www/opentox/algorithm/bbrc-sample
- if ! git pull; then
- echo "Error! Pull for Bbrc-Sample failed."
- return 1
- fi
- cd -
- cd opentox-ruby
- LINK_DIR=`gem which opentox-ruby | sed 's/\/opentox-ruby.rb//'`
- if [ -h $LINK_DIR ]; then
- rm -f $LINK_DIR
- fi
- rake install
- if ! [ -h $LINK_DIR ]; then
- echo "Warning! Your lib $LINK_DIR is no symlink. Linking back for you..."
- rm -rf "$LINK_DIR~"
- mv "$LINK_DIR" "$LINK_DIR~"
- ln -sf $HOME/opentox-ruby/www/opentox/opentox-ruby/lib `echo ${LINK_DIR::${#LINK_DIR}-3}`
- fi
- echo "Please execute 'otstart' to restart."
- cd "$START_DIR"
-}
-
-# Start the server
-otstart() {
- otconfig
- otkill
- nice bash -c "nohup redis-server $HOME/opentox-ruby/redis-*/redis.conf >/dev/null 2>&1 &"
- nice bash -c "nohup nginx -c $HOME/opentox-ruby/nginx/conf/nginx.conf >/dev/null 2>&1 &"
- sleep 2
- if ! pgrep -u $USER nginx>/dev/null 2>&1; then echo "Failed to start nginx."; fi
- if ! pgrep -u $USER redis-server>/dev/null 2>&1; then echo "Failed to start redis."; fi
-}
-
-# Display log
-alias otless='less $HOME/.opentox/log/production.log'
-
-# Tail log
-alias ottail='tail -f $HOME/.opentox/log/production.log'
-
-# Reload the server
-otreload() {
- otconfig
- bash -c "nginx -s reload"
-}
-
-# Kill the server
-otkill() {
- otconfig
- killall nginx >/dev/null 2>&1
- bash -c "redis-cli -p $OHM_PORT shutdown >/dev/null 2>&1"
- while ps x | grep PassengerWatchdog | grep -v grep >/dev/null 2>&1; do sleep 1; done
- while ps x | grep Rack | grep -v grep >/dev/null 2>&1; do sleep 1; done
- for p in `pgrep -u $USER R 2>/dev/null`; do kill -9 $p; done
-}
-
-# Check the server
-otcheck() {
- check_service=`cat $HOME/.opentox/config/production.yaml | grep opentox-algorithm | sed 's/.*\s//g' | sed 's/"//g'`
- if [ -z "`curl -v $check_service 2>&1 | grep '200 OK'`" ]; then
- otstart
- fi
-}
-
diff --git a/packs.R b/packs.R
deleted file mode 100644
index d89c94b..0000000
--- a/packs.R
+++ /dev/null
@@ -1,6 +0,0 @@
-# CRAN package installer for opentox-ruby
-# AM, 2012
-
-# set mirror to avoid questioning the user
-options(repos="http://mirrors.softliste.de/cran")
-install.packages(c("caret", "doMC", "e1071", "foreach", "iterators", "kernlab", "multicore", "plyr", "reshape", "randomForest", "RANN", "TunePareto"))
diff --git a/production.yaml b/production.yaml
deleted file mode 100644
index e0f39d4..0000000
--- a/production.yaml
+++ /dev/null
@@ -1,26 +0,0 @@
-:base_dir: WWW_DEST
-
-:services:
-# make sure to enter a full uri (including training slash)
- opentox-compound: "http://SERVERNAMENGINX_PORT/compound/"
- opentox-dataset: "http://SERVERNAMENGINX_PORT/dataset/"
- opentox-algorithm: "http://SERVERNAMENGINX_PORT/algorithm/"
- opentox-model: "http://SERVERNAMENGINX_PORT/model/"
- opentox-task: "http://SERVERNAMENGINX_PORT/task/"
- opentox-toxcreate: "http://SERVERNAMENGINX_PORT/toxcreate/"
- opentox-validation: "http://SERVERNAMENGINX_PORT/validation/"
- opentox-ontology: "http://apps.ideaconsult.net:8080/ontology"
-
-:json_hosts:
- - "localhost"
- - "SERVERNAME"
- - "webservices.in-silico.ch"
- - "opentox.informatik.uni-freiburg.de"
-
-:ohm_port: OHM_PORT
-
-# Uncomment for verbose logging
-LOGGER
-:logger: debug
-:backtrace: true
-
diff --git a/redis.sh b/redis.sh
deleted file mode 100755
index f07d119..0000000
--- a/redis.sh
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-#
-# Installs Redis.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR=`pwd`
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-WGET="`which wget`"
-if [ ! -e "$WGET" ]; then
- echo "'wget' missing. Install 'wget' first. Aborting..."
- exit 1
-fi
-
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Redis ('$LOG'):"
-
-
-REDIS_DONE=false
-mkdir "$REDIS_DEST" >/dev/null 2>&1
-if [ ! -d "$REDIS_DEST" ]; then
- echo "Install directory '$REDIS_DEST' is not available! Aborting..."
- exit 1
-else
- if ! rmdir "$REDIS_DEST" >/dev/null 2>&1; then # if not empty this will fail
- REDIS_DONE=true
- fi
-fi
-
-if ! $REDIS_DONE; then
- echo "vm.overcommit_memory = 1" | sudo tee -a /etc/sysctl.conf >>$LOG 2>&1
-
- cd $OT_PREFIX
- URI="http://redis.googlecode.com/files/redis-$REDIS_VER.tar.gz"
- if ! [ -d "redis-$REDIS_VER" ]; then
- cmd="$WGET $URI" && run_cmd "$cmd" "Download"
- cmd="tar zxf redis-$REDIS_VER.tar.gz" && run_cmd "$cmd" "Unpack"
- fi
- cd redis-$REDIS_VER >>$LOG 2>&1
- cmd="make" && run_cmd "$cmd" "Make"
-
- if ! grep "daemonize yes" $REDIS_SERVER_CONF >>$LOG 2>&1 ; then
- echo "daemonize yes" > $REDIS_SERVER_CONF 2>$LOG
- fi
-
- if ! grep "dir `pwd`" $REDIS_SERVER_CONF >>$LOG 2>&1 ; then
- echo "dir `pwd`" >> $REDIS_SERVER_CONF 2>$LOG
- fi
-
- if ! grep "save 900 1" $REDIS_SERVER_CONF >>$LOG 2>&1 ; then
- echo "save 900 1" >> $REDIS_SERVER_CONF 2>$LOG
- fi
-
- if ! grep "port $OHM_PORT" $REDIS_SERVER_CONF >>$LOG 2>&1 ; then
- echo "port $OHM_PORT" >> $REDIS_SERVER_CONF 2>$LOG
- fi
-fi
-
-if [ ! -f $REDIS_CONF ]; then
- echo "if ! echo \"\$PATH\" | grep \"$REDIS_DEST\">/dev/null 2>&1; then export PATH=$REDIS_DEST/src:\$PATH; fi" >> "$REDIS_CONF"
- echo "export OHM_PORT=$OHM_PORT" >> "$REDIS_CONF"
- echo "Redis configuration has been stored in '$REDIS_CONF'."
-
- if ! grep ". \"$REDIS_CONF\"" $OT_UI_CONF; then
- echo ". \"$REDIS_CONF\"" >> $OT_UI_CONF
- fi
-
-fi
-
-cd "$DIR"
diff --git a/ruby.sh b/ruby.sh
deleted file mode 100755
index 8f96604..0000000
--- a/ruby.sh
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-#
-# Installs Ruby enterprise edition and passenger gem.
-# A configuration file is created and included in your '$OT_UI_CONF'.
-# Author: Christoph Helma, Andreas Maunz.
-#
-
-. "`pwd`/utils.sh"
-DIR="`pwd`"
-
-if [ "$(id -u)" = "0" ]; then
- echo "This script must be run as non-root." 1>&2
- exit 1
-fi
-
-# Utils
-WGET="`which wget`"
-if [ ! -e "$WGET" ]; then
- echo "'wget' missing. Install 'wget' first. Aborting..."
- exit 1
-fi
-
-# Pkg
-LOG="$HOME/tmp/`basename $0`-log.txt"
-
-echo
-echo "Ruby Enterprise edition ('$RUBY_DEST', '$LOG')."
-
-
-mkdir "$RUBY_DEST" >/dev/null 2>&1
-if [ ! -d "$RUBY_DEST" ]; then
- echo "Install directory '$RUBY_DEST' is not available! Aborting..."
- exit 1
-else
- if ! rmdir "$RUBY_DEST" >/dev/null 2>&1; then # if not empty this will fail
- RUBY_DONE=true
- fi
-fi
-
-if [ ! $RUBY_DONE ]; then
- cd $HOME/tmp
- URI="http://rubyenterpriseedition.googlecode.com/files/$RUBY_VER.tar.gz"
- if ! [ -d "$HOME/tmp/$RUBY_VER" ]; then
- cmd="$WGET $URI" && run_cmd "$cmd" "Download"
- cmd="tar xzf $RUBY_VER.tar.gz" && run_cmd "$cmd" "Unpack"
- fi
- # Fix Bug
- sed -i '1672s/__memalign/\ volatile\ __memalign/g' $HOME/tmp/$RUBY_VER/source/distro/google-perftools-1.7/src/tcmalloc.cc
- cmd="sh $HOME/tmp/$RUBY_VER/installer --dont-install-useful-gems --no-dev-docs --auto=$RUBY_DEST" && run_cmd "$cmd" "Install"
-fi
-
-
-
-if ! [ -f "$RUBY_CONF" ]; then
- echo "if echo \"\$PATH\" | grep -v \"$RUBY_DEST\">/dev/null 2>&1; then export PATH=\"$RUBY_DEST/bin:\$PATH\"; fi" >> "$RUBY_CONF"
-
- echo "Ruby configuration has been stored in '$RUBY_CONF'."
- if ! grep "$RUBY_CONF" $OT_UI_CONF >/dev/null 2>&1 ; then
- echo ". \"$RUBY_CONF\"" >> $OT_UI_CONF
- fi
-fi
-. "$RUBY_CONF"
-
-
-GEM="`which gem`"
-if [ ! -e "$GEM" ]; then
- echo "'gem' missing. Install 'gem' first. Aborting..."
- exit 1
-fi
-
-if [ "$PASSENGER_SKIP" != "s" ]; then
- export PATH="$RUBY_DEST/bin:$PATH"
- cmd="$GEM sources -a http://gemcutter.org" && run_cmd "$cmd" "Add Gemcutter"
- cmd="$GEM sources -a http://rubygems.org" && run_cmd "$cmd" "Add Rubygems"
- GEMCONF="gem: --no-ri --no-rdoc"
- if ! grep "$GEMCONF" $HOME/.gemrc >>$LOG 2>&1; then
- echo "$GEMCONF" | tee -a $HOME/.gemrc >>$LOG 2>&1
- fi
- if ! $GEM list | grep passenger >/dev/null 2>&1; then
- cmd="$GEM install passenger" && run_cmd "$cmd" "Install Passenger"
- fi
-
-fi
-
-cd "$DIR"
diff --git a/test-ob-rb.rb b/test-ob-rb.rb
deleted file mode 100644
index 62fda1e..0000000
--- a/test-ob-rb.rb
+++ /dev/null
@@ -1 +0,0 @@
-require 'openbabel'
diff --git a/utils.sh b/utils.sh
index 880028c..8a41433 100755
--- a/utils.sh
+++ b/utils.sh
@@ -1,41 +1,78 @@
#!/bin/sh
+# Shell library for service installation and general tools
+# Author: Christoph Helma, Andreas Maunz
+
+# Functions to install ruby and install services with bundler.
+# Ensures presence of ~/.opentox (CONFIG) and OT_PREFIX.
+
check_dest()
{
- if ! [ -d "$OT_PREFIX" ]; then
- if ! mkdir -p "$OT_PREFIX"; then
- echo "Could not create target directory '$OT_PREFIX'! Aborting..."
- exit 1
- fi
+ [ -d "$OT_PREFIX/tmp" ] || mkdir -p "$OT_PREFIX/tmp"
+ if ! [ -d "$OT_PREFIX/tmp" ]; then
+ echo "Could not create OT_PREFIX directory! Aborting..."
+ exit 1
+ fi
+ [ -d "$HOME/.opentox/log" ] || mkdir -p "$HOME/.opentox/log"
+ if ! [ -d "$HOME/.opentox/log" ]; then
+ echo "Could not create CONFIG (~/.opentox) directory! Aborting..."
+ exit 1
fi
}
run_cmd ()
{
- local cmd="$1"
- local title="$2"
-
- printf "%30s" "'$title'"
+ local cmd="$1"; local title="$2"
+ printf "%50s" "$title"
if ! eval $cmd >>$LOG 2>&1 ; then
- printf "%50s\n" "FAIL"
+ printf " [ \033[31m%s\033[m ]\n" "FAIL"
echo "Last 10 lines of log:"
tail -10 "$LOG"
exit 1
fi
- printf "%50s\n" "DONE"
+ printf " [ \033[32m%s\033[m ]\n" "OK"
+}
+
+check_utils() {
+ for u in $1; do
+ eval `echo $u | tr "[:lower:]" "[:upper:]" | tr "-" "_"`=`which $u` || (echo "'$u' missing. Install '$u' first." 1>&2 && exit 1)
+ done
}
-abs_path()
-{
- local path="$1"
- case "$path" in
- /*) absolute=1 ;;
- *) absolute=0 ;;
- esac
+
+install_ruby() {
+ printf "\n%50s\n" "RUBY"
+ local DIR=`pwd`
+ check_utils "rbenv curl make"
+ if ! $RBENV versions $RUBY_NUM_VER | grep $RUBY_NUM_VER>/dev/null 2>&1; then
+ [ -d $DIR/tmp ] || mkdir -p $DIR/tmp && cd $DIR/tmp
+ ([ -d $DIR/tmp/ruby-$RUBY_NUM_VER ] || $CURL $RUBY_DWL/ruby-$RUBY_NUM_VER.tar.gz 2>/dev/null | tar xz) && cd ruby-$RUBY_NUM_VER
+ cmd="./configure --prefix=$RUBY_DIR" && run_cmd "$cmd" "Configure"
+ cmd="$MAKE -j2" && run_cmd "$cmd" "Make"
+ cmd="$MAKE install" && run_cmd "$cmd" "Install"
+ fi
+ cd $DIR
+ cmd="$RBENV rehash" && run_cmd "$cmd" "Rbenv rehash"
+ cmd="$RBENV local $RUBY_NUM_VER" && run_cmd "$cmd" "Rbenv set ruby"
}
-. "`pwd`/config.sh"
-touch "$OT_UI_CONF"
-. "$OT_UI_CONF"
+
+install_with_bundler() {
+ printf "\n%50s\n" "INSTALL"
+ check_utils "gem rbenv"
+ $GEM list | grep bundler >/dev/null 2>&1 || (cmd="$GEM install bundler" && run_cmd "$cmd" "Install bundler")
+ cmd="$RBENV rehash" && run_cmd "$cmd" "Rbenv rehash"
+ cmd="bundle install" && run_cmd "$cmd" "Install using bundler"
+}
+
+
+if [ -z "$OT_PREFIX" ]; then
+ . ./config.sh
+else
+ . $HOME/.opentox/config/install/config.sh
+fi
check_dest
+touch "$OT_UI_CONF"
+. "$OT_UI_CONF" 2>/dev/null
+