-
Notifications
You must be signed in to change notification settings - Fork 244
How to Install & Run OpenFarm on an OS X System
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.
To install OpenFarm, enter these commands:
git clone https://github.com/openfarmcc/OpenFarm.git
cd OpenFarm
bundle install
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 user 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
.
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
@#$% if I know.
If the process fails because Java is not installed, install it with the following commands:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installerx
export JAVA_HOME=jdk-install-dir
export PATH=$JAVA_HOME/bin:$PATH
Then start ElasticSearch with this command:
sudo /etc/init.d/elasticsearch start
And finally start the server:
bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s
First, install RVM:
gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
sudo apt-get install curl
curl -sSL https://get.rvm.io | bash -s stable
Then restart your terminal so that RVM commands will work, and issue this command:
rvm install ruby-2.2.0
Next, adjust your terminal (a.k.a. shell, console) settings:
- Open a terminal, or click on your terminal so that it gets focus.
- From the terminal application menu, select Edit > Profile Preferences.
- Select the Title and Command tab.
- Check the box labeled Run command as a login shell.
- Exit and restart the terminal.
Next, adjust OpenFarm:
cd OpenFarm
rvm --default use 2.2.0
And try again:
bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s
If you get an error of this sort, you may need to install patron separately. Do this with the following command:
sudo gem install patron
If your attempt to install patron fails with an error of this sort, you may need to first install libcurl separately. Do this with the following command:
sudo apt-get install libcurl3 libcurl3-gnutls libcurl4-openssl-dev
Then attempt to install patron again:
sudo gem install patron
And finally, reattempt the process:
bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s
An error of this sort will look something like this:
Failed - /home/roryaronson/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rails/cli (LoadError)
from /home/roryaronson/.rvm/rubies/ruby-2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/rails:7:in `<main>'
If you get an error of this sort, try re-bundling and continuing from there:
bundle install
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s
A failure of this sort will look something like this:
Gem::RemoteFetcher::FetchError: Errno::ETIMEDOUT: Connection timed out - connect(2) for "rubygems.org" port 443 (https://rubygems.org/gems/railties-4.0.2.gem)
An error occurred while installing railties (4.0.2), and Bundler cannot
continue.
Make sure that `gem install railties -v '4.0.2'` succeeds before bundling.
This usually indicates a transient network error. Try issuing the bundle command again or perhaps waiting a while first to see if the problem goes away before reissuing the command.
An error of this sort will look something like this:
Failed - Gem::RemoteFetcher::FetchError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv3 read server session ticket A (https://rubygems.global.ssl.fastly.net/gems/tzinfo-0.3.41.gem)
An error occurred while installing tzinfo (0.3.41), and Bundler cannot continue.
Make sure that `gem install tzinfo -v '0.3.41'` succeeds before bundling.
If you get an error of this sort, you may need to explicitly install tzinfo. Do this with the following command:
gem install tzinfo
Then re-bundle with the following command:
bundle install
If that fails, one more thing you can try is to manually install the AWS SDK before making another re-bundling attempt. Do this with the following commands:
gem install aws-sdk-v1 -v '1.55.0'
bundle install
Next, try starting the server:
rake db:setup
echo "ENV['SECRET_KEY_BASE'] = '$(rake secret)'" >> config/app_environment_variables.rb
rails s
That should do the trick.
500 errors can happen for a myriad of reasons. If you just started running your server by executing rails s
and are immediately getting this error, it is possible that your mongo database is not yet running. You can start the database manually by issuing the command monogod -dbpath db
in your OpenFarm directory.
About OpenFarm
Development
- How to Contribute to OpenFarm
- Code of Conduct
- How to Install & Run OpenFarm on an OS X system and on an Ubuntu System
- Troubleshooting Common Issues
- How to Set Up an Amazon S3 Bucket for Use with OpenFarm
- Modular CSS
- The OpenFarm API and API Documentation
- How to Use Docker and Fig
Deployment
Reference