Menu

SA_server_install Log in to Edit

Social Accessibility Server: install instruction

System requirements

Hardware

  • CPU: 2cores+
  • Memory: 2GB+
  • HDD: 2GB+

OS

  • Linux: RHEL 5.x (recommended), CentOS 5, etc.

Software

  • Database: DB2 Express-C 9.7 (It also works with MySQL, etc.)
  • Apache httpd 2.2.3 (bundled in RHEL)
    • (option) mod_ssl (bundled in RHEL)
  • Ruby on Rails and Plugins:
    • Ruby 1.8.5 (bundled in RHEL)
    • rubygems 1.3.4
    • rails 2.0.2
    • mongrel 1.1.5
    • mongrel_cluster 1.0.5
    • will_pagenate 2.2.2
    • Globalize for rails 1.2
  • Other libraries:
    • scriptaculous 1.8.1

Server Setup Instruction

The line beginning with '#' requires the root priviledge. Use 'sudo' or 'su -'.

0. Environment (We assume RHEL 5.x here)

If Apache Httpd 2.2.x is not installed yet. Please install it by

# yum install httpd


(option) If your system uses SELinux, please change security settings

From system administration menu, open "Security Level Configuration" panel. Then, enable "WWW(HTTP)" and "Secure WWW (HTTPS)" by marking check boxes in the "Trusted services" area.

You also need to allow httpd to work as an reverse proxy by

# /usr/sbin/setsebool -P httpd_can_network_connect=1


1. Install RoR

Install ruby, rubygems, and other required applications.

# yum install ruby
# yum install ruby-devel
# yum install ruby-rdoc



Install gems (You can ignore "rdoc" related errors.)

# wget http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz
# tar -zxf rubygems-1.3.4.tgz
# cd rubygems-1.3.4
# ruby setup.rb


Install Ruby on Rails and plugins (You can ignore "rdoc" related errors.)

# gem install rails -v="2.0.2"
# gem install mongrel -v=”1.1.5”
# gem install mongrel_cluster -v=”1.0.5”
# gem install will_paginate -v="2.2.2"


(If gem install does not work well, try to add "--source http://rubygems.org/" to the commands.)

2. Setup Database

We will introduce instructions for 2 types of DB (DB2 and MySQL).
Please select one of them.

2-A DB2 Express-C

Coming soon.

2-B MySQL

2-B.1 install MySQL
# yum install mysql
# yum install mysql-server
# /sbin/chkconfig mysqld on
# /etc/rc.d/init.d/mysqld start
# /usr/bin/mysqladmin -u root password 'new-mysql-password'



(Alternatively you can run: # /usr/bin/mysql_secure_installation)

2-B.2 Setup database

Create social accessibility database.

$ mysql -u root -p
 (enter root password of mysql)

mysql> create database sa_production default character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye


3. Setup Social Accessibility Server

Here, we assume a user 'social' is used, and SocialAccessibilityServer_(version).tgz is copied into /home/social/

(You can download Social Accessibility Server image from MCOF project page )

To create a user 'social', use the following

# /usr/sbin/adduser social



(please configure password, etc. for the user 'social' appropriately.)

And add the following line into .bashrc

export RAILS_ENV='production'



When you want to use https for login, add the following line into .bashrc

export RAILS_FORCE_HTTPS=true


To activate the lines to .bashrc, use the following command.

$ source ~/.bashrc


Extract the SA server, add third party materials, etc.

$ cd ~
$ tar zxvf SocialAccessibilityServer_(version).tgz
$ cd SocialAccessibilityServer
$ mkdir log tmp vendor
$ mkdir tmp/pids vendor/plugins
$ wget http://script.aculo.us/dist/scriptaculous-js-1.8.1.tar.gz
$ tar -zxvf scriptaculous-js-1.8.1.tar.gz
$ cd scriptaculous-js-1.8.1
$ cp lib/*.js src/*.js ~/SocialAccessibilityServer/public/javascripts/
$ wget --no-check-certificate https://github.com/heythisisnate/globalize/tarball/for-1.2  -O globalize-1.2.tgz
$ tar -zxvf globalize-1.2.tgz
$ cp -r heythisisnate-globalize-c07d588 ~/SocialAccessibilityServer/vendor/plugins/



Set database user and password if necessary.

$ cd ~/SocialAccessibilityServer
$ vi config/database.yml

(then, find a line beginning with "production:".Then change 'username' and 'password' to the appropriate values.)

$ rake db:migrate
$ rake globalize:setup
$ mongrel_rails cluster::configure -e production -p 3000 -N 5
$ mongrel_rails cluster::start



Then, try to access http://\<your server>:3000/

You can see Social Accessibility Server works.

4. Setup Apache

The instances of mongrel_rails uses different port (3000-3004), so it is not practical to use them as is. We use mod_proxy to cope with them.

# cd /etc/httpd/conf
# cp httpd.conf httpd.conf.org
# vi httpd.conf

(Remove '#' from the line '# NameVirtualHost *:80' under Section 3 and enable it. Then, insert settings below at the bottom of httpd.conf )

<VirtualHost *:80>
        ServerAdmin root@localhost

        ProxyRequests Off
        ProxyPass / balancer://lbalancer/ lbmethod=byrequests timeout=1
        ProxyPassReverse / http://localhost:3000
        ProxyPassReverse / http://localhost:3001
        ProxyPassReverse / http://localhost:3002
        ProxyPassReverse / http://localhost:3003
        ProxyPassReverse / http://localhost:3004

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>
        <Proxy balancer://lbalancer/>
                BalancerMember http://localhost:3000 loadfactor=1
                BalancerMember http://localhost:3001 loadfactor=1
                BalancerMember http://localhost:3002 loadfactor=1
                BalancerMember http://localhost:3003 loadfactor=1
                BalancerMember http://localhost:3004 loadfactor=1
        </Proxy>

        ErrorLog /var/log/httpd/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/httpd/access.log combined
        # ServerSignature On
</VirtualHost>



Then, activate the site.

# /etc/init.d/httpd restart


5. Check it works.

access http://\<your server>/ and check it works!

6. Create Administrator account.

Create a Social Accessibility user, and make him/her an admin.

To sign up, enter any user name and password in the top page of Social Accessibility server. Then, make the user an admin by modifying DB.

MySQL case

$ mysql socialaccessibility_production -u root -p
mysql> update users set administrator = 1 where nickname = '<your nickname>' limit 1;
     > bye



The admin can use administrator menu by accessing "Admin menu" at the left-side navigation bar in the Social Accessibility portal.

7. Mentenance

Rebooting

When rebooting the SA server, stop apache beforehand.

# /etc/init.d/httpd stop

$ cd ~/SocialAccessibility
$ mongrel_rails cluster::stop
(do something)
$ mongrel_rails cluster::start

# /etc/init.d/httpd start

When mongrel_rails does not start by complaining 'pid files exist', remove pid files after confirming mongrel servers are really stopped.
(Check by 'ps aux | grep mongrel').

Dump DB (MySQL)

\<dump>

$ mysqldump socialaccessibility -u root -p > dumpfile



\<restore>

$ mysql socialaccessibility -u root -p < dumpfile


Log rotation

You may need to setup logrotation to archive logs of Social Accessibility server. The logs are stored at /home/social/SocialAccessibilityServer/log


Discussion

Anonymous
Anonymous

Add attachments
Cancel