myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2968] trunk/installers/fedora: Updated Fedora in


From: noreply
Subject: [myexperiment-hackers] [2968] trunk/installers/fedora: Updated Fedora installer to use RVM, Mongrel rather than Passenger and provide an init. d script for myExperiment as a whole
Date: Fri, 16 Mar 2012 16:49:18 +0000 (UTC)

Revision
2968
Author
drn05r
Date
2012-03-16 16:49:18 +0000 (Fri, 16 Mar 2012)

Log Message

Updated Fedora installer to use RVM, Mongrel rather than Passenger and provide an init.d script for myExperiment as a whole

Modified Paths

Diff

Modified: trunk/installers/fedora/README.txt (2967 => 2968)


--- trunk/installers/fedora/README.txt	2012-03-08 14:38:49 UTC (rev 2967)
+++ trunk/installers/fedora/README.txt	2012-03-16 16:49:18 UTC (rev 2968)
@@ -3,7 +3,7 @@
 
 The files in this directory are an installer for myExperiment on Fedora 13 and
 consequently RedHat 6 and CentOS 6.0.  The installer is designed to work on a 
-freshly installed version of the operating systems, you may have problems if 
+freshly installed version of these operating systems, you may have problems if 
 you are installing on an existing system.
 
 install.bash is the main install script and can be downloaded and run from 
@@ -18,18 +18,15 @@
 
 myexp_root_password - Choose a password for the root account of MySQL.  If for
 whatever reason MySQL is already installed set this to the current MySQL root
-password.  MySQL mosty have a root password for the installer to suceed
+password.  MySQL musr have a root password for the installer to succeed
 
-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 and domain for your server,
 i.e. the A record. E.g. myexperiment.example.org
 
-exim_smarthost_server - The mail server you want to user as a relay for emails.
+sendmail_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.
+sendmail_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
@@ -44,9 +41,9 @@
 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/.  
 
-Some configuration may require restarting Apache using the following command:
+Some configuration may require restarting myExperiment using the following command:
 
-sudo service httpd restart
+sudo service myexperiment restart
 
 
 == Further Information ==

Modified: trunk/installers/fedora/default_settings.bash (2967 => 2968)


--- trunk/installers/fedora/default_settings.bash	2012-03-08 14:38:49 UTC (rev 2967)
+++ trunk/installers/fedora/default_settings.bash	2012-03-16 16:49:18 UTC (rev 2968)
@@ -1,20 +1,13 @@
 #!/bin/bash
-install_dir="/var/rails/myexperiment" # Where to check the myExperiment SVN
+install_dir="/var/rails/myexperiment" # Where to checkout the myExperiment SVN
 branch="trunk"
+ruby_version="1.8.7"
 mysql_root_password="changeme"
-mysql_user_name="myexp"
-mysql_user_password="changeme"
-rdoc=1 # Set to 0 for no RDoc Ruby Gem documentation
-ri=1 # Set to 0 for no RI Ruby Gem documentation
-rake_version="0.8.7"
-rails_version="2.3.14"
-passenger_version="2.2.15"
 fq_server_name="hostname.domain"
+myexp_cname="myexp.domain"
+myexp_port_no="3000"
 sendmail_smarthost_server="smtp"
 sendmail_smarthost_domain="domain"
-myexp_cname="myexp.domain" # Where your myexperiment will be hosted can be the same as $fq_server_name
-
-# Build fully-qualified server name for the smarthost (relay) to be used by Sendmail
 sendmail_smarthost="${sendmail_smarthost_server}.${sendmail_smarthost_domain}"
 
 # Sendmail patch for relaying email
@@ -53,7 +46,7 @@
  #            NOTE: No trailing slash.
  
 -base_uri: http://www.example.com
-+base_uri: http://'${myexp_cname}'
++base_uri: http://'${myexp_cname}:${myexp_port_no}'
  
  # admins - Set "admins" to the list of usernames of people that are
  #          administrators of this installation.  This is "Username" that is set
