2014-10-17 64 views
0

我使用Capistrano的3.2.1下面就我的Gemfile寶石:帽部署:檢查被卡住

gem 'capistrano' 
    gem 'capistrano-safe-deploy-to', '~> 1.1.1' 
    gem 'capistrano-rvm' 
    gem 'capistrano-unicorn-nginx', '~> 3.1.0' 
    gem 'capistrano-rails', '~> 1.1' 
    gem 'capistrano-bundler', '~> 1.1.2' 

在Capfile,我有以下幾點:

require 'capistrano/setup' 
require 'capistrano/deploy' 

# Includes tasks from other gems included in your Gemfile 
# 
# For documentation on these, see for example: 
# 
# https://github.com/capistrano/rvm 
# https://github.com/capistrano/rbenv 
# https://github.com/capistrano/chruby 
# https://github.com/capistrano/bundler 
# https://github.com/capistrano/rails 
# 

require 'capistrano/rvm' 
require 'capistrano/bundler' 
require 'capistrano/rails' 
require 'capistrano/unicorn_nginx' 
require 'capistrano/safe_deploy_to' 
# require 'capistrano/secrets_yml' 
# require 'capistrano/rails/assets' 
# require 'capistrano/rails/migrations' 

# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. 
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r } 

在部署.RB我有以下幾點:

# config valid only for Capistrano 3.1 
lock '3.2.1' 

set :application, 'MyAoo' 
# set :repo_url, 'MyRepoURL' 

# Default branch is :master 
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call 
# set :branch, 'master' 

# Default deploy_to directory is /var/www/my_app 
# set :deploy_to, 'project' 

# No need to clone entire repo each time 
# set :deploy_via, :remote_cache 

# Default value for :scm is :git 
# set :scm, :git 

# Default value for :format is :pretty 
# set :format, :pretty 

# Default value for :log_level is :debug 
# set :log_level, :info 

# Default value for :pty is false 
set :pty, true 

# TODO check this 
# set :forward_agent, true 

# Sudo permissions not required 
set :use_sudo, false 

# Default value for :linked_files is [] 
# set :linked_files, %w{ config/database.yml } 

# Default value for linked_dirs is [] 
# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} 

# Default value for default_env is {} 
# set :default_env, { path: "/opt/ruby/bin:$PATH" } 

# Default value for keep_releases is 5 
set :keep_releases, 3 

# set :rvm_type, :user      # Defaults to: :auto 
# set :rvm_custom_path, '~/.myveryownrvm' # only needed if not detected 

# Set ruby version on the server. 
set :rvm_ruby_version, '2.1.2'  # Defaults to: 'default' 
set :rvm_roles, [:app, :web] 

現在,當我運行$帽生產safe_deploy_to:保證我的地方,我得到了下面的情況:

$ cap production safe_deploy_to:ensure 
DEBUG[7b638604] Running /usr/bin/env [ -d ~/.rvm ] on ABC.DEF.GHI.JK 
DEBUG[7b638604] Command: [ -d ~/.rvm ] 
DEBUG[7b638604] Finished in 0.738 seconds with exit status 1 (failed). 
DEBUG[45e6ecbb] Running /usr/bin/env [ -d /usr/local/rvm ] on 104.131.110.30 
DEBUG[45e6ecbb] Command: [ -d /usr/local/rvm ] 
DEBUG[45e6ecbb] Finished in 0.042 seconds with exit status 0 (successful). 
DEBUG[d7085818] Running /usr/local/rvm/bin/rvm version on 104.131.110.30 
DEBUG[d7085818] Command: /usr/local/rvm/bin/rvm version 
DEBUG[d7085818]  rvm 1.25.33 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 
DEBUG[d7085818]  
DEBUG[d7085818] Finished in 0.264 seconds with exit status 0 (successful). 
rvm 1.25.33 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [https://rvm.io/] 
DEBUG[7d96ffdc] Running /usr/local/rvm/bin/rvm current on 104.131.110.30 
DEBUG[7d96ffdc] Command: /usr/local/rvm/bin/rvm current 
DEBUG[7d96ffdc]  ruby-2.1.2 
DEBUG[7d96ffdc]  
DEBUG[7d96ffdc] Finished in 0.257 seconds with exit status 0 (successful). 
ruby-2.1.2 
DEBUG[caa8eec2] Running /usr/local/rvm/bin/rvm 2.1.2 do ruby --version on 104.131.110.30 
DEBUG[caa8eec2] Command: /usr/local/rvm/bin/rvm 2.1.2 do ruby --version 
DEBUG[caa8eec2]  ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] 
DEBUG[caa8eec2]  
DEBUG[caa8eec2] Finished in 0.454 seconds with exit status 0 (successful). 
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] 
INFO[68eea9b0] Running /usr/bin/env sudo mkdir -pv /var/www/myapp on 104.131.110.30 
DEBUG[68eea9b0] Command: /usr/bin/env sudo mkdir -pv /var/www/myapp 
DEBUG[68eea9b0]  [sudo] password for marvin: 

它仍然卡在那裏,沒有辦法將密碼或任何東西放入提示。我無法理解爲什麼當我向部署者授予sudo特權時要求輸入密碼?

我錯過了什麼?

回答

2

我是capistrano-safe-deploy-to插件的創建者。看起來這個插件有問題,因爲任務被卡住在這個命令/usr/bin/env sudo mkdir -pv /var/www/myapp

我可以建議重新運行Capistrano的命令刪除(或註釋掉)這些選項deploy.rb

  • 集:PTY,真正
  • 集:use_sudo,假

事情應該適用於上述2個選項的默認值,無需重寫它們。

如果您仍然有問題,請爲capistrano-safe-deploy-to插件打開問題,我會盡力提供幫助。

+0

這是一個特權問題。您在Github上的回覆正確地引導了我,謝謝! – marvindanig 2014-10-18 00:44:09