Modified: trunk/installers/ubuntu/README.txt (2850 => 2851)
--- trunk/installers/ubuntu/README.txt 2011-11-28 16:54:40 UTC (rev 2850)
+++ trunk/installers/ubuntu/README.txt 2011-11-29 02:19:59 UTC (rev 2851)
@@ -12,8 +12,8 @@
/bin/bash install.bash
This install script requires the settings file, settings.bash, which needs to be
-kept in th same directory. This can be created by copying the
-default_settings.bash to settings.bash and making the followiing changes
+kept in the same directory. This can be created by copying the
+default_settings.bash to settings.bash and making the following changes
before running install.bash:
myexp_root_password - Choose a password for the root account of MySQL. If for
@@ -23,26 +23,27 @@
myexp_user_password - Choose a password for the account that myExperiment uses
to access databases it creates for storing myExperiment data.
-fq_server_name - The fully-qualified server name for a machine, e.g
-myexperiment.example.org
+fq_server_name - The fully-qualified server name and domain for your server,
+i.e. the A record. E.g. myexperiment.example.org
-exim_smarthost - The mail server you want to user as a relay for emails
-e.g. smtp.example.org
+exim_smarthost_server - The mail server you want to user as a relay for emails.
+E.g. smtp
+exim_smarthost_domain - The mail server you want to user as a relay for emails.
+E.g. example.org
+myexp_cname - The location you intend to host the myExperiment site. This may
+be the same as fq_server_name.
+E.g. myexperiment.example.org
+
+
== Post-installation configuration ==
The installer is designed to work on a freshly installed version of Ubuntu and
will do minimal configuration of myExperiment. To do further configuration
you will need to edit settings.yml in the config directory of the SVN checkout
-of myExperiment by default this /var/rails/myexperiment/config/.
+of myExperiment by default this /var/rails/myexperiment/config/.
-After updating the settings file you will need to restart the myExperiment
-server. To do this go to the file
-/var/rails/myexperiment/tmp/pids/mongrel.pid
-and copy the process id number in this file then run:
+Some configuration may require restarting Apache using the following command:
-kill process_id
-rm /var/rails/myexperiment/tmp/pids/mongrel.pid
-ruby var/rails/myexperiment/script/server -d
-
+sudo apache2ctl restart
Modified: trunk/installers/ubuntu/default_settings.bash (2850 => 2851)
--- trunk/installers/ubuntu/default_settings.bash 2011-11-28 16:54:40 UTC (rev 2850)
+++ trunk/installers/ubuntu/default_settings.bash 2011-11-29 02:19:59 UTC (rev 2851)
@@ -1,34 +1,21 @@
#!/bin/bash
install_dir="/var/rails/myexperiment" # Where to checkout the myExperiment SVN
-mysql_root_password="changme"
+branch="trunk"
+mysql_root_password="changeme"
mysql_user_name="myexp"
mysql_user_password="changeme"
rdoc=1 # Set to 0 if you want no RDoc Ruby Gem documentaion
ri=1 # Set yo 0 if you want no RI Ruby Gem documentatiom
-rake_version="0.7.2"
-rails_version="1.2.6"
+rake_version="0.8.7"
+rails_version="2.3.14"
+passenger_version="2.2.15"
fq_server_name="server.domain"
-exim_smarthost="smtp.domain"
+exim_smarthost_server="smtp"
+exim_smarthost_domain="domain"
+myexp_cname="myexp.domain" # Where your myExperiment will be hosted can be the same as $fq_server_name
+
# Patch Files
-oauth_patch='--- action_controller_request.rb.old 2011-10-26 15:52:34.250151798 +0000
-+++ action_controller_request.rb 2011-10-26 15:50:59.937490274 +0000
-@@ -55,7 +55,13 @@
- end
-
- def request_params
-- request.request_parameters
-+ unless @request_parameters
-+ @request_parameters = request.request_parameters.dup
-+ request.symbolized_path_parameters.keys.each do |k|
-+ @request_parameters.delete k.to_s
-+ end if request.respond_to? :symbolized_path_parameters
-+ end
-+ @request_parameters
- end
-
- end
-'
net_http_patch='Index: lib/net/http.rb
===================================================================
--- lib/net/http.rb (revision 26550)
@@ -41,8 +28,19 @@
+ @socket.close if @socket and not @socket.closed?
raise exception
end'
-settings_patch='--- default_settings.yml 2011-10-26 06:32:16.344994469 +0100
-+++ settings.yml 2011-10-26 06:38:39.788127578 +0100
+
+exim_smarthost="${exim_smarthost_server}.${exim_smarthost_domain}"
+settings_patch='--- default_settings.yml 2011-11-28 18:40:40.337937711 +0000
++++ settings.yml 2011-11-28 19:00:56.231831591 +0000
+@@ -75,7 +75,7 @@
+ #
+ # NOTE: No trailing slash.
+
+-base_uri: http://www.example.com
++base_uri: http://'${myexp_cname}'
+
+ # admins - Set "admins" to the list of usernames of people that are
+ # administrators of this installation. This is "Username" that is set
@@ -302,19 +302,16 @@
# solr_enable - Set solr_enable to true to enable the search facility - this
# requires a running solr server.
@@ -56,25 +54,54 @@
smtp:
- :address: "smtp.example.com"
-+ :address: "relay.ecs.soton.ac.uk"
++ :address: "'${exim_smarthost}'"
:port: 25,
- :domain: ""
- :authentication: :login
- :user_name: "username"
- :password: "password"
-+ :domain: "ecs.soton.ac.uk"
++ :domain: "'${exim_smarthost_domain}'"
# show_debug - Shows query statistics in the footer: "Queries in Controller",
# "Queries in View" and "Query Time".
'
+exim_config="dc_eximconfig_configtype='satellite'
+dc_other_hostnames='${fq_server_name}'
+dc_local_interfaces='127.0.0.1 ; ::1'
+dc_readhost='${fq_server_name}'
+dc_relay_domains=''
+dc_minimaldns='false'
+dc_relay_nets=''
+dc_smarthost='${exim_smarthost}'
+CFILEMODE='644'
+dc_use_split_config='false'
+dc_hide_mailname='true'
+dc_mailname_in_oh='true'
+dc_localdelivery='mail_spool'"
+apache_config="LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-${passenger_version}/ext/apache2/mod_passenger.so
+PassengerRoot /var/lib/gems/1.8/gems/passenger-${passenger_version}
+PassengerRuby /usr/bin/ruby1.8
+RailsEnv development
+
+<VirtualHost *:80>
+ ServerAdmin address@hidden
+ ServerName ${myexp_cname}
+ DocumentRoot ${install_dir}/public
+ <Directory ${install_dir}/public/>
+ AllowOverride all
+ Options -MultiViews
+ </Directory>
+</VirtualHost>"
+
+
# Configure options for (Ruby) gem install
-if [ $rdoc == 0 ]; then
+if [ ${rdoc} == 0 ]; then
nordoc="--no-rdoc"
else
nordoc=""
fi
-if [ $ri == 0 ]; then
+if [ ${ri} == 0 ]; then
nori="--no-ri"
else
nori=""
Modified: trunk/installers/ubuntu/install.bash (2850 => 2851)
--- trunk/installers/ubuntu/install.bash 2011-11-28 16:54:40 UTC (rev 2850)
+++ trunk/installers/ubuntu/install.bash 2011-11-29 02:19:59 UTC (rev 2851)
@@ -8,7 +8,7 @@
echo ""
settings_file=`dirname $0`/settings.bash
-source $settings_file || { echo "Could not find settings file at $settings_file. Aborting ..."; exit 1; }
+source ${settings_file} || { echo "Could not find settings file at ${settings_file}. Aborting ..."; exit 1; }
echo "Preseeding debconf"
sudo su -c "echo mysql-server-5.1 mysql-server/root_password password `echo "'"``echo ${mysql_root_password}``echo "'"` | debconf-set-selections" || { echo "Could not set debconf option mysql-server-5.1 mysql-server/root_password. Aborting ..."; exit 2; }
@@ -16,93 +16,85 @@
echo "Installing required APT packages"
sudo apt-get update || { echo "Could not update apt-get. Aborting ..."; exit 4; }
-sudo -n apt-get install -y build-essential exim4 ruby ruby1.8-dev libzlib-ruby rdoc irb rubygems rake libapache2-mod-fcgid libfcgi-ruby1.8 libmysql-ruby gcj-4.4-jre-headless subversion libopenssl-ruby1.8 libcurl3 libcurl3-gnutls libcurl4-openssl-dev mysql-server graphicsmagick imagemagick librmagick-ruby1.8 libmagick9-dev graphviz mlocate || { echo "Could not install required APT packages. Aborting ..."; exit 5; }
+sudo -n apt-get install -y build-essential exim4 ruby ruby1.8-dev libzlib-ruby rdoc irb rubygems rake apache2 apache2-dev libapache2-mod-fcgid libfcgi-ruby1.8 libmysql-ruby gcj-4.4-jre-headless subversion libopenssl-ruby1.8 libcurl3 libcurl3-gnutls libcurl4-openssl-dev mysql-server graphicsmagick imagemagick librmagick-ruby1.8 libmagick9-dev graphviz mlocate || { echo "Could not install required APT packages. Aborting ..."; exit 5; }
-echo "Installing Rake version $rake_version and Rails version $rails_version Ruby Gems"
-sudo gem install rake $nordoc $nori --version $rake_version || { echo "Could not install Rake Ruby Gem (version $rake_version). Aborting ..."; exit 6; }
-sudo gem install rails $nordoc $nori --version $rails_version || { echo "Could not install Rails Ruby Gem (v$rails_version) and dependencies. Aborting ..."; exit 7; }
+echo "Installing Rake version ${rake_version} and Rails version ${rails_version} Ruby Gems"
+sudo gem install rake ${nordoc} ${nori} --version ${rake_version} || { echo "Could not install Rake Ruby Gem (version ${rake_version}). Aborting ..."; exit 6; }
+sudo gem install rails ${nordoc} ${nori} --version ${rails_version} || { echo "Could not install Rails Ruby Gem (v${rails_version}) and dependencies. Aborting ..."; exit 7; }
echo "Installing Ruby Gems required by myExperiment"
if [ `cat /etc/environment | grep "/var/lib/gems/1.8/bin" | wc -l` -eq 0 ]; then
cat /etc/environment | sed "s/\"$/:\/var\/lib\/gems\/1.8\/bin\"/" | sudo tee /etc/environment > /dev/null || { echo "Could not add Gems path to PATH. Aborting ..."; exit 8;}
fi
-if [ `echo $PATH | grep "/var/lib/gems/1.8/bin" | wc -l` -eq 0 ]; then
- DOLLAR='$'; echo -e "export PATH=${DOLLAR}PATH:/var/lib/gems/1.8/bin\nalias sudo='sudo env PATH=${DOLLAR}PATH'" >> /home/$USER/.bashrc || { echo "Could not write to /home/$USER/.bashrc. Aborting ..."; exit 9;}
- export PATH=$PATH:/var/lib/gems/1.8/bin
+if [ `echo ${PATH} | grep "/var/lib/gems/1.8/bin" | wc -l` -eq 0 ]; then
+ DOLLAR='$'; echo -e "export PATH=${DOLLAR}PATH:/var/lib/gems/1.8/bin\nalias sudo='sudo env PATH=${DOLLAR}PATH'" >> /home/${USER}/.bashrc || { echo "Could not write to /home/${USER}/.bashrc. Aborting ..."; exit 9;}
+ source /home/${USER}/.bashrc || { echo "Could not source /home/${USER}/.bashrc. Aborting ..."; exit 10; }
fi
-sudo gem install $nordoc $nori cgi_multipart_eof_fix daemons dsl_accessor fastthread gem_plugin json mime-types mongrel mongrel_cluster needle net-sftp net-ssh openid_login_generator RedCloth ruby-yadis rubyzip solr-ruby xml-simple libxml-ruby oauth ruby-hmac openurl curb marc taverna-scufl taverna-t2flow || { echo "Could not install all remaining generic Ruby Gems required by myExperiment. Aborting ..."; exit 10; }
-sudo gem install rmagick $nordoc $nori --version=1.15.14 || { echo "Could not install RMagick Ruby Gem. Aborting ..."; exit 11; }
+sudo gem install ${nordoc} ${nori} mongrel_cluster rubyzip oauth libxml-ruby rmagick dsl_accessor ruby-openid openurl curb marc || { echo "Could not install all remaining generic Ruby Gems required by myExperiment. Aborting ..."; exit 11; }
-echo "Making OAuth Ruby Gem compatible with Rails $version"
+echo "Making OAuth Ruby Gem compatible with Rails ${rails_version}"
tempdir=$(mktemp -d /tmp/myexp_installer.XXXXXXXXXX) || { echo "Could not create temporary file for writing patches to. Aborting ..."; exit 12; }
-cd $tempdir || { echo "Could not find temporary directory. Aborting ..."; exit 13; }
-echo "$oauth_patch" > oauth.patch || { echo "Could not write oauth patch file. Aborting ..."; exit 14; }
-echo "$net_http_patch" > net_http.patch || { echo "Could not write net/http patch file. Aborting ..."; exit 15; }
-echo "$settings_patch" > settings.patch || { echo "Could not write settings patch file. Aborting ..."; exit 16; }
-sudo updatedb || { echo "Could not run updatedb so that OAuth Ruby Gem file that needs updating can be located. Aborting ..."; exit 17; }
-oauth_file=`locate lib/oauth/request_proxy/action_controller_request.rb`
-if [ ! -e $oauth_file ]; then
- echo "Could not locate OAuth Ruby Gem file that requires updating. Aborting ..."; exit 18;
-fi
-sudo patch $oauth_file $tempdir/oauth.patch || { echo "Could not patch OAuth Ruby Gem file: $oauth_file. Aborting ..."; exit 19; }
+cd ${tempdir} || { echo "Could not find temporary directory. Aborting ..."; exit 13; }
+echo "${net_http_patch}" > net_http.patch || { echo "Could not write net/http patch file. Aborting ..."; exit 14; }
+echo "${settings_patch}" > settings.patch || { echo "Could not write settings patch file. Aborting ..."; exit 15; }
+sudo updatedb || { echo "Could not run updatedb so that http.rb that needs updating can be located. Aborting ..."; exit 16; }
net_http_file=`locate net/http.rb`
-if [ ! -e $net_http_file ]; then
- echo "Could not locate net/http Ruby file that requires updating. Aborting ..."; exit 20;
+if [ ! -e ${net_http_file} ]; then
+ echo "Could not locate net/http Ruby file that requires updating. Aborting ..."; exit 17;
fi
-sudo patch $net_http_file $tempdir/net_http.patch || { echo "Could not patch net/http Ruby file: $net_http_file. Aborting ..."; exit 21; }
+sudo patch ${net_http_file} ${tempdir}/net_http.patch || { echo "Could not patch net/http Ruby file: ${net_http_file}. Aborting ..."; exit 18; }
echo "Checking out myExperiment codebase from SVN"
cd /
-for idir in `echo $install_dir | awk 'BEGIN{RS="/"}{print $1}'`; do
- if [ -n $idir ]; then
- sudo mkdir $idir
- cd $idir
+for idir in `echo ${install_dir} | awk 'BEGIN{RS="/"}{print $1}'`; do
+ if [ -n ${idir} ]; then
+ if [ ! -d ${idir} ]; then
+ sudo mkdir ${idir} || { echo "Could not create directory ${idir} in `pwd`. Aborting ..."; exit 19; }
+ fi
+ cd ${idir}
fi
done
-sudo chown $USER:www-data $install_dir || { echo "Could not update permissions on $install_dir. Aborting ..."; exit 22; }
-svn checkout svn://rubyforge.org/var/svn/myexperiment/trunk $install_dir || { echo "Could not checkout SVN to $install_dir. Aborting ..."; exit 23; }
-cd ${install_dir}/config/ || { echo "Could not find config directory for myExperiment. Aborting ..."; exit 24; }
+sudo chown ${USER}:www-data ${install_dir} || { echo "Could not update permissions on ${install_dir}. Aborting ..."; exit 20; }
+svn checkout svn://rubyforge.org/var/svn/myexperiment/${branch} ${install_dir} || { echo "Could not checkout SVN to ${install_dir}. Aborting ..."; exit 21; }
+cd ${install_dir}/config/ || { echo "Could not find config directory for myExperiment. Aborting ..."; exit 22; }
echo "Setting up config files for myExperiment"
-cat database.yml.pre | sed "s/username: root/username: $mysql_user_name/" | sed "s/password:/password: $mysql_user_password/" > database.yml || { echo "Could not create database.yml file with appropriate configuration settings. Aborting ..."; exit 25; }
-cp default_settings.yml settings.yml || { echo "Could not copy default_settings.yml to settings.yml ..."; exit 26; }
-patch settings.yml $tempdir/settings.patch || { echo "Could not patch settings.yml. Aborting ..."; exit 27; }
-cp captcha.yml.pre captcha.yml || { echo "Could not create captcha.yml file. Aborting ..."; exit 28; }
+cat database.yml.pre | sed "s/username: root/username: ${mysql_user_name}/" | sed "s/password:/password: ${mysql_user_password}/" > database.yml || { echo "Could not create database.yml file with appropriate configuration settings. Aborting ..."; exit 23; }
+cp default_settings.yml settings.yml || { echo "Could not copy default_settings.yml to settings.yml ..."; exit 24; }
+patch settings.yml ${tempdir}/settings.patch || { echo "Could not patch settings.yml. Aborting ..."; exit 25; }
+cp captcha.yml.pre captcha.yml || { echo "Could not create captcha.yml file. Aborting ..."; exit 26; }
cd ..
-echo "Setting up exim4 (Email) for myExperiment"
-echo "dc_eximconfig_configtype='satellite'
-dc_other_hostnames='${fq_server_name}'
-dc_local_interfaces='127.0.0.1 ; ::1'
-dc_readhost='${fq_server_name}'
-dc_relay_domains=''
-dc_minimaldns='false'
-dc_relay_nets=''
-dc_smarthost='${exim_smarthost}'
-CFILEMODE='644'
-dc_use_split_config='false'
-dc_hide_mailname='true'
-dc_mailname_in_oh='true'
-dc_localdelivery='mail_spool'" | sudo tee /etc/exim4/update-exim4.conf.conf > /dev/null || { echo "Could not write new exim4 config. Aborting..."; exit 29; }
-echo "${fq_server_name}" | sudo tee /etc/mailname > /dev/null || { echo "Could not update hostname for /etc/mailname. Aborting..."; exit 30; }
-sudo dpkg-reconfigure -fnoninteractive exim4-config || { echo "Could not write new reconfingure exim4. Aborting..."; exit 31; }
+echo "Setting up exim (Email) for myExperiment"
+echo "${exim_config}" | sudo tee /etc/exim4/update-exim4.conf.conf > /dev/null || { echo "Could not write new exim4 config. Aborting..."; exit 27; }
+echo "${fq_server_name}" | sudo tee /etc/mailname > /dev/null || { echo "Could not update hostname for /etc/mailname. Aborting..."; exit 28; }
+sudo dpkg-reconfigure -fnoninteractive exim4-config || { echo "Could not write new reconfingure exim4. Aborting..."; exit 29; }
echo "Setting up myExperiment databases in MySQL"
-mysql -u root -p$mysql_root_password -e "CREATE USER '$mysql_user_name'@'localhost' IDENTIFIED BY '$mysql_user_password'; CREATE DATABASE m2_development; CREATE DATABASE m2_production; CREATE DATABASE m2_test; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_development . * TO '$mysql_user_name'@'localhost';GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_production . * TO '$mysql_user_name'@'localhost';GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_test . * TO '$mysql_user_name'@'localhost';" || { echo "Could not create myExperiment databases in MySQL and set up appropriate access for the $mysql_user_name user. Aborting ..."; exit 32; }
+mysql -u root -p${mysql_root_password} -e "CREATE USER '${mysql_user_name}'@'localhost' IDENTIFIED BY '${mysql_user_password}'; CREATE DATABASE m2_development; CREATE DATABASE m2_production; CREATE DATABASE m2_test; GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_development . * TO '${mysql_user_name}'@'localhost';GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_production . * TO '${mysql_user_name}'@'localhost';GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER,DROP,CREATE TEMPORARY TABLES,CREATE VIEW,SHOW VIEW ON m2_test . * TO '${mysql_user_name}'@'localhost';" || { echo "Could not create myExperiment databases in MySQL and set up appropriate access for the ${mysql_user_name} user. Aborting ..."; exit 30; }
echo "Migrating myExperiment database"
-rake db:migrate || { echo "Could not migrate myExperiment data model to a MySQL database. Aborting ..."; exit 33; }
+rake db:migrate || { echo "Could not migrate myExperiment data model to a MySQL database. Aborting ..."; exit 31; }
echo "Starting Solr (search) server and indexing"
-rake solr:start || { echo "Could not start Solr server. Aborting ..."; exit 34; }
+rake solr:start || { echo "Could not start Solr server. Aborting ..."; exit 32; }
-echo "Starting Mongrel webserver as a daemon running myExperiment website"
-ruby script/server -d || { echo "Could not start Mongrel Webserver for myExperiment website. Aborting ..."; exit 35; }
+echo "Installing and configuring Passenger Gem (mod_rails)";
+sudo gem install passenger --version ${passenger_version} || { echo "Could not install Passnger Gem version ${passenger_version}. Aborting ..."; exit 33; }
+sudo su -c "yes | /var/lib/gems/1.8/bin/passenger-install-apache2-module" || { echo "Could not install Apache2 module for Passenger. Aborting ..."; exit 34; }
+echo "${apache_config}" | sudo tee /etc/apache2/sites-available/myexperiment > /dev/null || { echo "Could not add bespoke myExperiment Apache configuration. Aborting ..."; exit 35; }
+if [ ! -h /etc/apache2/sites-enabled/myexperiment ]; then
+ sudo ln -s /etc/apache2/sites-available/myexperiment /etc/apache2/sites-enabled/myexperiment || { echo "Could symlink Apache configuration to sites-enabled."; exit 36; }
+fi
+if [ -f "/etc/apache2/sites-enabled/000-default" ]; then
+ sudo rm /etc/apache2/sites-enabled/000-default || { echo "Could not remove 000-default to sites-enabled. Aborting ..."; exit 37; }
+fi
+sudo apache2ctl restart || { echo "Could not restart Apache2. Aborting ..."; exit 38; }
echo "Removing temporary directory created for writing patch files to"
-sudo rm -rf $tempdir || { echo "Could not remove temporary directory used by patch files."; echo exit 36; }
+sudo rm -rf ${tempdir} || { echo "Could not remove temporary directory used by patch files."; echo exit 38; }
-echo "+--------------------------------------------------------------------------------------------+"
-echo "| myExperiment is now fully installed. Go to http://localhost:3000 to use myExperiment |"
-echo "| Or substitute for the server name if you have installed myExperiment on a separate server |"
-echo "+--------------------------------------------------------------------------------------------+"
+echo ""
+echo "+-----------------------------------------------------------------------------------------+"
+echo "| myExperiment is now fully installed. Go to http://$myexp_cname/ to use myExperiment |"
+echo "+-----------------------------------------------------------------------------------------+"