Skip to content
/ homex Public

UC Berkeley, School of Public Health, California Childhood Leukemia Study

Notifications You must be signed in to change notification settings

ccls/homex

Repository files navigation

CCLS Home Exposures

THIS APP AND REPO ARE NOW DEAD. AS OF TODAY, 20120313, THIS FUNCTIONALITY HAS OR WILL BE INCORPORATED INTO THE ODMS APPLICATION.

UC Berkeley, School of Public Health, California Childhood Leukemia Study

Requirements

  • ruby >= 1.8.7 - primarily due to the liberal use of #inject

  • ruby <= 1.8.7 - primarily due to ruby 1.9.1 differences

  • rubygems

  • ImageMagick (which may require MacPorts)

    • ImageMagick is used for image manipulation

  • curl - for the initial installation of rvm

  • mysql (not sqlite) - because …

    • a manually triggered rollback in the Addressing model

    • the SubjectSearch model contains explicit MySQL code

Required Gem Sources

gem sources -a http://rubygems.org
gem sources -a http://gems.github.com

Required Gems

Installation

#	Copy session file.
cp config/initializers/session_store.rb.example config/initializers/session_store.rb

#	Copy and setup database file.
cp config/database.yml.example config/database.yml

#	Copy and setup shared_database file to match ccls_engine's.
cp config/shared_database.yml.example config/shared_database.yml

#	Copy and add your own FedEx credentials.
cp config/fed_ex.yml.example config/fed_ex.yml

#	Copy and add your own S3 credentials.
cp config/s3.yml.example config/s3.yml

#	Copy and add your own gmail credentials.
cp config/initializers/mail.rb.example config/initializers/mail.rb

rvm / jruby installation ( Installing RVM ) …

curl http://rvm.beginrescueend.com/releases/rvm-install-head | bash
#	or
sudo gem install rvm
/usr/lib/ruby/user-gems/1.8/gems/rvm-0.1.27/bin/rvm-install

# add ... 
#	if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
# to your .bashrc
vi .bashrc
bash
rvm install jruby
rvm use jruby
# or perhaps
rvm --default jruby

For standard ruby users, install mysql gem …

#	If using mysql ...
# On Mac OS X:
#   sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
# On Mac OS X Leopard:
#   sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
# ... I had to install the mysql gem like so ...

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Everybody join hands together now to install some gems …

#
# Some gems require manual installation for one reason or another.
#
# (sudo may or may not be required or desired.
#  Usage of sudo will/may cause gem installation in /usr/lib
#  which may then require using sudo when running rake tasks
#  or other things.  `gem list` and `sudo gem list` will differ.
#  I recommend avoiding using sudo with rvm, but its your
#  kitchen.)
#
gem source -a http://gemcutter.org
gem source -a http://gems.github.com
sudo gem install rake -v '=0.8.7'
sudo gem install hpricot
sudo gem install rdoc -v '~> 2'
sudo gem install rails -v '~> 2'
#
# The rest should actually install with ...
#
sudo rake gems:install
#
# This eventually crashed with ...
#
#	Error: Your application used more memory than the safety cap of 500m.
#	Specify -J-Xmx####m to increase it (#### = cap size in MB).
#	Specify -w for full OutOfMemoryError stack trace
#
#    or
#
#  /Users/jake/.rvm/rubies/jruby-1.5.0.RC1/bin/gem:13:in `require': 
#  load error: rubygems -- java.lang.OutOfMemoryError: Java heap space (LoadError)
#
# ... but a rerun continued and completed.
#
sudo rake gems:install
#
# Some gems are defined in the environments/test.rb file
#
sudo rake gems:install RAILS_ENV=test

then we continue …

#	Add your own session secret to config/initializers/session_store.rb
#	generate a 128 character hex string perfect for using as your secret.
rake secret

rake db:migrate

#	add some expected items (loads fixtures OVERWRITING some db data)
rake app:update

script/server
script/backgroundrb start

#	login to your app
#	The first administrator/deputy must be created via the command line.
#	Others can be created via the command line or web app.
#
rake app:deputize uid=<Your CalNet UID>

Production Installation

As this app is being installed on a VM Java jruby tomcat thing, we need special instructions. Apparently, for Tomcat 5, we need to use jruby-rack-0.9.6.jar, which is included in lib/.

Tomcat will unarchive the war file and DESTROY the existing unarchived version! Any file uploads will need to be kept elsewhere.

Before (or after) I recommend migrating the database from somewhere else using the production_prep ‘environment’.

( warble from a jruby environment to get the jruby specific gems )

[jakewendt@dev : ucb_ccls_homex ]>
rake db:migrate RAILS_ENV=production_prep
# rake app:update RAILS_ENV=production_prep	#	load fixtures?
bash
rvm use jruby
warble
scp homex.war ccls.berkeley.edu:

[jakewendt@ccls-01]>
sudo /sbin/service tomcat5 stop
sudo su -l tomcat
/bin/rm -rf /var/lib/tomcat5/webapps/homex
cp ~jakewendt/homex.war /var/lib/tomcat5/webapps/
exit

sudo /sbin/service tomcat5 start
tail -f /var/log/tomcat5/catalina.out

Kenai

Berkeley Wiki

Documentation

Inline documentation is sparse and incomplete, but I’m working on it.

sudo gem install rdoc --source http://gemcutter.org
rake doc:plugins
rake doc:app
open doc/app/README_rdoc.html

Further Info

Ruby Best Practices

FedEx credentials

RVM on GitHub

To Do

  • Fix expire_fragment "#{request.try(:host_with_port)}#{page_path}" so that it works without the try (not necessary)

  • Add to doc/README_FOR_APP

  • one of the images in rdoc isn’t always the correct directory depth and will create a flash error showing this

Vaguely related to dos

  • Make RDoc auto recognize the following rails commands and group them together under separate headings (like Public Instance Methods, Private Instance Methods, etc.)

    • named_scope

    • validate_*

    • before_*

    • after_*

    • attr_protected

    • attr_accessible

  • Make RDoc auto recognize these specific commands and group them together under user definable separate headings (like Public Instance Methods, Private Instance Methods, etc.)

* so far, rdoc_rails does everything except the Owner relationship of the Aliquot (counter_cache is causing the problem)

  • rdoc the rake tasks??

  • thickbox-compressed.js has relative location for image which isn’t always correct.

Credit / Special Thanks

Gradient images made with Gradient Image Maker

Demo on css rounded corners

Background image gradients

About

UC Berkeley, School of Public Health, California Childhood Leukemia Study

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published