@@ -82,32 +75,59 @@
  #              "Queries in View" and "Query Time".
 '
 
-# Apache config for myExperiment
-apache_config="LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-${passenger_version}/ext/apache2/mod_passenger.so
-PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-${passenger_version}
-PassengerRuby /usr/bin/ruby
-PassengerDefaultUser ${USER}
-RailsEnv development
+# init.d script so myExperiment can be easily stopped/started
+initd_script='#!/bin/bash -e
+#
+# myexperiment  Starts, stops, and restarts myExperiment
+#
+# chkconfig: - 64 36
+# description:  MyExperiment web application
+# processname: myexperiment
 
-<VirtualHost *:80>
-        ServerAdmin address@hidden
-        ServerName ${myexp_cname}
-        DocumentRoot ${install_dir}/public
-	PassengerTempDir ${install_dir}/tmp
-        <Directory ${install_dir}/public/>
-                AllowOverride all
-                Options -MultiViews
-        </Directory>
-</VirtualHost>"
+MYEXP_DIR="'${install_dir}'"
+SOLR_LOG_FILE="'${install_dir}'/log/solr.log"
+SOLR_ERR_FILE="'${install_dir}'/log/solr.err"
+MYEXP_LOG_FILE="'${install_dir}'/log/myexperiment.log"
+MYEXP_ERR_FILE="'${install_dir}'/log/myexperiment.err"
+MYEXP_PID_FILE="'${install_dir}'/log/myexperiment.pid"
 
-# Configure options for (Ruby) gem install
-if [ $rdoc == 0 ]; then
-        nordoc="--no-rdoc"
-else
-        nordoc=""
-fi
-if [ $ri == 0 ]; then
-        nori="--no-ri"
-else
-        nori=""
-fi
+case $1 in
+    start)
+        echo "Starting myExperiment..."
+        source /usr/local/rvm/scripts/rvm
+        rvm --default use '${ruby_version}'
+        cd $MYEXP_DIR
+        rake solr:start 2>> $SOLR_ERR_FILE 1>> $SOLR_LOG_FILE
+        ruby script/server -p '${myexp_port_no}' 2>> $MYEXP_ERR_FILE 1>> $MYEXP_LOG_FILE &
+        echo $! > $MYEXP_PID_FILE 
+        echo "myExperiment started"
+        ;;
+    stop)
+        echo "Stopping myExperiment..."
+        source /usr/local/rvm/scripts/rvm
+        rvm --default use '${ruby_version}'
+        cd $MYEXP_DIR 
+        rake solr:stop 2>> $SOLR_ERR_FILE 1>> $SOLR_LOG_FILE 
+        if [ -s $MYEXP_PID_FILE ]; then
+            kill -9 `cat $MYEXP_PID_FILE` 
+            rm $MYEXP_PID_FILE
+        else 
+            echo "$MYEXP_PID_FILE does not exist or is empty"
+            if [ -f $MYEXP_PID_FILE ]; then
+                rm $MYEXP_PID_FILE
+            fi
+            exit 2
+        fi
+        echo "myExperiment stopped"
+        ;;
+    restart)
+        $0 stop
+        sleep 3
+        $0 start
+        ;;
+    *)
+        echo "Usage: $0 {start|stop|restart}" >&2
+        exit 1        
+        ;;
+esac'
+

Modified: trunk/installers/fedora/install.bash (2967 => 2968)


--- trunk/installers/fedora/install.bash	2012-03-08 14:38:49 UTC (rev 2967)
+++ trunk/installers/fedora/install.bash	2012-03-16 16:49:18 UTC (rev 2968)
@@ -1,7 +1,7 @@
 #!/bin/bash
 echo ""
 echo "+----------------------------------------------------------------------------------------------+"
-echo "|        Welcome to the myExperimemt Installer for Fedora 13 / Red Hat 6 / CentOS 6.0!         |"
+echo "|         Welcome to the myExperimemt Installer for Fedora 13 / RedHat 6 / CentOS 6.0!         |"
 echo "| Go to http://wiki.myexperiment.org/index.php/Developer:FedoraInstallation for more details.  |"
 echo "+----------------------------------------------------------------------------------------------+"
 echo ""
