2012-05-25 3 views
1

적어도 그것은 카피 스트라 노가 실패한 것처럼 보입니다. 배포를 통해 끝까지 만듭니다. 여기 출력됩니다.배포시에 Capistrano가 실패하는 것을 방지하려면 어떻게해야합니까? create_symlink?

* 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 

앱에서 카피 스트라 노를 사용한다 (2.12.0) 카피 스트라 노-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 

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] 

내가 직접 만드는 staging.rb 인 '현재'의 배포 디렉토리에서 '공유'와 '릴리스'폴더와 적절한 사용자 : 그룹을 지정하십시오. 원래 dirs에 대한 사용 권한 문제를 얻고 있었지만이를 정리했습니다. 여기서 약간의 손실을 입었습니다. 솔루션을 많이 찾는 것은 아직까지는 아무 것도 모릅니다. 여기에 어떤 제안이나 경험을 많이 주시면 감사하겠습니다!

테스트 중 cap staging deploy 나는 동시에 생산을 시도 할 것이라고 생각했는데 ... cap production deploy 동시에 베일을 벗기십시오. 일관성에 대해 뭔가 영리합니다.

+0

해결 방법을 직접 찾으면 여기에 답변으로 게시하고 동의 할 수 있습니다. – ZelluX

답변

6

업데이트 : 그것을 발견

'현재'디렉토리를 삭제하고 카피 스트라 노 그것을 해결 최신 버전의 '현재'심볼릭 링크를 생성시키는.

나는 그것을 약간 지우려고 노력할 것이다. 나는 실제로 'current'와 같은 폴더를 생성하고 있었고, 'mkdir current'처럼. 심포지엄을 만드는 카피 스트라 노의 길을 막 알게됩니다. 'bob'이라는 폴더를 만들고 같은 디렉토리에서 'bob'이라는 심볼릭 링크를 만들고 'bob'디렉토리에 symlink 'bob'을 넣을 위치를 가리 키십시오.

'현재' '공유'등의 디렉토리를 제거하면 capistrano가 '현재'및 기타 필요한 심볼릭 링크를 만들 수 있습니다. 따라서 '현재'디렉토리를 제거하면 capistrano가 '릴리스'디렉토리 아래에서 최신 배포를 가리키는 '현재'심볼릭 링크를 만들 수 있습니다.

아래 오류에 유의하십시오.

** [out :: test.xxx.xx.xx] rm: cannot remove `/var/www/vhosts/xxx.xx.xx/test/current': I command finished in 460ms 

실패한 이유. 'current'라는 폴더를 만들었습니다. 이게 문제 야. 그것은 디렉토리가되어서는 안되며, 카피 스트라 노가 만드는 심볼릭 링크가되어야합니다.

이러한 폴더를 생성하면 배포가 중단됩니다. 이 폴더를 제거하면 capistrano가 동일한 이름의 심볼릭 링크를 만들 수있었습니다. 그 이후로 매끄러운 항해.

+0

나는 당신을 이해하지 못한다. 솔루션 :(. 나는 비슷한 문제를 겪고있다. – Will

+0

@ 나는 대답을 업데이트했다. 희망을 갖고 내가 설명하려고했던 것에 약간의 명확성을 더한다. – DetDev

+0

당신의 해결책을 이해하지 못했다. .. –

0

방금 ​​비슷한 문제를 추적했습니다.여기

은 내가 가진 오류가 첫 번째 오류입니다 :

cap aborted! Errno::ECONNREFUSED: Connection refused - connect(2) for "{my-ip-address}" port {my-ssh-port}

나는이 유사한 오류 얻을 것이다 : 그것은 같은 동시 SSH 세션에 문제가 있었다 밝혀

Tasks: TOP => git:create_release (See full trace by running task with --trace) The deploy has failed with an error: #<Errno::ECONNREFUSED: Connection refused - connect(2) for "my-ip-address" port {my-port}>

을 내 서버가 Fail2Ban을 실행합니다.

편집 SSH 구성을 [SSH]와 세트 = 거짓 찾을 [SSH-DDOS] 및 활성화 세트 = 거짓

을 활성화하기위한

$ sudo nano /etc/fail2ban/jail.local 

모양을 포함 감옥 : 나는 단순히 다음했다는 것을 해결하기 (그게 전부는 당신이 무엇을 사용하는 경우)

는 접속 .. 것을주의

$ sudo service fail2ban reload 
$ sudo /etc/init.d/ssh reload 

그것의 가치 변경 및 오픈 SSH 후 Fail2Ban를 다시 시작하는 것을 잊지 마십시오 on은 배포의 여러 단계 (작업)에서 거부됩니다. 예를 들어 재부팅 후 빠른 bundle exec cap production deploy:check이 모두 정상적으로 나타났습니다. 그런 다음 배포를 시도하고 같은 오류가 발생했지만 다른 작업을 실행하는 동안. 또한 UFW를 사용하여 문제없이 다시 사용하도록 설정하고 다시 사용하도록 설정했습니다. UFW는 위의 문제의 원인이 아니 었습니다.

내가이 문제를 해결 한 후 카피스트라 노드는 현재 디렉토리에서 최신 릴리스로의 심볼릭 링크를 만들지 못합니다. 이 오류는 다음과 같습니다 : 내 문서 루트를 탐색하고 나는 current 디렉토리 것을 발견 ls -la 디렉토리 내용을 나열

Tasks: TOP => deploy:symlink:release The deploy has failed with an error: #<SSHKit::Command::Failed: rm exit status: 1 rm stdout: Nothing written rm stderr: Nothing written > ** Invoke deploy:failed (first_time) ** Execute deploy:failed

등 보석을 제거, 광범위하게 독서 sshkit 버전을 변경, 카피 스트라 노 다운 그레이드 후 배포 사용자 그룹이 아니라 현재 폴더 (sudo rm -rf current)를 삭제했으며 모든 것이 잘 작동했습니다. 행운을 빕니다.

관련 문제