Install Applications
While this document is written for Mac installation, the software needed to run ggKbase includes: ruby, rbenv, rbenv-vars, sidekiq, puma, redis, mariadb, elasticsearch.
xcode (mac development toolkit)
xcode-select --install
homebrew (mac application manager)
# Full doc: http://brew.sh/ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
rbenv (ruby environment manager)
# Full doc: https://github.com/rbenv/rbenv brew install rbenv #this also installs ruby-build, needed to install other Ruby version
NOTE: If you are NOT on Mac, you need to install ruby-build plugin manually:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Install rbenv vars
plugin, needed for environmental variables
git clone https://github.com/rbenv/rbenv-vars.git $(rbenv root)/plugins/rbenv-vars
ruby
rbenv install 2.5.0 # as of 1/30/2018 rbenv rehash rbenv global 2.5.0 # set it to be global
bundler
gem update --system gem install bundler
redis
brew install redis # test redis redis-cli ping # Expected response is PONG
brew install tokyo-cabinet
mariadb (a variant of mysql)
brew install mariadb # Follow on screen instruction for post-installation setup
Set up database and import data
mysql -uroot create database ggkbase_development; exit #exit database scp gg:/home/bcthomas/.... # NEED NEW TRAINING DB gunzip NEW TRAINING DB mysql -uroot ggkbase_development < NEW TRAINING DB
elasticsearch (search engine)
brew install elasticsearch # NOT NECESSARY, but if you need to edit the configuration files they are # elasticsearch.yml and jvm.options in /usr/local/etc/elasticsearch # Fire up elasticsearch brew services start elasticsearch
Set up development site (in development mode)
git clone git@github.com:banfieldlab/ggkbase.git
git update local master branch
# Assuming you are in ggkbase development directory git pull origin master # If/when you run into conflict over Gemfile.lock, run the following before pulling git checkout Gemfile.lock
install gems
bundle config set path 'vendor/bundle' bundle install
set up rbenv-vars for environmental variables
cp .rbenv-vars.example .rbenv-vars #import variables to change are # Secret key base SECRET_KEY_BASE # must be unique from all other keys # Database configurations DB_USERNAME= DB_PASSWORD= DB_HOST= DB_POOL= DB_DEVELOPMENT= DB_PRODUCTION= # ES ES_HOST= ES_PORT=9200 ES_INDEX_NAME= ES_DOCUMENT_TYPE=
update Database
RAILS_ENV=production bin/rails db:migrate
launch ggKbase server
# Start redis ./redis_init.sh start # When started successfully: Starting redis... all set # Start sidekiq RAILS_ENV=production bin/rails sidekiq:start # Check whether sidekiq started successfully tail -f log/sidekiq.log # The last line should be: Sidekiq Pro 3.3.3, commercially licensed. Thanks for your support! # Start puma (application server) RAILS_ENV=production bin/rails server
If all goes well, you should be able to load up the site at localhost:3000.
elasticsearch indexing
# Create the ES index defined in rbenv-vars RAILS_ENV=production bin/rails es:create:index # To index the whole database RAILS_ENV=production bin/rails es:index
setting up the account with Admin role and Import ability
# login into the console bin/rails c # add admin role to user user = User.find_by email:"youremailaccount.com" # every user has "member" role as default user.roles << Role.create(title:"admin") # setting "banfield" flag to true for import user.update(banfield:true)
Update Needed:
Connect to taxonomy database: PRJNA273161_taxid_overrides
Add this file to github repo