2014-09-28 70 views
7

执行我试图部署具有Capistrano的3代码从Git仓库Ubuntu的服务器,但我发现了这个错误。帽子流产了! SSHKit ::亚军:: ExecuteError:异常,而在主机

============================================== ============================
这是我的Gemfile。

gem 'capistrano', '~> 3.1.0' 

#//Use unicorn as the app server 
gem 'unicorn' 

#// Use Capistrano for deployment 
group :development do 
gem 'capistrano-rails' 
gem 'capistrano-bundler' 
gem 'capistrano-rbenv', "~> 2.0" 
end 

source 'https://rubygems.org' 

=========================================== =============================== #deploy.rb

lock '3.1.0' 

#// Define the name of the application 
set :application, 'my_app' 

#// Define where can Capistrano access the source repository 
#// set :repo_url, 'https://github.com/[user name]/[application name].git' 
set :scm, :git 
set :repo_url, '[email protected]:jaipratik/rw.git' 

set :use_sudo, true 

set :log_level, :debug 

#// Define where to put your application code 
set :deploy_to, "/var/www/my_app" 

set :pty, true 

set :format, :pretty 

======= ================================================== ================= #// production.rb

role :app, %w{[email protected]{IP/Host}} 

server '{IP/Host}', user: 'ubuntu', roles: %w{web app} 

set :ssh_options, { 
keys: %w(/Users/jay/.ssh/id_rsa), 
forward_agent: false, 
user: 'user' 
# auth_methods: %w(password) 
} 

=================== ================================================== ===== 结果为$束EXEC帽生产部署--trace

** Invoke production (first_time) 
** Execute production 
** Invoke load:defaults (first_time) 
** Execute load:defaults 
** Invoke deploy (first_time) 
** Execute deploy 
** Invoke deploy:starting (first_time) 
** Execute deploy:starting 
** Invoke deploy:check (first_time) 
** Execute deploy:check 
** Invoke git:check (first_time) 
** Invoke git:wrapper (first_time) 
** Execute git:wrapper 
INFO[f8299d4f] Running /usr/bin/env mkdir -p /tmp/my_app/ on {IP/Host} 
DEBUG[f8299d4f] Command: /usr/bin/env mkdir -p /tmp/my_app/ 
INFO[f8299d4f] Finished in 0.723 seconds with exit status 0 (successful). 
DEBUGUploading /tmp/my_app/git-ssh.sh 0.0% 
INFOUploading /tmp/my_app/git-ssh.sh 100.0% 
INFO[b509dfb7] Running /usr/bin/env chmod +x /tmp/my_app/git-ssh.sh on {IP/Host} 
DEBUG[b509dfb7] Command: /usr/bin/env chmod +x /tmp/my_app/git-ssh.sh 
INFO[b509dfb7] Finished in 0.084 seconds with exit status 0 (successful). 
** Execute git:check 
DEBUG[9646aea0] Running /usr/bin/env git ls-remote [email protected]:jaipratik/rw.git on {IP/Host} 
DEBUG[9646aea0] Command: (GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/my_app/git-ssh.sh /usr/bin/env git ls-remote [email protected]:jaipratik/rw.git) 
DEBUG[9646aea0] c452c845bb80f72d3023557d2ea8f776950c659f 
DEBUG[9646aea0] 
DEBUG[9646aea0] HEAD 
DEBUG[9646aea0] 
DEBUG[9646aea0] c452c845bb80f72d3023557d2ea8f776950c659f 
DEBUG[9646aea0] 
DEBUG[9646aea0] refs/heads/master 
DEBUG[9646aea0] 
DEBUG[9646aea0] Finished in 0.940 seconds with exit status 0 (successful). 
** Invoke deploy:check:directories (first_time) 
** Execute deploy:check:directories 
INFO[fa4b1f56] Running /usr/bin/env mkdir -pv /var/www/my_app/shared /var/www/my_app/releases on {IP/Host} 
DEBUG[fa4b1f56] Command: /usr/bin/env mkdir -pv /var/www/my_app/shared /var/www/my_app/releases 
INFO[fa4b1f56] Finished in 0.086 seconds with exit status 0 (successful). 
** Invoke deploy:check:linked_dirs (first_time) 
** Execute deploy:check:linked_dirs 
** 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:started (first_time) 
** Execute deploy:started 
** Invoke deploy:updating (first_time) 
** Invoke deploy:new_release_path (first_time) 
** Execute deploy:new_release_path 
** Execute deploy:updating 
** Invoke git:create_release (first_time) 
** Invoke git:update (first_time) 
** Invoke git:clone (first_time) 
** Invoke git:wrapper 
** Execute git:clone 
DEBUG[fa77f295] Running /usr/bin/env [ -f /var/www/my_app/repo/HEAD ] on {IP/Host} 
DEBUG[fa77f295] Command: [ -f /var/www/my_app/repo/HEAD ] 
DEBUG[fa77f295] Finished in 0.081 seconds with exit status 1 (failed). 
DEBUG[0cc407cc] Running /usr/bin/env if test ! -d /var/www/my_app; then echo "Directory does not exist '/var/www/my_app'" 1>&2; false; fi on {IP/Host} 
DEBUG[0cc407cc] Command: if test ! -d /var/www/my_app; then echo "Directory does not exist '/var/www/my_app'" 1>&2; false; fi 
DEBUG[0cc407cc] Finished in 0.075 seconds with exit status 0 (successful). 
INFO[de52ca0e] Running /usr/bin/env git clone --mirror [email protected]:jaipratik/rw.git /var/www/my_app/repo on {IP/Host}`enter code here` 
DEBUG[de52ca0e] Command: cd /var/www/my_app && (GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/my_app/git-ssh.sh /usr/bin/env git clone --mirror [email protected]:jaipratik/rw.git /var/www/my_app/repo) 
cap aborted! 
SSHKit::Runner::ExecuteError: Exception while executing on host {IP/Host}: git exit status: 1 
git stdout: Nothing written 
git stderr: Nothing written 
/Users/jay/.rvm/gems/ruby-2.1.0/gems/sshkit-1.5.1/ 
+0

如果我更改目标文件夹##设置此得到解决:deploy_to, “/家庭/ Ubuntu的/ tempsite”。仍然想知道为什么它不能在原来的位置工作? – 2014-09-29 00:55:56

回答

3

Capistrano的WASN无法在ec2上创建文件夹。一旦我创建了它的文件夹就像一个魅力。

所以,如果你也有类似的问题,尝试创建在EC2上的文件夹,然后执行帽生产部署。

+0

嗨JP,我们应该从哪里创建文件夹? – 2017-10-17 05:26:49

+0

无论你喜欢,但只要确保该位置的权限是好的,以便当你在该文件夹上打电话时,它工作正常。 – 2017-10-17 20:02:29

2

那么,在远程机器/var/www/my_app的权限?确保他们是由你在这个配置选项指定的同一用户拥有:

set :user, "mydeployuser" 

如果不相信你正在使用运行在客户机上的“帽子”命令Capistrano的默认用户。请确保它有权修改/创建/var/www/my_app

既然你:

set :use_sudo, true 

它可能是须藤可能没有设置为无密码须藤像建议在第3章docs

+0

如何在不允许的情况下使用sudo? – 2014-09-29 07:48:45

+0

我想你可能没有无密码的sudo设置,并且cap默认为登录用户。 – Rico 2014-09-29 14:59:24

+0

我认为你是对的我使用EC2,我从来没有把sudo密码,所以最新的解决方案? – 2014-09-29 15:39:29

相关问题