genome/dgi-db

View on GitHub
INSTALL-OSX

Summary

Maintainability
Test Coverage
#These instructions are for OSX 10.7 (Lion) and above

#Install RVM with Ruby and Rails: https://rvm.io/rvm/install
#You want to install Ruby 2.6.5
    \curl -L https://get.rvm.io | bash -s stable --rails

#To check your version of Ruby:
ruby -v

#To install and use Ruby 2.6.5:
rvm install 2.6.5
rvm use 2.6.5

#If you have trouble installing Ruby on Mac OSX 10.8 (Mountain Lion), the issue may be your Xcode install
#In that case, this post might be informative
#http://stackoverflow.com/questions/9353444/how-to-use-install-gcc-on-mac-os-x-10-8-xcode-4-4

#Resource your bash profile
source ~/.bash_profile

#Install git if it is not installed already.
# if you do not have homebrew here is a fast way to get it: (http://mxcl.github.com/homebrew/)
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
brew install git

#Install PostgreSQL from: http://postgresapp.com
#Once installed, be sure to launch PostgreSQL before attempting to fire up the rails application below

#You may also need to install postgres as follows:
brew install postgres

# check out the code
mkdir ~/git/
cd ~/git/
git clone git://github.com/genome/dgi-db.git
cd dgi-db

#This seems to give a read-only version of the repo.  To fix this you can do something like this:
git remote rename origin origin-ro
git remote add origin git@github.com:genome/dgi-db.git
git fetch origin
git pull origin master
git push origin master
git remote remove origin-ro

#install gem dependencies
bundle install

#If you get an error related to 'time zone utc' try rebooting...
#On OSX Mountain Lion you may have to do this: 'sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2' to get bundle install to succeed

#If you get an error installing therubyracer, the [following workaround](https://gist.github.com/fernandoaleman/868b64cd60ab2d51ab24e7bf384da1ca#gistcomment-3081153) resolves this issue:
brew install v8@3.15
gem install libv8 -v 'YOUR_VERSION' -- --with-system-v8
gem install therubyracer -v 'YOUR_VERSION' -- --with-v8-dir=/usr/local/opt/v8@3.15
bundle install

#update the local database
rake dgidb:load_local

#Occasionally the database may get into a confused state and this rake command no longer works properly
#In that case you can try this:
psql -h localhost -d dgidb -f db/structure.sql
psql -h localhost -d dgidb -f data/data.sql

#launch your development server
rails s

#View the app in your browser by going to the following url
http://localhost:3000/

#If the database has been updated to include new sources you may need to clear the dgidb cache by loading the following URL:
http://localhost:3000/cache/invalidate/

#If you encounter errors about a pg_dump version mismatch it is likely that you have multiple competing installs of Postgresql.
#One likely fix is to find the location of the pg_dump binary in the more recent installation and make sure this dir at the beginning of your $PATH

#To run the test suite move to within the project dir and execute the following
#On some systems we encounter sporadic segmentation faults when running the test suite.  Try it several times to see if this is happening on your system
#This may be an issue with a particular version of Ruby, a Mac compiler issue, or something else...
rake spec

#File location for internal storage of download files for TGI developers
#There is a git repo (the same one that the database dump lives in) at ssh://git/srv/git/dgidb-data.git. 
#If you put a file in there, commit and push to master, it will be available for public download at dgidb.org/downloads/<filename> the next time puppet runs.
#External developers setting up their own instance of DGIdb would need to create their own download location
cd ~/git/
git clone ssh://git/srv/git/dgidb-data.git

#If you have problems updating your local database you may need to delete the data/ dir and rerun 'rake dgidb:load_local'