summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Maunz <andreas@maunz.de>2011-11-16 17:20:46 +0100
committerAndreas Maunz <andreas@maunz.de>2011-11-16 17:20:46 +0100
commitecb20ea48a05feb74f86408ccd27ecc274d08080 (patch)
tree357e1892e70c0edb338e37cccebc3c4753f4fb4d
parent18880d3774f9f93cba7341f93498ca33fdabc169 (diff)
Separate file for ot-tools
-rw-r--r--README84
-rw-r--r--ot-tools-user.sh80
2 files changed, 85 insertions, 79 deletions
diff --git a/README b/README
index db3b9c0..00ed726 100644
--- a/README
+++ b/README
@@ -13,7 +13,11 @@ Here are some of my goals when writing the installer:
- Encapsulated (everything is installed in a sub-directory in $HOME)
- Logged (all non-elemtary actions are logged)
-Even if we officially support only *one* distro (currently Debian 6.0.1), I tested the installer successfully on various Ubuntus. In the 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.
+
+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.
@@ -24,82 +28,4 @@ nohup $HOME/opentox-ruby/nginx/sbin/nginx -c $HOME/opentox-ruby/nginx/conf/nginx
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).
-Some useful scripts to put in your ~/.bashrc in case you are using bash (assuming OT_PREFIX is '~/opentox-ruby'):
-
-# 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 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() {
- otkill
- bash -c "source $HOME/.opentox-ui.sh; nohup redis-server $HOME/opentox-ruby/redis-2.2.2/redis.conf >/dev/null 2>&1 &"
- 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 $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() {
- bash -c "source $HOME/.opentox-ui.sh; nginx -s reload"
-}
-
-# Kill the server
-otkill() {
- killall nginx >/dev/null 2>&1
- bash -c "source $HOME/.opentox-ui.sh; redis-cli 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
-}
diff --git a/ot-tools-user.sh b/ot-tools-user.sh
new file mode 100644
index 0000000..64f26d3
--- /dev/null
+++ b/ot-tools-user.sh
@@ -0,0 +1,80 @@
+# 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 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() {
+ otkill
+ bash -c "source $HOME/.opentox-ui.sh; nohup redis-server $HOME/opentox-ruby/redis-2.2.2/redis.conf >/dev/null 2>&1 &"
+ 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 $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() {
+ bash -c "source $HOME/.opentox-ui.sh; nginx -s reload"
+}
+
+# Kill the server
+otkill() {
+ killall nginx >/dev/null 2>&1
+ bash -c "source $HOME/.opentox-ui.sh; redis-cli 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
+}
+