Skip to content
tylernisonoff edited this page Oct 1, 2014 · 27 revisions

Prerequisites

First you need git in order to clone this repository. Next, you will need Ruby 2.0.0 (If you have problems installing openssl in OSX...see here). You should install ruby and rubygems with rvm. You should also get Node.js and npm. I recommend using nvm to install them. Then execute the following in your shell:

# Globally install Node.js utility binaries
$ npm install -g bower phantomjs

# Run below command, and install the recommended packages
$ rvm requirements

# Install required gem
$ gem install bundler

Linux specific requirements

On any Debian based operating system, execute the following in your shell:

# Install ImageMagick
$ sudo apt-get install libmagickwand-dev imagemagick

# Install local Postgres & Redis servers
$ sudo apt-get install redis-server postgresql

# Other dependencies
$ sudo apt-get install libxslt-dev libxml2-dev libcurl4-openssl-dev libpq-dev

OSX specific requirements

# Install Homebrew (if you don't already have it)
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

# Install ImageMagick
$ brew install imagemagick
$ vim ~/.bash_profile
# add export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH"¬
$ source ~/.bash_profile

# More require packages for nokogiri
$ brew install libxml2 libxslt
$ brew link libxml2 libxslt

# Install a local Redis server (or see configuration section on how to avoid this)
$ wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz
$ tar xzf redis-2.6.14.tar.gz
$ cd redis-2.6.14
$ make

# Install Postgresql 
Download Postgres application from http://postgresapp.com/
$ echo export PATH=/Applications/Postgres93.app/Contents/MacOS/bin:$PATH >> ~/.bash_profile

# Alternatively, can use homebrew
$ brew install postgresql

Windows specific requirements

Get a Linux computer.

Running the site

$ git clone [email protected]:dukechronicle/chronline.git
$ cd chronline

# Install dependencies
$ bundle install --without production

# Download client side vendor assets with bower
$ rake bower:install

# Create DB if not created
$ rake db:create

# Start local solr server (also must be done after every reboot)
$ rake sunspot:solr:start

# Rails database initialization (or also to update corrupt db)
$ rake db:migrate
$ rake db:seed
$ rake db:test:prepare

# Then, from the project directory
$ rails server

Configuration files

Default configuration settings are tracked in config/settings/development.yml. To override or add configuration parameters, supply a config/settings/development.local.yml file. This is where any passwords/secrets should be stored. The local configuration file should NOT be tracked with version control as it may contain sensitive information.

Redis configuration

By default, the application will attempt to connect to a Redis server running on the local machine. If you would prefer not to install Redis on your computer, in your local config file, set the redis setting to the full URI of the Redis server you would like to use.

Vagrant

Vagrant is a good option for windows users, as well as OS X users who would like their development environments more similar to the production environment. It also simplifies the setup process

First install Git, Vagrant, and VirtualBox.

# Clone Repository
$ git clone [email protected]:dukechronicle/chronline.git
$ cd chronline

# Setup Vagrant VM
$ vagrant up

At this point, you may get an error along the lines of 'A host only network interface you're attempting to configure via DHCP...' If so run VBoxManage dhcpserver remove --netname HostInterfaceNetworking-vboxnet0 followed by vagrant up

# ssh into VM
$ vagrant ssh

# move into repository directory
$ cd chronline

At this point, follow the instructions above for running the site