当我使用capistrano部署时,当capistrano尝试运行资产时,我会收到错误(和回滚):预编译。
我正在使用rails 3.2.1,bundler 1.0.22,capistrano 2.11.2
如果我运行rake资产:从/ webapps / myapp / current预编译它会成功运行。
错误:
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 :(得分:1)
据我所知,资产预编译任务应该是执行的最后一个(甚至是最后一个)任务之一。
所以请尝试移动
load 'deploy/assets'
将deploy.rb从Capfile(你的Rails应用程序的根文件夹)中删除并粘贴到文件的最后一行。
答案 1 :(得分:0)