使用Ruby on Rails安装CMS引擎。 (机车)

时间:2013-04-29 19:44:39

标签: ruby-on-rails web-applications locomotivecms

机车作为轨道上红宝石的开源CMS,我想安装。

我与他们的“入门”项目相处得很好,但我在安装机车CMS引擎时遇到了麻烦。

以下是要求的链接:

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

...这里是指向安装CMS引擎的实际指南的链接:

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

好的,首先,需要安装Ruby,至少版本为1.9.3: terminal screen shot, demonstrating what version of ruby is installed

接下来,需要安装imagemagick。 Imagemagick是一个开源软件套件,用于显示,转换和编辑光栅图像文件。安装后,它警告我,我安装了mac端口或fink,即使我已经删除了它们。 我不知道如何处理这些格式错误的对象!

terminal screenshot showing imagemagick installation errors

无论如何,让我们继续前进吧。现在我们需要安装rails版本3.2.11: terminal screenshot showing loaded version of rails

大。现在我们需要安装MongoDB,一个开源文档数据库和领先的NoSQL数据库。

terminal screenshot showing MongoDB output 这里有一些问题。 Launchctl没有退货吗?为什么不?运行'Mongod'也没有任何结果。不好的迹象。

现在,需要安装rake和bundler。没问题:

terminal screenshot verifying bundler is installed terminal screenshot verifying rake is installed

接下来需要安装旅行车宝石。 Wagon是LocomotiveCMS引擎的命令行站点生成器。没有投诉安装:

terminal screenshot verifying wagon is installed

最后是时候生成应用程序了!我称之为'myapp'并使用以下命令创建它:

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

现在我输入'myapp'的根目录:

cd myapp

在Gemfile中包含相关的gem:

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

运行'bundle install'。没问题: enter image description here

但是在这里,我认为这是错误发挥作用的地方。它与Mongoid有关。

以下命令用于将引擎路由插入主应用程序:

bundle exec rails g locomotive:install

并导致以下警告:

  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'

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'

说明还要“在config / mongoid.yml中配置你的mongodb主机名和数据库名称。”我把它们留作了:

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

说明还说在config / initializers / locomotive.rb中设置“多站点激活,默认语言环境,电子邮件发件人(等)”。我再一次把它留作:

Locomotive.configure do |config|
 config.multi_sites = false
 config.default_locale = :en
 config.enable_logs = true
 config.mailer_sender = 'support@example.com'
end

现在的真相。使用以下命令启动服务器:

bundle exec unicorn_rails

这花了六个小时。我得到的只是

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)

在一个字:awergohiewgiohegwhioewgiohwefiohfwaehioiohawefiohawefhioaewfohiafwehioafwiohaiofwehiofaewiohaefwihoefwahioaefwhioaefwhoiiohaefwhioefwhioaefwhioaefwhioaefwiohafewiohaefwohifaewiohaefwhioafewhiofaewhiofewaiohefwaohieawfiohfewhiofewhiofeawhiofaewhoieafwhioawefhioawfeiohawfeohi

如果有人可以帮忙,我会这样,所以,非常感谢。我认为这是关键:

Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)

2 个答案:

答案 0 :(得分:3)

您需要启动mongo数据库引擎。

在跑步前:

bundle exec unicorn_rails

运行

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

启动unicorn rails服务器现在将导致无错误。

可选,运行

tail -f /var/log/mongodb.log

在应用程序与数据库交互时查看实时日志!

答案 1 :(得分:0)

我删除了设计初始化程序文件并运行了 rails g devise:install  再次启动unicorn服务器,一切正常。

相关问题