bensheldon/panlexicon

Document dependencies and app setup process

becw opened this issue · 1 comments

becw commented

There should be some sort of project setup documentation on the README. It would be super rad if there were a vagrant config included, which would make setup easier.

Here are my notes from setting up:

sudo apt-get update

# https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-ubuntu-12-04
sudo apt-get install postgresql postgresql-contrib libpq-dev

# create a postgres user: panlexicon/panlexicon
sudo su - postgres
createuser --pwprompt

# Configure db user/password in panlexicon-rails/config/database.yml defaults

# update postgres user local authentication method (because of auth issues from `bin/rake db:setup`, "peer authentication failed")
sudo su - postgres
cd /etc/postgresql/9.1/main/
vi pg_hba.conf
# Change:
# > local   all             postgres                                peer
# to:
# > local   all             postgres                                md5
# Restart postgres
sudo service postgresql restart

# http://rvm.io/rvm/install
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
sudo \curl -sSL https://get.rvm.io | bash -s stable --rails

# Application setup
cd /var/www/sites/panlexicon-rails

# Get dependencies via gem (gem comes with ruby)
gem install bundler

# At this point I had to update Gemfile and .ruby-version to specify Ruby 2.1.5
bundle install

# Install a JS runtime: https://github.com/sstephenson/execjs
# https://github.com/joyent/node/wiki/installing-node.js-via-package-manager
# Install from the "nodesource" apt repository
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs

# Create the database and schema
bin/rake db:setup

# Import data
# Download the thesaurus from http://www.gutenberg.org/ebooks/3202
bin/rake import:moby[mthesaur.txt]

# Start the rails dev server
bin/rails server

# If the thesaurus isn't fully loaded, and the word "thesaurus" hasn't been imported yet, then the front page will throw an error

I've added a Dockerfile and docker-compose.yml which should ease the dependency setup in #212. I've also documented the (hopefully brief) steps necessary for building the application for development using Docker: https://github.com/bensheldon/panlexicon-rails#docker-setup