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

标签 ruby-on-rails web-applications locomotivecms

Locomotive 作为 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 版本:
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 gem。 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

运行“捆绑安装”。完全没有问题:
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)

总之: awergohiewgiohegwhioewgiohwefiohfwaehioiohawefiohawefhioaewfohiafwehioafwiohaiofwehiofaewiohaefwihoefwahioaefwhioaefwhoiiohaefwhioefwhioaefwhioewgiohwefiohfwaehioiohawefiohawhioaewfohiafwehioafwiohaiofwehiofaewiohaefwihoefwahioaefwhioaefwhoiiohaefwhioefwhioaefwhioewgiohwefiohfwaehioiohawefiohawhiowiowahieohaiowahieohaiowahieohaiowahieohaiowahieohieohaiowahieowahieo

如果有人可以提供帮助,我会如此,如此,非常感谢。我认为这是关键:
Failed to connect to a master node at localhost:27017 (Mongo::ConnectionFailure)

最佳答案

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

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

关于ruby-on-rails - 使用 Ruby on Rails 安装 CMS 引擎。 (机车),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16286942/

相关文章:

sql - 如何在 Rails 事件记录查询中执行条件计数?

ruby-on-rails - 我应该如何在 Rails 中实现业务逻辑层?我应该把代码放在哪里?

ruby-on-rails - Rails Accepted_nested_attributes_for 始终创建嵌套模型,但不更新它们

php - 如何从 Flex 中的主应用程序加载子应用程序

html - Rails - 电子邮件字符串拒绝在表格内自动换行

python - 是否有一种设计模式可以安排 "event"将来发生?

java - 我如何在 android studio -Java 中仅选择 3 个选项 RadioButton 或订单

ruby-on-rails - 机车编辑器在尝试循环模型的条目时抛出 'NoMethodError'

ruby-on-rails - 无法在 bundle exec 安装 Locomotive CMS