至少这就是 capistrano 失败的地方。它在部署过程中一直到最后。这是输出。
* executing `deploy:create_symlink'
* executing "rm -f ~/xxx.xx.xx/test/current && ln -s ~/xxx.xx.xx/test/releases/20120525193307 ~/xxx.xx.xx/test/current"
servers: ["test.xxx.xx.xx"]
["test.xxx.xx.xx"] executing command
** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms
*** [deploy:create_symlink] rolling back
*** no previous release to rollback to, rollback of symlink skipped
* executing "rm -rf /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909; true"
servers: ["test.xxx.xx.xx"]
[test.xxx.xx.xx] executing command
command finished in 524ms
failed: "rvm_path=$HOME/.rvm/ $HOME/.rvm/bin/rvm-shell 'default' -c 'rm -f /var/www/vhosts/xxx.xx.xx/test/current && ln -s /var/www/vhosts/xxx.xx.xx/test/releases/20120525195909 /var/www/vhosts/xxx.xx.xx/test/current'" on xxx.xx.xx
该应用程序正在使用 capistrano (2.12.0) capistrano-ext (1.2.1) 显然有更多的宝石只是试图放置看起来相关的东西,如果更多信息会有所帮助,请告诉我。
这是deploy.rb
require "rvm/capistrano"
require 'bundler/capistrano'
require 'capistrano/ext/multistage'
set :stages, %w(staging production)
set :default_stage, 'staging'
set :application, 'xxx'
# trying to not use sudo on the deployment
#set :use_sudo, false
#set :copy_exclude, [".git", "spec"]
set :repository, '~/git/xxx.git'
set :local_repository, "~/rorwork/xxx/.git"
set :scm, :git
set :user, 'xxx'
set :group, 'xxxx'
ssh_options[:forward_agent] = true
set :branch, 'master'
set :deploy_via, :remote_cache
set :scm_command, "/usr/local/bin/git"
set :local_scm_command, :default
default_run_options[:pty] = true
set :normalize_asset_timestamps, false #for asset piple
set :dbuser, 'xxx'
set :dbpass, 'xxx'
# if you want to clean up old releases on each deploy uncomment this:
# after "deploy:restart", "deploy:cleanup"
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# 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
和 staging.rb
set :domain, 'test.xxx.xx.xx'
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 :deploy_to, "/var/www/vhosts/xxx.xx.xx/test"
set :rails_env, 'staging'
set :rack_env, rails_env
set :dbname, "xxx_staging"
#set :bundle_without, [:test, :development, :production]
我在部署目录中手动创建“当前”、“共享”和“发布”文件夹并分配适当的用户:组。最初是在 dirs 上获得权限问题,但已经解决了。在这里有点不知所措,许多寻找解决方案的方法目前还没有得到任何结果。非常感谢这里的任何建议或经验!
在测试中,cap staging deploy
我想我会同时尝试生产以及cap production deploy
保释……关于一致性的一些聪明的事情。