0

我正在尝试按照Railscast #347 Rubber 和 Amazon EC2的说明启动 Amazon EC2 实例。

Rails 项目配置如下。.ruby-version文件:

ruby-1.9.3

这是Gemfile

source 'http://rubygems.org'

ruby '1.9.3'
gem 'rails', '~> 3.2.13'
gem 'rb-readline', '~> 0.5.0'
gem 'counter_culture', '~> 0.1.12'
gem 'jquery-rails', '~> 3.0.2'
gem 'therubyracer', '~> 0.11.4', require: 'v8'
gem 'attribute_normalizer', '~> 1.1.0'

group :assets do
  gem 'sass-rails', '~> 3.2.5'
  gem 'coffee-rails', '~> 3.2.2'
  gem 'uglifier', '~> 2.1.1'
end

group :development do
  gem 'debugger', '~> 1.6.0'
end

group :development, :test do
  gem 'sqlite3', '~> 1.3.7'
end

group :production do
  gem 'pg', '~> 0.15.1'
end

gem 'rubber', '~> 2.5.2'
gem 'open4'
gem 'gelf'
gem 'graylog2_exceptions', :git => 'git://github.com/wr0ngway/graylog2_exceptions.git'
gem 'graylog2-resque'

我运行以下橡胶命令:

$ rubber vulcanize complete_passenger_postgresql

除其他文件外,rubber-ruby.yml生成如下(已删除评论):

# config/rubber/rubber-ruby.yml
packages: [build-essential, git-core, subversion, curl, autoconf, bison, ruby, zlib1g-dev, libssl-dev, libreadline6-dev, libxml2-dev, libyaml-dev]
ruby_build_version: 20130501
ruby_version: 1.9.3
ruby_path: "/usr/local/rubies/#{ruby_version}"

在 IRC 上与nirvdrum聊天后,我已经将其更改ruby_version: 1.9.3ruby_version: 1.9.3-p448并试了一下。虽然同样的错误。

我坚持教程,只配置了强制设置:

# config/rubber/rubber.yml
app_name: ...
domain: ...
access_key: ...
secret_access_key: ...
account: ...
key_name: ...

按照教程,我测试了正在运行的设置:

$ cap rubber:create_staging

该脚本在安装和重新启动实例时运行了一段时间,但过了一会儿它停止了:

 ...

 ** [out :: production.foobar.com] Identified as a _site plugin, moving to _site structure ...
 ** [out :: production.foobar.com] Installed head
    command finished in 5005ms
  * 2013-07-11 01:02:20 executing `rubber:graylog:server:install'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x007f2d89221718> -> /tmp/install_graylog_server
    [production.foobar.com] /tmp/install_graylog_server
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l /tmp/install_graylog_server"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
    command finished in 2320ms
  * 2013-07-11 01:02:23 executing `rubber:graylog:web:install'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x007f2d817c2a58> -> /tmp/install_graylog_web
    [production.foobar.com] /tmp/install_graylog_web
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l /tmp/install_graylog_web"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
    command finished in 945ms
  * 2013-07-11 01:02:24 executing `rubber:apache:install'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x007f2d81911800> -> /tmp/install_apache
    [production.foobar.com] /tmp/install_apache
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l /tmp/install_apache"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
 ** [out :: production.foobar.com] Site default disabled.
 ** [out :: production.foobar.com] To activate the new configuration, you need to run:
 ** [out :: production.foobar.com] service apache2 reload
    command finished in 636ms
  * 2013-07-11 01:02:25 executing `rubber:setup_volumes'
  * 2013-07-11 01:02:25 executing `rubber:setup_gem_sources'
    triggering before callbacks for `rubber:setup_gem_sources'
  * 2013-07-11 01:02:25 executing `rubber:base:install_ruby_build'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x007f2d81a7f750> -> /tmp/install_ruby_build
    [production.foobar.com] /tmp/install_ruby_build
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l /tmp/install_ruby_build"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
 ** [out :: production.foobar.com] Installing ruby-build v20130501
 ** [out :: production.foobar.com] Installed ruby-build at /usr/local
    command finished in 1475ms
    triggering after callbacks for `rubber:base:install_ruby_build'
  * 2013-07-11 01:02:27 executing `rubber:base:install_ruby'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x007f2d81aca638> -> /tmp/install_ruby
    [production.foobar.com] /tmp/install_ruby
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l /tmp/install_ruby"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
 ** [out :: production.foobar.com] Compiling and installing ruby 1.9.3.  This may take a while ...
    command finished in 1603ms
    triggering after callbacks for `rubber:base:install_ruby'
  * 2013-07-11 01:02:29 executing `rubber:install_gems'
    servers: ["production.foobar.com"]
 ** sftp upload #<StringIO:0x000000033d5920> -> /tmp/gem_helper
    [production.foobar.com] /tmp/gem_helper
    [production.foobar.com] done
  * sftp upload complete
  * executing "sudo -p 'sudo password: '  bash -l -c 'ruby /tmp/gem_helper install $CAPISTRANO:VAR$'"
    servers: ["production.foobar.com"]
    [production.foobar.com] executing command
 ** ruby: no such file to load -- ubygems (LoadError)
    command finished in 851ms

failed: "/bin/bash -l -c 'sudo -p '\\''sudo password: '\\''  bash -l -c '\\'' \
  ruby /tmp/gem_helper install open4 aws-s3 bundler rubber:2.5.2 \
  gelf graylog2_exceptions graylog2-resque pg fastthread rack \
  passenger:3.0.19 puma'\\'''" on production.foobar.com

/usr/local/rubies通过服务器上的ssh检查 Ruby 安装表明它尚未安装

这是在 freenode IRC #rubberec2上发布的,作为对我的问题的评论:

但是,我无法弄清楚如何将其应用于橡胶配置。

4

1 回答 1

0

如问题中所述,我生成了 Rubber 的配置文件,包括rubber-ruby.yml.

# config/rubber/rubber-ruby.yml
...
ruby_build_version: 20130501
ruby_version: 1.9.3
...

我用相同版本的 Rubber 重复了整个过程(我只是将版本修复为,2.5.2因为同时有更新)。这次我注意到ruby_version设置为1.9.3-p392如您在此处看到的那样。好像我不小心修改了这个设置?!

还原此更改,部署实际上按预期工作。

如前所述,同时发布了 Rubber 2.5.3,其中包含更新的设置

# config/rubber/rubber-ruby.yml
...
ruby_build_version: 20130628
ruby_version: 1.9.3-p448
...

我还为那些好奇的人尝试了新版本。它也有效。
非常感谢 Kevin Menard 和 Matt Conway 在项目的 IRC 频道中坚持回答我的问题。

于 2013-07-11T23:54:00.577 回答