Project

General

Profile

Installing the Tapestry application » History » Revision 28

Revision 27 (Ward Vandewege, 09/24/2012 10:45 AM) → Revision 28/47 (Tom Clegg, 09/25/2012 10:12 AM)

h1. Installing the Tapestry application 

 The recommended ruby stack for Tapestry is Ruby Enterprise Edition (1.8.7), installed via rvm. 

 Install rvm: 

   curl -L https://get.rvm.io | sudo bash -s stable 

 Install ree 1.8.7 

   sudo rvm install ree 

 Install rails. 

  sudo gem install rails 
 sudo gem install passenger 
 sudo /usr/local/bin/passenger-install-apache2-module 

 Add stuff (as provided by passenger-install) to your conf.d/passenger.conf 

 <pre> 
 LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so 
 PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9 
 PassengerRuby /usr/local/bin/ruby 
 RackEnv "development" 
 </pre> 

 Install some prerequisites for gems. 

  sudo apt-get install libxslt-dev libxml2-dev 

 Get a copy of the source tree Check out git repo from git@git.clinicalfuture.com:tapestry.git to somewhere -- e.g., in /var/www/tapestry say, /var/www/tapestry.example.org 

 <pre> 
 cd /var/www 
 sudo chmod a+w,+t . 
 git clone git://git.clinicalfuture.com/tapestry.git 
 sudo chmod go-w,-t . 
 cd tapestry && git submodule init && git submodule update 
 </pre> 

 Then execute: 

  sudo bundle install 

 Point a virtualhost to the @public@ dir in your git repo 

 <pre> 
 <VirtualHost *:80> 
    ServerName tapestry.example.org 
    DocumentRoot /var/www/tapestry/public /var/www/tapestry.example.org/public 
    <Directory /var/www/tapestry/public> /var/www/tapestry.example.org/public> 
          AllowOverride all 
          Options -MultiViews 
    </Directory> 
    Alias /warehouse /warehouse 
    <Directory /warehouse> 
          Options None 
          AllowOverride None 
          Order allow,deny 
          allow from all 
    </Directory> 
 </VirtualHost> 
 </pre> 

 Copy @config/database.example@ to @config/database.yml@ and edit to suit. Make sure to select mysql as the database server.    Generate a password using @pwgen 12 1@ or @head -c12345 /dev/urandom|md5sum|head -c12;echo@.    For example: 

  development: 
   adapter: mysql 
   server: localhost 
   database: mypg 
   username: mypg 
   password: c16fbe415d29 
   timeout: 5000 

 Copy @config/environments/development.rb.sample@ to @config/environments/development.rb@ and edit to suit.    In particular the ROOT_URL (you may skip the "http://" prefix): 

  ROOT_URL = 'your.vhost.name' 

 Set up the database: 

  rake db:setup 
 rake db:schema:load 

 Set up data directory (replace USERNAME with the user who owns the GIT directory this code is in, and ROOT_URL matching the one above): 

  sudo mkdir -p /data/ROOT_URL 
 sudo chown -R USERNAME:USERNAME /data/ROOT_URL 

 After you do a git pull, you'll probably want to do 

   rake db:migrate 

 to bring your database up to the latest release. 

 If the Gemfile has changed, you will also have to run 

   sudo bundle install 

 Set up cron jobs -- for example, @/etc/cron.d/tapestry-get-blog-feed@ 

  PATH=/usr/local/bin:/usr/bin:/bin 
 0 * * * * www-data cd /var/www/tapestry/current/script /var/www/my-dev.personalgenomes.org/current/script && ./get-blog-feed.rb development http://blog.personalgenomes.org/feed/ 

 To enable large uploads with warehouse storage: 

 * @sudo apt-get install runit fuse-utils@ 
 * @sudo mkdir -p /etc/service/whmount/log/main@ 
 * Set up supervised whmount service: 

 <pre> 
 sudo tee /etc/service/whmount/run <<EOF >/dev/null 
 #!/bin/sh 
 modprobe fuse 
 mkdir -p /warehouse 
 chown www-data:www-data /warehouse 
 sudo -u www-data fusermount -u /warehouse 
 exec sudo -u www-data whmount --no-detach / /warehouse 
 EOF 
 sudo tee /etc/service/whmount/log/run <<EOF >/dev/null 
 #!/bin/sh 
 exec svlogd -tt main 
 EOF 
 </pre> 

 * Make sure config/environments/development.rb matches your Apache and filesystem mount points: 

 <pre> 
   WAREHOUSE_WEB_ROOT = "/warehouse" # Apache alias pointing to whmount target 
   WAREHOUSE_FS_ROOT = "/warehouse" # whmount target 
 </pre>