Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a CMS Engine with Ruby on Rails. (Locomotive)

Locomotive as an open source CMS for ruby on rails, which I'd like to install.

I've got on well with their 'getting started' projects, but I'm having trouble installing the Locomotive CMS Engine.

Here's a link to the requirements:

http://doc.locomotivecms.com/guides/get-started/requirements

...and here's a link to the actual guide that installs the CMS Engine:

http://doc.locomotivecms.com/guides/get-started/install-engine

Okay, so first, Ruby needs to be installed, version 1.9.3 at least: terminal screen shot, demonstrating what version of ruby is installed

Next, imagemagick needs to be installed. Imagemagick is an open source software suite for displaying, converting, and editing raster image files. When installed, it warns me that I have either mac ports or fink installed, even though I've removed both. I have no idea what to do about those malformed objects!

terminal screenshot showing imagemagick installation errors

Anyway, let's push on. Now we need to install rails version 3.2.11: terminal screenshot showing loaded version of rails

Great. Now we need to install MongoDB, an open-source document database, and the leading NoSQL database.

terminal screenshot showing MongoDB output A few things are wrong here. Launchctl didn't return anything? Why not? Running 'Mongod' resulted in no out put whatsoever either. Bad signs.

Now, rake and bundler need to be installed. No problems:

terminal screenshot verifying bundler is installedterminal screenshot verifying rake is installed

Next the wagon gem needs to be installed. Wagon is a command line site generator for the LocomotiveCMS engine. Installs without complaint:

terminal screenshot verifying wagon is installed

Finally it's time for the application to be generated! I've called it 'myapp' and created it using the following command:

rails new myapp --skip-active-record --skip-test-unit --skip-javascript --skip-bundle

Now I enter the root directory of 'myapp' with:

cd myapp

Include the relevant gems in the Gemfile:

group :assets do
gem 'locomotive_cms', '~> 2.0.1', :require => 'locomotive/engine'
gem 'unicorn', :group => 'development'
gem 'compass-rails',  '~> 1.0.2', :group => 'assets'
gem 'sass-rails',     '~> 3.2.4', :group => 'assets'
gem 'coffee-rails',   '~> 3.2.2', :group => 'assets'
gem 'uglifier',       '~> 1.2.4', :group => 'assets'
end

Run 'bundle install'. No problems at all: enter image description here

But here, here is where I think is where the errors come into play. It has everything to do with Mongoid.

The following command is used to insert the engine routes to the main application:

bundle exec rails g locomotive:install

and it results in the following warnings:

  create  config/initializers/locomotive.rb
  create  config/initializers/carrierwave.rb
  create  config/initializers/dragonfly.rb
  create  config/mongoid.yml
    rake  db:mongoid:migration:install/usr/local/rvm/gems/ruby-1.9.3-     p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:197: warning: Insecure world writable    dir /usr/local in PATH, mode 040777
rake aborted!
Failed to connect to a master node at localhost:27017
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:413:in      `connect'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:574:in     `setup'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:104:in     `initialize'

and

rake  db:mongoid:migrate
/usr/local/rvm/gems/ruby-1.9.3-p392@global/gems/bundler-1.2.4/lib/bundler/runtime.rb:197:     warning: Insecure world writable dir /usr/local in PATH, mode 040777
rake aborted!
Failed to connect to a master node at localhost:27017
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:413:in  `connect'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:574:in   `setup'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/mongo-1.5.2/lib/mongo/connection.rb:104:in   `initialize'

The instructions say to also "configure your mongodb hostname and database name in config/mongoid.yml." I've left them as:

defaults: &defaults
host: localhost
port: 27017
# slaves:
#   - host: slave1.local
#     port: 27018
#   - host: slave2.local
#     port: 27019

development:
<<: *defaults
database: locomotive_dev

test:
<<: *defaults
database: locomotive_test

The instructions also say to set "multisite activation, default locale, email sender (etc) in config/initializers/locomotive.rb." Again, I've simply left it as:

Locomotive.configure do |config|
 config.multi_sites = false
 config.default_locale = :en
 config.enable_logs = true
 config.mailer_sender = '[email protected]'
end

Moment of truth now. Starting the server with:

bundle exec unicorn_rails

Spent a good six hours on this. All I get is

E, [2013-04-29T20:41:49.223219 #40521] ERROR -- : reaped #<Process::Status: pid 40527 exit 1>     worker=0
I, [2013-04-29T20:41:49.223661 #40521]  INFO -- : worker=0 spawning...
I, [2013-04-29T20:41:49.225155 #40528]  INFO -- : worker=0 spawned pid=40528
I, [2013-04-29T20:41:49.225574 #40528]  INFO -- : Refreshing Gem list
E, [2013-04-29T20:41:52.211379 #40528] ERROR -- : Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)

In a word: awergohiewgiohegwhioewgiohwefiohfwaehioiohawefiohawefhioaewfohiafwehioafwiohaiofwehiofaewiohaefwihoefwahioaefwhioaefwhoiiohaefwhioefwhioaefwhioaefwhioaefwiohafewiohaefwohifaewiohaefwhioafewhiofaewhiofewaiohefwaohieawfiohfewhiofewhiofeawhiofaewhoieafwhioawefhioawfeiohawfeohi.

If someone could help out with, I would be so, so, so thankful. I think this is the key:

Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)
like image 219
Starkers Avatar asked Oct 22 '22 11:10

Starkers


1 Answers

You need to start the mongo database engine.

Just before running:

bundle exec unicorn_rails

run

sudo mongod --dbpath /usr/local/var/mongodb --fork --logpath /var/log/mongodb.log

starting the unicorn rails server will now result in no errors.

Optional, run

tail -f /var/log/mongodb.log

To see a live log as your application interacts with the database!

like image 200
Starkers Avatar answered Oct 24 '22 10:10

Starkers