我正在使用带有capistrano-rails 1.2.3的Rails 3.2并且我试图回滚部署并收到错误消息
% cap production deploy:rollback --trace
** Invoke production (first_time)
** Execute production
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke rbenv:validate (first_time)
** Execute rbenv:validate
** Invoke rbenv:map_bins (first_time)
** Invoke passenger:rbenv:hook (first_time)
** Invoke passenger:test_which_passenger (first_time)
** Execute passenger:test_which_passenger
** Execute passenger:rbenv:hook
** Execute rbenv:map_bins
** Invoke bundler:map_bins (first_time)
** Invoke passenger:bundler:hook (first_time)
** Execute passenger:bundler:hook
** Execute bundler:map_bins
** Invoke deploy:set_rails_env (first_time)
** Execute deploy:set_rails_env
** Invoke deploy:set_linked_dirs (first_time)
** Execute deploy:set_linked_dirs
** Invoke deploy:set_rails_env
** Invoke deploy:rollback (first_time)
** Execute deploy:rollback
** Invoke deploy:starting (first_time)
** Execute deploy:starting
** Invoke deploy:check (first_time)
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
01 mkdir -p /tmp
✔ 01 <user@domain> 0.009s
Uploading /tmp/git-ssh-project-production-map7.sh 100.0%
02 chmod 700 /tmp/git-ssh-project-production-map7.sh
✔ 02 <user@domain> 0.010s
** Execute git:check
00:00 git:check
01 git ls-remote map7@192.168.1.4:/home/map7/project/project.git HEAD
01 4a2c7dad823f02366a50b05a9211c8b619f7b332 HEAD
✔ 01 <user@domain> 0.130s
** Execute deploy:check
** Invoke deploy:check:directories (first_time)
** Execute deploy:check:directories
00:00 deploy:check:directories
01 mkdir -p /srv/project/shared /srv/project/releases
✔ 01 <user@domain> 0.008s
** Invoke deploy:check:linked_dirs (first_time)
** Execute deploy:check:linked_dirs
00:00 deploy:check:linked_dirs
01 mkdir -p /srv/project/shared/log /srv/project/shared/tmp/pids /srv/project/shared/tmp/cache /srv/project/shared/tmp/soc…
✔ 01 map7@project.com.au 0.009s
** Invoke deploy:check:make_linked_dirs (first_time)
** Execute deploy:check:make_linked_dirs
** Invoke deploy:check:linked_files (first_time)
** Execute deploy:check:linked_files
** Invoke deploy:set_previous_revision (first_time)
** Execute deploy:set_previous_revision
** Invoke deploy:started (first_time)
** Execute deploy:started
** Invoke deploy:reverting (first_time)
** Execute deploy:reverting
** Invoke deploy:revert_release (first_time)
** Invoke deploy:rollback_release_path (first_time)
** Execute deploy:rollback_release_path
** Execute deploy:revert_release
** Invoke deploy:reverted (first_time)
** Invoke bundler:install (first_time)
** Execute bundler:install
** Execute deploy:reverted
** Invoke deploy:rollback_assets (first_time)
** Invoke deploy:set_rails_env
** Execute deploy:rollback_assets
** Invoke deploy:assets:restore_manifest (first_time)
** Execute deploy:assets:restore_manifest
00:00 deploy:assets:restore_manifest
WARN Rails assets manifest file (or backup file) not found.
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as map7@project.com.au: Rails assets manifest file (or backup file) not found.
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
Capistrano::FileNotFound: Rails assets manifest file (or backup file) not found.
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/capistrano-rails-1.2.3/lib/capistrano/tasks/assets.rake:100:in `block (5 levels) in <top (required)>'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:85:in `within'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/capistrano-rails-1.2.3/lib/capistrano/tasks/assets.rake:91:in `block (4 levels) in <top (required)>'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:29:in `instance_exec'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/backends/abstract.rb:29:in `run'
/usr/local/rbenv/versions/2.3.5/lib/ruby/gems/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:assets:restore_manifest
~/project (master)%
如果我在capistrano文件中放置一个调试行,它会遇到类似的问题;
task :restore_manifest do
on release_roles(fetch(:assets_roles)) do
within release_path do
target = detect_manifest_path
source = release_path.join('assets_manifest_backup', File.basename(target))
byebug
if test "[[ -f #{source} && -f #{target} ]]"
execute :cp, source, target
else
msg = 'Rails assets manifest file (or backup file) not found.'
warn msg
fail Capistrano::FileNotFound, msg
end
end
end
end
我可以看到目标和来源设置为;
target = "/srv/project/releases/20180416033349/public/assets/.sprockets-manifest-e4509b1c8fd99ecba39ac6ce2282357a.json"
source = "/srv/project/releases/20180416033349/assets_manifest_backup/.sprockets-manifest-e4509b1c8fd99ecba39ac6ce2282357a.json"
如果我去查找源文件,它就不存在了。整个董事资产_manifest_backup不存在
更新
我正在部署这些命令;
cap production deploy;cap production deploy:cleanup_assets;cap production deploy:compile_assets
更新
我注意到我的一些部署有assets_manifest_backup目录,而有些则没有