【问题标题】:Installing a CMS Engine with Ruby on Rails. (Locomotive)使用 Ruby on Rails 安装 CMS 引擎。 (机车)
【发布时间】:2013-04-29 19:44:39
【问题描述】:

机车作为 ruby​​ on rails 的开源 CMS,我想安装它。

他们的“入门”项目进展顺利,但我在安装 Locomotive CMS 引擎时遇到了问题。

这里是要求的链接:

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

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

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

好的,首先,需要安装 Ruby,版本至少为 1.9.3:

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

无论如何,让我们继续前进。现在我们需要安装rails 3.2.11版本:

太好了。现在我们需要安装开源文档数据库MongoDB和领先的NoSQL数据库。

这里有几件事是错误的。 Launchctl 没有返回任何东西?为什么不?运行“Mongod”也没有任何输出。不好的迹象。

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

接下来需要安装 wagon gem。 Wagon 是 LocomotiveCMS 引擎的命令行站点生成器。安装无抱怨:

终于可以生成应用程序了!我将其命名为“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

运行“捆绑安装”。完全没有问题:

但是在这里,我认为这是错误发挥作用的地方。它与 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)

一句话:awergohiewgiohegwhioewgiohwefiohfwaehioiohawefiohawefhioaewfohiafwehioafwiohaiofwehiofaewiohaefwihoefwahioaefwhioaefwhoiiohaefwhioefwhioaefwhioaefwhioaefwiohafewiohaefwohifaewiohaefwhioafewhiofaewhiofewaiohefwaohieawfiohfewhiofewhiofeawhiofaewho

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

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

【问题讨论】:

  • 嘿@Starkers 机车怎么样。我刚开始弄乱它,到目前为止一切都很好。关于本地引擎部署的任何建议。因为我收到一个错误。就像你推荐的一篇文章一样。无论如何感谢这篇文章。很有帮助 ++
  • 谢谢,但我无法真正回答你。大多数客户只需要我自己的简单 CMS,所以我不使用 Locomotive。如果我自己的简单 cms 无法解决,我会使用这个:alchemy-cms.com/about 虽然我没有敲 Locomotive,但我认为 BBC iplayer 使用它,所以我认为它可以胜任大多数任务。
  • 感谢您的洞察 :)
  • 你也可以看看这个nestacms.com

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


【解决方案1】:

您需要启动 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

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-21
      • 2018-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-25
      • 1970-01-01
      相关资源
      最近更新 更多