@@ -10,118 +10,95 @@
 basedir=`cd ${d}; pwd`
 source ${basedir}/settings.bash || { echo "Could not find settings file at $settings_file. Aborting ..."; exit 1;}
 
-echo "Extending timeout for sudo commands in /etc/sudoers.d/default_timeout"
-echo "Defaults     timestamp_timeout = 3600" | sudo tee -a /etc/sudoers.d/default_timeout > /dev/null || { echo "Failed to disable sudo prompt timeout. Aborting ..."; exit 2; }
-sudo chmod 440 /etc/sudoers.d/default_timeout || { echo "Failed to chmod /etc/sudoers.d/default_timeout. Aborting ..."; exit 70; }
+echo "Creating temporary directory for installation files"
+tempdir=$(mktemp -d /tmp/myexp_installer.XXXXXXXXXX) || { echo "Could not create temporary file for writing patches to. Aborting ..."; exit 2; }
+cd $tempdir || { echo "Could not find temporary directory. Aborting ..."; exit 3; }
+echo "$sendmail_patch" > sendmail.patch || { echo "Could not write sendmail config patch file. Aborting ... "; exit 4; }
+echo "$settings_patch" > settings.patch || { echo "Could not write settings patch file. Aborting ..."; exit 5; }
 
 echo "Installing required Yum packages"
-sudo yum update || { echo "Failed to update apt-get. Aborting ..."; exit 3; }
-sudo -n yum install -y subversion make patch gcc glibc-devel gcc-c++ ruby ruby-devel rdoc irb rubygems httpd httpd-devel mysql mysql-devel mysql-server ruby-mysql java subversion mlocate libxml2-devel libcurl-devel ImageMagick-devel ruby-RMagick graphviz sendmail sendmail-cf policycoreutils-python || { echo "Failed to install required Yum packages. Aborting ..."; exit 4; }
+sudo yum update || { echo "Failed to update apt-get. Aborting ..."; exit 6; }
+sudo -n yum install -y subversion make patch gcc glibc-devel gcc-c++ mysql mysql-devel mysql-server java libxml2-devel libxslt-devel autoconf glibc-devel ncurses-devel automake libtool bison openssl openssl-devel curl libcurl libcurl-devel readline readline-devel ImageMagick-devel graphviz sendmail sendmail-cf policycoreutils-python || { echo "Failed to install required Yum packages. Aborting ..."; exit 7; }
 
-echo "Writing patch files to temporary directory"
-tempdir=$(mktemp -d /tmp/myexp_installer.XXXXXXXXXX) || { echo "Could not create temporary file for writing patches to. Aborting ..."; exit 5; }
-cd $tempdir || { echo "Could not find temporary directory. Aborting ..."; exit 6; }
-echo "$sendmail_patch" > sendmail.patch || { echo "Could not write sendmail config patch file. Aborting ... "; exit 7; } 
-echo "$settings_patch" > settings.patch || { echo "Could not write settings patch file. Aborting ..."; exit 8; }
-
 echo "Configuring Apache, MySQL and Sendmail"
