0

我在 AWS 上设置了一个 t1.micro 实例。我能够成功运行: RAILS_ENV=staging rubber:create_staging创建服务器、部署代码并运行应用程序。我对代码进行了一些更改,并希望部署到我的登台服务器,但是当我运行此命令时: RAILS_ENV=staging cap deploy 我收到以下错误:

 * executing "cd -- /mnt/domain-staging/releases/20130321005928 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile && cp -- /mnt/domain-staging/shared/assets/manifest.yml /mnt/domain-staging/releases/20130321005928/assets_manifest.yml"
    servers: ["staging.domain.com"]
    [staging.domain.com] executing command
 * [out :: staging.domain.com] /usr/local/rubies/1.9.3-p385/bin/ruby /mnt/domain-staging/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:nondigest RAILS_ENV=staging RAILS_GROUPS=assets
 * [out :: staging.domain.com]
 * [out :: staging.domain.com] rake aborted!
 * [out :: staging.domain.com] Command failed with status (): [/usr/local/rubies/1.9.3-p385/bin/ruby /mnt...]
 * [out :: staging.domain.com] /mnt/domain-staging/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:9:in `ruby_rake_task'
 * [out :: staging.domain.com] /mnt/domain-staging/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:62:in `block (3 levels) in <top (required)>'
 * [out :: staging.domain.com] /mnt/domain-staging/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:19:in `invoke_or_reboot_rake_task'
 * [out :: staging.domain.com] /mnt/domain-staging/shared/bundle/ruby/1.9.1/gems/actionpack-3.1.3/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
 * [out :: staging.domain.com] Tasks: TOP => assets:precompile:all
 * [out :: staging.domain.com] (See full trace by running task with --trace)
    command finished in 223523ms
failed: "/bin/bash -l -c 'cd -- /mnt/domain-staging/releases/20130321005928 && bundle exec rake RAILS_ENV=staging RAILS_GROUPS=assets assets:precompile && cp -- /mnt/domain-staging/shared/assets/manifest.yml /mnt/domain-staging/releases/20130321005928/assets_manifest.yml'" on staging.domain.com

我没有更改任何默认的 capistrano 配方,并且代码已成功部署 1 次。我已经能够为我的生产站点而不是暂存站点运行“cap deploy”。我无法在 Google 组中找到任何内容,我们将不胜感激。

4

2 回答 2

2

您需要调整您的 application.rb 以包含以下内容:

if defined?(Bundler)
  Bundler.require(*Rails.groups(:assets => %w(development test), :profiling => %w[staging development]))
end
于 2013-03-21T03:43:54.323 回答
2

这是由于运行“assets:precompile”时的高内存消耗造成的。尝试重新启动您的 EC2 实例并再次运行部署,它可能会工作。您还可以更改实例类型以增强实例的内存并避免此类问题。

于 2013-05-16T15:46:25.110 回答