質問

I've made a new Rails 3.2 application. When i deploy it with Capistrano, I get an error when compiling assets. But the assets ARE compiled, and the application deployed as it should.

On the server I've installed RVM systemwide and then created:

User: skolemapicture  (added to group rvm)
Deploy folder: /home/skolemapicture/site
.rvmrc in /home/skolemapicture/site/.rvmrc

My deploy.rb config looks like this (omitted lines that have nothing to do with the problem)

set :application, "skolemapicture"

set :deploy_to                  , "/home/skolemapicture/site"
set :user                       , "skolemapicture"
set :use_sudo                   , false
ssh_options[:forward_agent] = true

require "bundler/capistrano"
require "rvm/capistrano"

set(:ruby_version)      { '1.9.3' }
set(:rvm_ruby_string)   { "#{ruby_version}@#{application}" }
set(:rvm_path)          { "/usr/local/rvm" }
set(:rvm_type)          { :system }

namespace :deploy do
  task :precompile, :role => :app do
    run "cd #{release_path}/ && bundle exec rake assets:precompile"
  end
end
after "deploy:finalize_update", "deploy:precompile"

The error i get at "cap deploy" is:

  * 2013-02-13 10:36:21 executing `deploy:precompile'
  * executing "cd /home/skolemapicture/site/releases/20130213093619/ && bundle exec rake assets:precompile"
    servers: ["web01.mapicture.com"]
    [web01.mapicture.com] executing command
*** [err :: web01.mapicture.com] /usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby /home/skolemapicture/site/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
*** [err :: web01.mapicture.com] 

But the assets ARE compiled. So why this error?

/ Carsten

役に立ちましたか?

解決

It is probably actually precompiling the assets successfully with your custom deploy:precompile task.

It is failing on the capistrano default assets:precompile task.

You will notice that the failed command is

/usr/local/rvm/rubies/ruby-1.9.3-p374/bin/ruby /home/skolemapicture/site/shared/bundle/ruby/1.9.1/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets

not your custom precompile task:

cd #{release_path}/ && bundle exec rake assets:precompile

Try removing your deploy:precompile task and adding

load 'deploy/assets'

to your Capfile if it is not already there.

If that doesn't fix it can you post your entire Capfile and deploy.rb?

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top