Question

I set up a t1.micro instance on AWS. I was able to successfully run: RAILS_ENV=staging rubber:create_staging to create the server, deploy the code, and run the app. I made some changes to the code and want to deploy to my staging server but when I run this command: RAILS_ENV=staging cap deploy I get the following error:

 * 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

I haven't changed any of the default capistrano recipes and it the code was successfully deployed 1 time. I've been able to run "cap deploy" for my production site but not the staging site. I haven't been able to find anything in the Google group, any help would be appreciated.

Was it helpful?

Solution

You need to adapt your application.rb to include this:

if defined?(Bundler)
  Bundler.require(*Rails.groups(:assets => %w(development test), :profiling => %w[staging development]))
end

OTHER TIPS

This happens due to the high memory consumption while running "assets:precompile". Try to reboot your EC2 instance and run the deploy again, it will probably work. You can also change the instance type in order to enhance the memory of your instance and avoid this kinda issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top