Skip to content

How to Install & Run OpenFarm on an OS X System

David Gross edited this page Mar 21, 2015 · 8 revisions

Follow these instructions to install and run OpenFarm (and the software it depends on) on a Mac OS X system:

1. Install Git

If you are running Mavericks (10.9) or later, simply try to run git from the command line. If you already have Git installed, you will see command usage information. If you do not have Git installed, you will be prompted to install it.

Otherwise, visit http://git-scm.com/download/mac to download and install Git.

2. Install Ruby

Many versions of OS X have Ruby already installed. If this is not the case with your system and if you have the Homebrew package manager, you can issue the following command to install Ruby:

brew install ruby

3. Install Rails

Visit http://installrails.com for easy-to-follow, step-by-step instructions for how to install Rails on various versions of OS X.

4. Install ElasticSearch

To install ElasticSearch, follow the instructions at this page.

You may need to first install Java with a command like

brew install Caskroom/cask/java

5. Install MongoDB

To install MongoDB, follow the instructions at this page.

6. Install OpenFarm Itself

To install OpenFarm, enter these commands:

git clone https://github.com/openfarmcc/OpenFarm.git
cd OpenFarm
bundle install

7. Start and Test the OpenFarm Server

OpenFarm has a web-based interface. When you install it on your own system, you are installing a web server, and to interact with it as a member would, you do so through your browser. Here are the final commands you need to issue to bring the server up and to connect to it with a browser:

rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s

Then, visit http://127.0.0.1:3000/ in your browser to see the OpenFarm web application running on your local machine. There is a default administrator account and password: [email protected] and admin123.

Troubleshooting

Failed connect to localhost:9200: Connection refused

This indicates that ElasticSearch is not running, or that it was not properly installed (consider going back to the step above where you install ElasticSearch and try it again to make sure it sticks; make sure to install Java if you have not already done so).

You can check if ElasticSearch is running by issuing the following command:

curl http://localhost:9200

If that command returns a 200 HTTP status code, ElasticSearch is running. If you instead see a message like "curl: (7) Failed to connect to localhost port 9200: Connection refused" this indicates that ElasticSearch is probably not running.

If ElasticSearch is running but you still encounter this error, try setting an environment variable to explicitly point to the correct location by adding the following line to the file config/app_environment_variables.rb (create the file if it does not already exist):

ENV['ELASTICSEARCH_URL'] = 'http://127.0.0.1:9200'

If ElasticSearch is not running, you can start it with the following command:

elasticsearch start

Then try the bundle process again:

bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s

elasticsearch error: Unsupported major.minor version

If you run into this problem when trying to execute elasticsearch, add the following line to your ~/.bash_profile file:

export JAVA_HOME="/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home"

Then open up a new terminal and try to start elasticsearch again

elasticsearch start

Failure: Could not connect to a primary node for replica set...

This indicates that MongoDB is not executing. Issue the following command:

mongod

and then try again.

Failure: dbpath (/data/db) does not exist

Create this directory with the following commands:

sudo mkdir /data
sudo mkdir /data/db

Then issue the following command:

whoami

This will tell you your account name. Use this name to set the ownership of the /data/ directory you just made, by issuing the following command (replacing myname with the account name you got back when you issued the whoami command):

sudo chown -R myname /data

Then try starting MongoDB again:

mongod