-sudo chkconfig httpd on || { echo "Failed to Apache to applications started at boottime. Aborting ..."; exit 9; }
-sudo chkconfig mysqld on || { echo "Failed to MySQL to applications started at boottime. Aborting ..."; exit 10; }
-sudo chkconfig sendmail on || { echo "Failed to MySQL to applications started at boottime. Aborting ..."; exit 11; }
-sudo cp /etc/hosts ${tempdir}/ || { echo "Failed to copy hosts file to ${tempdir}. Aborting ..."; exit 12; }
-cat ${tempdir}/hosts | sed "s/localhost /localhost $myexp_cname /g" | sudo tee /etc/hosts >/dev/null || { echo "Failed to add myExperiment CName to /etc/hosts. Aborting ..."; exit 13; }
-sudo service mysqld start || { echo "Failed to to start MySQL. Aborting ..."; exit 14; }
-sudo patch /etc/mail/sendmail.mc  $tempdir/sendmail.patch || { echo "Could not patch sendmail.mc. Aborting ..."; exit 15; }
-sudo m4 /etc/mail/sendmail.mc | sudo tee /etc/mail/sendmail.cf >/dev/null || { echo "Could not write sendmail config to sendmail.cf. Aborting ..."; exit 16; }
-sudo setsebool -P httpd_can_sendmail=1 || { echo "Could not write set httpd_can_sendmail=1. Aborting ..."; exit 17; }
-sudo service sendmail start || { echo "Failed to to start Sendmail. Aborting ..."; exit 18; }
+sudo chkconfig mysqld on || { echo "Failed to MySQL to applications started at boottime. Aborting ..."; exit 8; }
+sudo chkconfig sendmail on || { echo "Failed to MySQL to applications started at boottime. Aborting ..."; exit 9; }
+sudo cp /etc/hosts ${tempdir}/ || { echo "Failed to copy hosts file to ${tempdir}. Aborting ..."; exit 10; }
+cat ${tempdir}/hosts | sed "s/localhost /localhost $myexp_cname /g" | sudo tee /etc/hosts >/dev/null || { echo "Failed to add myExperiment CName to /etc/hosts. Aborting ..."; exit 11; }
+sudo service mysqld start || { echo "Failed to to start MySQL. Aborting ..."; exit 12; }
+sudo patch /etc/mail/sendmail.mc  $tempdir/sendmail.patch || { echo "Could not patch sendmail.mc. Aborting ..."; exit 13; }
+sudo m4 /etc/mail/sendmail.mc | sudo tee /etc/mail/sendmail.cf >/dev/null || { echo "Could not write sendmail config to sendmail.cf. Aborting ..."; exit 14; }
+sudo setsebool -P httpd_can_sendmail=1 || { echo "Could not write set httpd_can_sendmail=1. Aborting ..."; exit 15; }
+sudo service sendmail start || { echo "Failed to to start Sendmail. Aborting ..."; exit 16; }
 
-echo "Installing Rake version $rake_version and Rails version $rails_version Ruby Gems"
-sudo gem install $nordoc $nori rake --version $rake_version || { echo "Could not install Rake Ruby Gem (version $rake_version). Aborting ..."; exit 19; }
-sudo gem install $nordoc $nori rails --version $rails_version || { echo "Failed to install Rails Ruby Gem (v$rails_version) and dependencies. Aborting ..."; exit 20; }
+echo "Installing and configuring RVM"
+sudo bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer ) || { echo "Could not install RVM. Aborting ..."; exit 17; }
 
-echo "Installing Ruby Gems required by myExperiment"
-sudo gem install ${nordoc} ${nori} rubyzip --version 0.9.4 || { echo "Could not install rubyzip (v0.9.4). Aborting ..."; exit 21; }
-sudo gem install ${nordoc} ${nori} libxml-ruby rmagick dsl_accessor ruby-openid openurl ruby-hmac marc || { echo "Could not install all remaining generic Ruby Gems required by myExperiment. Aborting ..."; exit 22; }
-sudo gem install ${nordoc} ${nori} curb --version 0.7.15 || { echo "Could not install rubyzip (v0.7.15).. Aborting ..."; exit 23; }
-
+echo "Install and configuring Ruby version ${ruby_version}"
+source "/usr/local/rvm/scripts/rvm" || { echo "Could not source /usr/local/rvm/scripts/rvm to add RVM directory to path. Aborting ..."; exit 18; }
+rvmsudo rvm install ${ruby_version}  || { echo "Could not install Ruby ${ruby_version} using RVM. Aborting ..."; exit 19; }
+rvm --default use ${ruby_version} || { echo "Could not set Ruby ${ruby_version} as the default environment for RVM. Aborting ..."; exit 20; }
 echo "Checking out myExperiment codebase from SVN"
 cd /
 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 24; }
+                        sudo mkdir ${idir} || { echo "Could not create directory ${idir} in `pwd`.  Aborting ..."; exit 21; }
                 fi
                 cd ${idir}
         fi
 done
-sudo chown $USER:apache $install_dir || { echo "Could not update permissions on $install_dir. Aborting ..."; exit 25; }
-svn checkout svn://rubyforge.org/var/svn/myexperiment/$branch $install_dir || { echo "Could not checkout SVN to $install_dir. Aborting ..."; exit 26; }
-cd ${install_dir}/config/ || { echo "Could not find config directory for myExperiment. Aborting ..."; exit 27; }
+sudo chown ${USER} ${install_dir} || { echo "Could not update permissions on ${install_dir}. Aborting ..."; exit 22; }
+svn checkout svn://rubyforge.org/var/svn/myexperiment/$branch $install_dir || { echo "Could not checkout SVN to $install_dir. Aborting ..."; exit 24; }
+cd ${install_dir}/config/ || { echo "Could not find config directory for myExperiment. Aborting ..."; exit 25; }
 
 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 28; }
-cp default_settings.yml settings.yml || { echo "Could not copy default_settings.yml to settings.yml ..."; exit 29; }
-patch settings.yml $tempdir/settings.patch || { echo "Could not patch settings.yml. Aborting ..."; exit 30; }
-cp captcha.yml.pre captcha.yml || { echo "Could not create captcha.yml file.  Aborting ..."; exit 31; }
-cd ..
+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 26; }
+cp default_settings.yml settings.yml || { echo "Could not copy default_settings.yml to settings.yml ..."; exit 27; }
+patch settings.yml $tempdir/settings.patch || { echo "Could not patch settings.yml. Aborting ..."; exit 28; }
 
-echo "Setting up myExperiment databases in MySQL"
-sudo mysqladmin -u root password $mysql_root_password || { echo "Could not set MySQL root password. Assuming this is already set."; }
-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; }
+echo "Installing Gems required by myExperiment using bundler"
+cd ${install_dir}
+bundle install || { echo "Could not install the Gems required by myExperiment using bundler. Aborting ..."; exit 30; }
 
-echo "Migrating myExperiment database"
-rake db:migrate || { echo "Could not migrate myExperiment data model to a MySQL database. Aborting ..."; exit 33; }
+echo "Creating and migrating myExperiment database"
+rake db:create:all || { echo "Could not create MySQL databases for myExperiment. Aborting ..."; exit 31; }
+rake db:migrate || { echo "Could not migrate myExperiment data model to a MySQL database. Aborting ..."; exit 32; }
 
-echo "Starting Solr (search) server and indexing"
-rake solr:start || { echo "Could not start Solr server. Aborting ..."; exit 34; }
+echo "Creating myExperiment init.d script and deploying so myExperiment automatically starts after machine start up"
+echo "${initd_script}" > ${tempdir}/myexperiment || { echo "Could not create myExperiment init.d script. Aborting ..."; exit 33; }
+sudo mv ${tempdir}/myexperiment /etc/init.d || { echo "Could not move myExperiment init.d script to /etc/init.d. Aborting ..."; exit 34; }
+sudo chown root:root /etc/init.d/myexperiment || { echo "Could not change ownwership of /etc/init.d/myexperiment. Aborting ..."; exit 35; }
+sudo chmod +x /etc/init.d/myexperiment || { echo "Could not modify permissions of /etc/init.d/myexperiment. Aborting ..."; exit 36; }
+sudo chkconfig myexperiment on || { echo "Could not deploy /etc/init.d/myexperiment as a startup script. Aborting ..."; exit 37; }
 
 echo "Adding Firewall rules for mongrel webserver on IPv4 and IPv6"
