## Setup Environment There are numerous services you need to install to get this application started. This readme will walk you through everything.
`brew install imagemagick postgresql elasticsearch redis-server`
To have launchd start elasticsearch at login:
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
Then to load elasticsearch now:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
Or, if you don't want/need launchctl, you can just run:
##Setup Application Now that you have your dependencies, you can install all the gems you need.
This application also uses refinery cms. To initialize it, run: `rails generate refinery:cms –fresh-installation` and choose to not overwrite anything that is existing. This will build the database needed for Refinery
##Setup Salesforce In order for the application to successfully authenticate with salesforce, you must set up your authentication details with salesforce.
Copy the file config/sf_api.yml.example.yml to config/sf_api.yml and add in the necessary fields. Your yml configuration file should look like the following:
development: client_id: abc client_secret: xyz username: firstname.lastname@example.org password: password security_token: pwd_token
There are additional steps that need to be taken in the Salesforce Admin portal to set up your user to access the application. Loosely, they are:
Create new connected oauth app
Set up callback and basic info
Reset security token, receive in email, add to app
in Salesforce, Security Control>Network Access: Whitelist your local IP Address Range
Add host if not specified (wasn't originally). For testing it should be `host: test.salesforce.com`
##Setup Braintree In order for the application to successfully authenticate with braintree, you must set up your authentication details with braintree.
Update the file config/braintree.yml with the appropriate config details.
_Note: Section notes pending, however not necessary to running the application_
##Setup the Database: `rake db:create` `rake db:migrate`
The database may have been created with an older version of postgres than what you have installed. To upgrade it…
###Database Troubleshooting If you need to blow up your database: `rm -rf /usr/local/var/postgres && initdb /usr/local/var/postgres -E utf8`
If you get: role “postgres” does not exist, create the user: `/usr/local/Cellar/postgresql/9.5.4/bin/createuser -s postgres`
If you run into issues with `ERROR: type “hstore” does not exist`, then run: > `psql template1 -c 'create extension hstore;'`
This will add the hstore extension by default to all postgreSQL DBs. Read more about it here](clarkdave.net/2012/09/postgresql-error-type-hstore-does-not-exist/)
##Run Application Run redis:
sidekiq -q projects,1 student_application,2
Run elasticsearch (should be started at login):
brew services start elasticsearch
Run Rails server: