2012-03-05 6 views
2

capistranoでデプロイすると、capistranoがアセットを実行しようとするとエラーが発生し、ロールバックされます:プリコンパイル。プリコンパイルを、それが正常に実行/ webappsに/ myappに/電流から:私は熊手資産を実行する場合rails/capistrano - アセットをコンパイル中にエラーが発生する

私はレール3.2.1、バンドラ1.0.22、カピストラーノ2.11.2

を使用しています。

エラー:

failed: "sh -c 'cd /webapps/myapp/releases/20120304160347 && bundle exec rake RAILS_ENV=production RAILS_GROUPS=assets assets:precompile'" 

deploy.rbが

require "bundler/capistrano" 
load 'deploy/assets' 
set :application, "myapp" 
set :domain, '24.17.71.95' 
set :repository, "." 
set :deploy_via, :copy 
set :local_repository, '/home/me/myapp/.git' 
set :deploy_to, '/webapps/myapp/' 
set :scm, :none #:git 
set :user, 'me' 
set :password, 'me$pw' 
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` 
default_run_options[:pty] = true 
role :web, domain      # Your HTTP server, Apache/etc 
role :app, domain       # This may be the same as your `Web` server 
role :db, domain, :primary => true # This is where Rails migrations will run 
set :branch, 'master' 
# if you're still using the script/reaper helper you will need 
# these http://github.com/rails/irs_process_scripts 
before "deploy:assets:precompile", "bundle:install" 
# If you are using Passenger mod_rails uncomment this: 
namespace :deploy do 
    task :start do ; end 
    task :stop do ; end 
    task :restart, :roles => :app, :except => { :no_release => true } do 
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" 
    end 
end 
+0

でアドバイスをしてみてください。 – Brad

+0

、わずか1〜2分かかります。 –

+0

サーバにsshで接続し、cd/webapps/myapp/current && bundle exec rakeを実行するとどうなりますか?RAILS_ENV = production RAILS_GROUPS = assets assets:precompile? –

答えて

1

私の知る限りでは、タスクをプリコンパイル資産がbeeingている最後の(または1つであっても、最後の)課題の一つでなければなりません実行される。

だから、(あなたのRailsアプリのルートフォルダ)Capfileにdeploy.rbのうち

load 'deploy/assets' 

を移動しようと、ファイルの最後の行としてそれを貼り付けてください。

+0

私はそれは良い考えだとは思わない。デプロイメントを呼びかけているタスク(そのため、deploy.rbに属しています)で、Capistrano関連の設定ではありません(Capfileに入れるときです)。 –

+0

これは私のソースのどれにもレーキが見つからなかったのと同じような問題を解決するために働いた。なぜこれは機能しますか? – biagidp