-sudo chkconfig iptables on || { echo "Failed to iptables to applications started at boottime. Aborting ..."; exit 35; }
-sudo iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited || { echo "Could not delete rule from iptables. Aborting ..."; exit 36; }
-sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT || { echo "Could not add rule from iptables. Aborting ..."; exit 37; }
-sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT || { echo "Could not add rule from iptables. Aborting ..."; exit 38; }
-sudo iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited  || { echo "Could not add rule from iptables. Aborting ..."; exit 39; }
-sudo iptables-save | sudo tee /etc/sysconfig/iptables >/dev/null  || { echo "Could not save new iptables rules. Aborting ..."; exit 40; }
-sudo restorecon -v /etc/sysconfig/iptables || { echo "Could not restorecon for /etc/sysconfig/iptables. Aborting ..."; exit 41; }
-sudo service iptables restart || { echo "Could not restart iptables. Aborting ..."; exit 42; }
+sudo chkconfig iptables on || { echo "Failed to iptables to applications started at boottime. Aborting ..."; exit 38; }
+sudo iptables -D INPUT -j REJECT --reject-with icmp-host-prohibited || { echo "Could not delete rule from iptables. Aborting ..."; exit 39; }
+sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport ${myexp_port_no} -j ACCEPT || { echo "Could not add rule from iptables. Aborting ..."; exit 40; }
+sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT || { echo "Could not add rule from iptables. Aborting ..."; exit 41; }
+sudo iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited  || { echo "Could not add rule from iptables. Aborting ..."; exit 42; }
+sudo iptables-save | sudo tee /etc/sysconfig/iptables >/dev/null  || { echo "Could not save new iptables rules. Aborting ..."; exit 43; }
+sudo restorecon -v /etc/sysconfig/iptables || { echo "Could not restorecon for /etc/sysconfig/iptables. Aborting ..."; exit 44; }
+sudo service iptables restart || { echo "Could not restart iptables. Aborting ..."; exit 45; }
 
-sudo chkconfig ip6tables on || { echo "Failed to ip6tables to applications started at boottime. Aborting ..."; exit 43; }
-sudo ip6tables -D INPUT -j REJECT --reject-with icmp6-adm-prohibited || { echo "Could not delete rule from ip6tables. Aborting ..."; exit 44; }
-sudo ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT || { echo "Could not add rule from ip6tables. Aborting ..."; exit 45; }
-sudo ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT || { echo "Could not add rule from ip6tables. Aborting ..."; exit 46; }
-sudo ip6tables -A INPUT -j REJECT --reject-with icmp6-adm-prohibited || { echo "Could not delete rule from ip6tables. Aborting ..."; exit 47; }
-sudo ip6tables-save | sudo tee /etc/sysconfig/ip6tables >/dev/null || { echo "Could not save new ip6tables rules. Aborting ..."; exit 48; }
-sudo restorecon -v /etc/sysconfig/ip6tables || { echo "Could not restorecon for /etc/sysconfig/ip6tables. Aborting ..."; exit 49; }
-sudo service ip6tables restart || { echo "Could not restart ip6tables. Aborting ..."; exit 50; }
+sudo chkconfig ip6tables on || { echo "Failed to ip6tables to applications started at boottime. Aborting ..."; exit 46; }
+sudo ip6tables -D INPUT -j REJECT --reject-with icmp6-adm-prohibited || { echo "Could not delete rule from ip6tables. Aborting ..."; exit 47; }
+sudo ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport ${myexp_port_no} -j ACCEPT || { echo "Could not add rule from ip6tables. Aborting ..."; exit 48; }
+sudo ip6tables -A INPUT -m state --state NEW -m tcp -p tcp --dport 25 -j ACCEPT || { echo "Could not add rule from ip6tables. Aborting ..."; exit 49; }
+sudo ip6tables -A INPUT -j REJECT --reject-with icmp6-adm-prohibited || { echo "Could not delete rule from ip6tables. Aborting ..."; exit 50; }
+sudo ip6tables-save | sudo tee /etc/sysconfig/ip6tables >/dev/null || { echo "Could not save new ip6tables rules. Aborting ..."; exit 51; }
+sudo restorecon -v /etc/sysconfig/ip6tables || { echo "Could not restorecon for /etc/sysconfig/ip6tables. Aborting ..."; exit 52; }
+sudo service ip6tables restart || { echo "Could not restart ip6tables. Aborting ..."; exit 53; }
 
