在流浪者环境中摆脱mkdir命令的capistrano密码确认

时间:2017-04-07 18:39:23

标签: vagrant capistrano

我使用两个相同的流浪盒,用于测试capistrano部署过程。我可以成功地将应用程序从dev框部署到prod框。但是,我无法摆脱密码确认。

就我在输出中看到的情况而言,当部署过程尝试运行mkdir -p /capistrano/tmp时会发生确认,如下所示。

$ bundle exec cap production deploy --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)
** Invoke git:check (first_time)
** Invoke git:wrapper (first_time)
** Execute git:wrapper
00:00 git:wrapper
      01 mkdir -p /capistrano/tmp
vagrant@192.168.99.50's password:

prod服务器上的当前权限如下(我已按照scp: /tmp/git-ssh.sh: Permission denied所述手动授予777):

vagrant@prod:~$ ls -l /
drwxrwxrwx  3 vagrant vagrant  4096 Apr  7 16:30 capistrano

vagrant@prod:~$ ls -l /capistrano/
drwxrwxrwx 2 vagrant vagrant 4096 Apr  7 16:33 tmp

然后,当我输入密码时,它会在git-ssh-football-production-vagrant.sh路径下创建/capistrano/tmp/

vagrant@prod:~$ ls -l /capistrano/tmp/
-rwx------ 1 vagrant vagrant 93 Apr  7 16:33 git-ssh-football-production-vagrant.sh

我已删除/创建/使用了具有777权限的不同文件夹,但也尝试www-data,但无法取消密码确认。

deploy.rb

...
set :tmp_dir, "/capistrano/tmp"
set :user, "vagrant"
...

production.rb

role :app, %w{vagrant@192.168.99.50}
server '192.168.99.50', user: 'vagrant', roles: %w{app}

1 个答案:

答案 0 :(得分:0)

Found the solution. All I had to do was to add dev server's public key to prod server's authorized_keys with command below.

$ cat ~/.ssh/id_rsa.pub | ssh vagrant@192.168.99.40 'cat >> /home/vagrant/.ssh/authorized_keys'