From 493dc4f0268a853c8b5488803b14efb5540163b5 Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Wed, 9 Feb 2011 11:30:08 +0100 Subject: initial import --- README | 8 ++++++++ config | 28 ++++++++++++++++++++++++++++ debian.sh | 20 ++++++++++++++++++++ install | 17 +++++++++++++++++ kernlab.sh | 7 +++++++ mysql-setup.sh | 11 +++++++++++ nginx.conf | 39 +++++++++++++++++++++++++++++++++++++++ nginx.sh | 11 +++++++++++ openbabel.sh | 13 +++++++++++++ opentox-ruby.sh | 40 ++++++++++++++++++++++++++++++++++++++++ opentox-webservices.sh | 29 +++++++++++++++++++++++++++++ optional.sh | 3 +++ production.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ ruby.sh | 13 +++++++++++++ 14 files changed, 281 insertions(+) create mode 100644 config create mode 100644 debian.sh create mode 100755 install create mode 100644 kernlab.sh create mode 100644 mysql-setup.sh create mode 100644 nginx.conf create mode 100644 nginx.sh create mode 100644 openbabel.sh create mode 100644 opentox-ruby.sh create mode 100644 opentox-webservices.sh create mode 100644 optional.sh create mode 100644 production.yaml create mode 100644 ruby.sh diff --git a/README b/README index e69de29..05b9324 100644 --- a/README +++ b/README @@ -0,0 +1,8 @@ +Installer for OpenTox IST/ALU Services + +Usage (currently for Debian only): + + git clone http://github.com/helma/opentox-install.git + cd opentox-install + vi config + sh install diff --git a/config b/config new file mode 100644 index 0000000..20da21d --- /dev/null +++ b/config @@ -0,0 +1,28 @@ +#!/bin/sh + +# Configuration options for OpenTox installations (sets shell variables for installation scripts) + +# Linux distribution (currently only debian) +distribution=debian + +# Choose a root password for the MySQL database +# Please insert the correct password if mysql-server is already installed +mysql_root=opentox + +# Services to be installed +# Options: +# gem Installs only the opentox-ruby gem (useful, if you want to use external services with the opentox-ruby DSL) +# all Installs all IST/ALU services (useful for local and server installations) +install=all + +# Installation type +# Options: +# local local installation +# server inter or intranet server +#type=local +type=server + +# Git branch of services +# Options: master test development +# "master" is the current stable version +branch=master diff --git a/debian.sh b/debian.sh new file mode 100644 index 0000000..1e9d5a0 --- /dev/null +++ b/debian.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +echo "Downloading and updating Debian packages" +apt-get install lsb-release +codename=`lsb_release -a|grep Codename|cut -f2` +if ! grep "^deb.*debian\.org.*non-free" /etc/apt/sources.list +then + echo "deb http://ftp.debian.org/debian/ $codename non-free" | tee -a /etc/apt/sources.list +fi +apt-get update -y +apt-get upgrade -y +apt-get install binutils gcc g++ gfortran sun-java6-jdk -y +apt-get install wget hostname pwgen git-core raptor-utils r-base -y # xvfb +. ./config +echo mysql-server-5.1 mysql-server/root_password password $mysql_root | debconf-set-selections +echo mysql-server-5.1 mysql-server/root_password_again password $mysql_root | debconf-set-selections +apt-get install mysql-server -y +apt-get install libssl-dev zlib1g-dev libreadline-dev libmysqlclient-dev libmysqlclient-dev libcurl4-openssl-dev libxml2-dev libxslt1-dev libgsl0.dev -y +sed -i '/^JAVA_HOME=/d' /etc/profile +echo 'export JAVA_HOME=/usr/lib/jvm/java-6-sun' | tee -a /etc/profile diff --git a/install b/install new file mode 100755 index 0000000..c29c514 --- /dev/null +++ b/install @@ -0,0 +1,17 @@ +#!/bin/sh + +. $distribution.sh +. ruby.sh +. nginx.sh +. kernlab.sh +. opentox-ruby.sh +. ./config +if [ $install = "all" ] +then + . opentox-webservices.sh + . mysql-setup.sh + echo "Starting Nginx" + echo "Please inspect and tune /opt/nginx/conf/nginx.conf and /home/opentox/.opentox/config/production.yaml" + /opt/nginx/sbin/nginx +fi + diff --git a/kernlab.sh b/kernlab.sh new file mode 100644 index 0000000..d96e510 --- /dev/null +++ b/kernlab.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "Installing kernlab" +. /etc/profile +cd /tmp +wget http://cran.r-project.org/src/contrib/Archive/kernlab/kernlab_0.9-11.tar.gz +R CMD INSTALL kernlab_0.9-11.tar.gz diff --git a/mysql-setup.sh b/mysql-setup.sh new file mode 100644 index 0000000..d467cfa --- /dev/null +++ b/mysql-setup.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +echo "Initializing MySql" +. ./config +mysql -u root -p$mysql_root << EOF + DROP DATABASE IF EXISTS $branch; + CREATE DATABASE production; + GRANT ALL PRIVILEGES ON production.* TO production@localhost IDENTIFIED BY "$password"; + FLUSH PRIVILEGES; +EOF + diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..add5f85 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,39 @@ +worker_processes 10; + +events { + worker_connections 1024; +} + +http { + + server_names_hash_bucket_size 256; + + passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/PASSENGER; + passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby; + passenger_default_user opentox; + passenger_log_level 3; + + include mime.types; + default_type application/octet-stream; + + sendfile on; + keepalive_timeout 65; + + # webservices + server { + listen 80; + client_max_body_size 5000m; + server_name SERVERNAME; + root /var/www/; + + 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 new file mode 100644 index 0000000..b41636f --- /dev/null +++ b/nginx.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. /etc/profile +passenger-install-nginx-module --auto-download --auto --prefix=/opt/nginx + +cd /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ +passenger=`ls -d passenger*`; +cd - +servername=`hostname`.`dnsdomainname` +echo $passenger +sed -e "s/PASSENGER/$passenger/;s/SERVERNAME/$servername/" nginx.conf > /opt/nginx/conf/nginx.conf diff --git a/openbabel.sh b/openbabel.sh new file mode 100644 index 0000000..27fa394 --- /dev/null +++ b/openbabel.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +echo "Installing OpenBabel libraries" +. /etc/profile +cd /tmp +wget -O - "http://downloads.sourceforge.net/project/openbabel/openbabel/2.2.3/openbabel-2.2.3.tar.gz?use_mirror=kent" | tar zxv +cd openbabel-2.2.3/ +./configure +make install +cd scripts/ruby/ +ruby extconf.rb --with-openbabel-include=/usr/local/include/openbabel-2.0 +make install +ldconfig diff --git a/opentox-ruby.sh b/opentox-ruby.sh new file mode 100644 index 0000000..47a20a7 --- /dev/null +++ b/opentox-ruby.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +echo "Installing opentox-ruby gem" +. /etc/profile +. ./config +gem install opentox-ruby + +# create config file +password=`pwgen 8 1` +servername=`hostname`.`dnsdomainname` +if [ $branch = "development" ] +then + logger=":logger: backtrace" +else + logger="" +fi + +if [ $type = "server" ] +then + aa="https:\/\/opensso.in-silico.ch" +else + aa=nil +fi + +mkdir -p $HOME/.opentox/config +mkdir -p $HOME/.opentox/log +sed -e "s/PASSWORD/$password/;s/SERVERNAME/$servername/;s/LOGGER/$logger/;s/AA/$aa/" production.yaml > $HOME/.opentox/config/production.yaml + + checkout development version and link lib to opentox-ruby gem +if [ $branch = "development" ] +then + cd /var/www/opentox + git clone http://github.com/mguetlein/opentox-ruby.git + cd opentox-ruby + git checkout -t origin/$branch + gem_lib=`gem which opentox-ruby` + gem_lib=`echo $gem_lib | sed 's/\/opentox-ruby.rb//'` + mv $gem_lib $gem_lib~ + ln -s /var/www/opentox/opentox-ruby/lib $gem_lib +fi diff --git a/opentox-webservices.sh b/opentox-webservices.sh new file mode 100644 index 0000000..d22e5f4 --- /dev/null +++ b/opentox-webservices.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +echo "Installing OpenTox webservices" +. ./config +# Create opentox system user +id opentox +if [ $? -ne 0 ] +then + adduser --system opentox +fi + +mkdir -p /var/www/opentox +cd /var/www/opentox +for s in compound dataset algorithm model toxcreate task; do + git clone git://github.com/helma/opentox-$s.git $s + cd $s + git checkout -t origin/$branch + mkdir -p public + ln -s /var/www/opentox/$s/public /var/www/$s + cd - +done +git clone http://github.com/mguetlein/opentox-validation.git validation +cd validation +git checkout -t origin/$branch +cd - +cd /var/www/opentox/algorithm +rake fminer:install +chown -R opentox /var/www/opentox +cd - diff --git a/optional.sh b/optional.sh new file mode 100644 index 0000000..ca33d03 --- /dev/null +++ b/optional.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +apt-get install screen vim diff --git a/production.yaml b/production.yaml new file mode 100644 index 0000000..354f903 --- /dev/null +++ b/production.yaml @@ -0,0 +1,42 @@ +:base_dir: /var/www/opentox/ + +:database: +# sqlite3 is not recommended (councurrent write) + :adapter: mysql + :database: production + :username: production + :password: PASSWORD + :host: localhost + +:services: +# make sure to enter a full uri (including training slash) + opentox-compound: "http://SERVERNAME/compound/" + opentox-dataset: "http://SERVERNAME/dataset/" + opentox-algorithm: "http://SERVERNAME/algorithm/" + opentox-model: "http://SERVERNAME/model/" + opentox-task: "http://SERVERNAME/task/" + opentox-toxcreate: "http://SERVERNAME/toxcreate/" + opentox-validation: "http://SERVERNAME/validation/" + +:yaml_hosts: + - "localhost" + - "SERVERNAME" + - "webservices.in-silico.ch" + - "opentox.informatik.uni-freiburg.de" + +# Uncomment for verbose logging +LOGGER +# :logger: debug + +# OpenSSO Authorization +# set ":server: nil" to disable A&A +:authorization: + :server: AA + :free_request: #not controlled by A&A + - "GET" + :authenticate_request: #only for authenticated user + - "POST" + :authorize_request: #only for authenticated and authorizeduser + - "DELETE" + - "PUT" + diff --git a/ruby.sh b/ruby.sh new file mode 100644 index 0000000..2518939 --- /dev/null +++ b/ruby.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +echo "Installing Ruby Enterprise" +cd /tmp +wget -O - "http://rubyforge.org/frs/download.php/71096/ruby-enterprise-1.8.7-2010.02.tar.gz" | tar zxv +ruby-enterprise-1.8.7-2010.02/installer --dont-install-useful-gems --no-dev-docs --auto=/opt/ruby-enterprise-1.8.7-2010.02 +sed -i '/^PATH=.*ruby-enterprise/d' /etc/profile +echo 'PATH=$PATH:/opt/ruby-enterprise-1.8.7-2010.02/bin' | tee -a /etc/profile +. /etc/profile +gem sources -a http://gemcutter.org +gem sources -r http://rubygems.org/ +echo "gem: --no-ri --no-rdoc" | tee -a ~/.gemrc +gem install passenger -- cgit v1.2.3