-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 51; }
-sudo su -c "yes | /usr/lib/ruby/gems/1.8/gems/passenger-2.2.15/bin/passenger-install-apache2-module" || { echo "Could not install Apache2 module for Passenger. Aborting ..."; exit 52; }
-echo "${apache_config}" | sudo tee /etc/httpd/conf.d/myexp.conf > /dev/null || { echo "Could not add bespoke myExperiment Apache configuration. Aborting ..."; exit 53; }
-sudo chmod -R 755 ${install_dir}/public || { echo "Failed to chmod ${install_dir}/public and its files/subdirectories. Aborting ..."; exit 54; }
-sudo chmod 755 ${install_dir} || { echo "Failed to chmod ${install_dir}. Aborting ..."; exit 55; }
-sudo chcon -t httpd_sys_script_exec_t -R ${install_dir} || { echo "Failed to chcon (httpd_sys_script_exec_t) ${install_dir} and its files/subdirectories. Aborting ..."; exit 56; }
-sudo chcon -t httpd_sys_content_t -R ${install_dir}/public || { echo "Failed to chcon (httpd_sys_content_t) ${install_dir}/public and its files/subdirectories. Aborting ..."; exit 57; }
-sudo chcon -t httpd_log_t -R ${install_dir}/log || { echo "Failed to chcon (httpd_log_t) ${install_dir}/log and its files. Aborting ..."; exit 58; }
-sudo chcon -t httpd_tmpfs_t -R  ${install_dir}/tmp || { echo "Failed to chcon (httpd_tmpfs_t) ${install_dir}/tmp and its files. Aborting ..."; exit 59; }
-sudo setsebool -P httpd_can_network_connect=1 || { echo "Could not write set httpd_can_network_connect=1. Aborting ..."; exit 60; }
-sudo setenforce 0 || { echo "Could not temporarily setenforce = 0. Aborting ..."; exit 61; }
-sudo service httpd start || { echo "Could not start Apache. Aborting ..."; exit 62; }
-sudo grep httpd /var/log/audit/audit.log | audit2allow -M passenger || { echo "Could not create policy package passenger.pp. Aborting ..."; exit 63; }
-sudo semodule -i passenger.pp || { echo "Could not add policy package passenger.pp using semodule. Aborting ..."; exit 64; }
-sudo rm passenger.pp passenger.te || { echo "Could not remove files creates by audit2allow. Aborting ..."; exit 65; }
-sudo setenforce 1 || { echo "Could not temporarily setenforce = 1. Aborting ..."; exit 66; }
-sudo service httpd restart || { echo "Could not restart Apache. Aborting ..."; exit 67; }
+sudo service myexperiment start || { echo "Could not start myExperiment. Aborting ..."; exit 54; }
 
-echo "Removing extended sudo timeout from /etc/sudoers"
-sudo rm /etc/sudoers.d/default_timeout || { echo "Could not remove extended timeout for sudo.  Aborting ..."; exit 68; }
-
 echo "Removing temporary directory created for writing patch files to"
-sudo rm -rf ${tempdir} || { echo "Could not remove temporary directory used by patch files."; exit 69; }
+sudo rm -rf ${tempdir} || { echo "Could not remove temporary directory used by patch files."; exit 55; }
 
 echo ""
-echo "+-----------------------------------------------------------------------------------------+"
-echo "|   myExperiment is now fully installed. Go to http://$myexp_cname/ to use myExperiment   |"
-echo "+-----------------------------------------------------------------------------------------+"
+echo "==================================================================================="
+echo " myExperiment is now fully installed."
+echo " Go to http://${myexp_cname}:${myexp_port_no}/ to use myExperiment"
+echo "==================================================================================="
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]