我正在运行cap production deploy:setup_config
我得到以下输出:
DEBUG[659d52b0] Running /usr/bin/env [ ! -d /home/deployer/.rbenv/versions/2.1.2 ] on xxx.xxx.xxx.xxx
DEBUG[659d52b0] Command: [ ! -d /home/deployer/.rbenv/versions/2.1.2 ]
DEBUG[659d52b0] Finished in 2.413 seconds with exit status 1 (failed).
DEBUG[2ea020b0] Running /usr/bin/env [ -f /etc/nginx/sites-enabled/default ] on xxx.xxx.xxx.xxx
DEBUG[2ea020b0] Command: [ -f /etc/nginx/sites-enabled/default ]
DEBUG[2ea020b0] Finished in 0.507 seconds with exit status 1 (failed).
No default Nginx Virtualhost to remove
INFO[e0a045fc] Running /usr/bin/env mkdir -p /home/deployer/apps/managewise_production/shared/config on xxx.xxx.xxx.xxx
DEBUG[e0a045fc] Command: ( RBENV_ROOT=/home/deployer/.rbenv RBENV_VERSION=2.1.2 /usr/bin/env mkdir -p /home/deployer/apps/managewise_production/shared/config )
INFO[e0a045fc] Finished in 0.405 seconds with exit status 0 (successful).
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/nginx.conf 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/nginx.conf 100.0%
INFOcopying: #<StringIO:0x007fad45824cc8> to: /home/deployer/apps/managewise_production/shared/config/nginx.conf
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/database.example.yml 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/database.example.yml 100.0%
INFOcopying: #<StringIO:0x007fad448839e0> to: /home/deployer/apps/managewise_production/shared/config/database.example.yml
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/log_rotation 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/log_rotation 100.0%
INFOcopying: #<StringIO:0x007fad4413b2f0> to: /home/deployer/apps/managewise_production/shared/config/log_rotation
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/monit 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/monit 100.0%
INFOcopying: #<StringIO:0x007fad46816898> to: /home/deployer/apps/managewise_production/shared/config/monit
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/unicorn.rb 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/unicorn.rb 100.0%
INFOcopying: #<StringIO:0x007fad46ab7a20> to: /home/deployer/apps/managewise_production/shared/config/unicorn.rb
DEBUGUploading /home/deployer/apps/managewise_production/shared/config/unicorn_init.sh 0.0%
INFOUploading /home/deployer/apps/managewise_production/shared/config/unicorn_init.sh 100.0%
INFOcopying: #<StringIO:0x007fad46a4f7e0> to: /home/deployer/apps/managewise_production/shared/config/unicorn_init.sh
INFO[a1c87854] Running /usr/bin/env chmod +x /home/deployer/apps/managewise_production/shared/config/unicorn_init.sh on xxx.xxx.xxx.xxx
DEBUG[a1c87854] Command: ( RBENV_ROOT=/home/deployer/.rbenv RBENV_VERSION=2.1.2 /usr/bin/env chmod +x /home/deployer/apps/managewise_production/shared/config/unicorn_init.sh )
INFO[a1c87854] Finished in 0.483 seconds with exit status 0 (successful).
INFO[30551413] Running /usr/bin/env whoami && echo ${PATH} on xxx.xxx.xxx.xxx
DEBUG[30551413] Command: whoami && echo ${PATH}
INFO[30551413] Finished in 0.552 seconds with exit status 0 (successful).
DEBUG[30551413] deployer
DEBUG[30551413] /home/deployer/.rbenv/shims:/home/deployer/.rbenv/bin:/usr/local/bin:/bin:/usr/bin:/home/deployer/bin
INFO[30551413] Finished in 0.552 seconds with exit status 0 (successful).
INFO[60b61747] Running /usr/bin/env sudo ln -nfs /home/deployer/apps/managewise_production/shared/config/nginx.conf /etc/nginx/sites-enabled/ on xxx.xxx.xxx.xxx
DEBUG[60b61747] Command: ( RBENV_ROOT=/home/deployer/.rbenv RBENV_VERSION=2.1.2 /usr/bin/env sudo ln -nfs /home/deployer/apps/managewise_production/shared/config/nginx.conf /etc/nginx/sites-enabled/ )
DEBUG[60b61747] [sudo] password for deployer:
现在我输入密码。它显示密码,它甚至没有工作。
任务如下:lib/capistano/tasks/setup_config.cap
namespace :deploy do
task :setup_config do
on roles(:app) do
# make the config dir
execute :mkdir, "-p #{shared_path}/config"
full_app_name = fetch(:full_app_name)
# config files to be uploaded to shared/config, see the
# definition of smart_template for details of operation.
# Essentially looks for #{filename}.erb in deploy/#{full_app_name}/
# and if it isn't there, falls back to deploy/#{shared}. Generally
# everything should be in deploy/shared with params which differ
# set in the stage files
config_files = fetch(:config_files)
config_files.each do |file|
smart_template file
end
# which of the above files should be marked as executable
executable_files = fetch(:executable_config_files)
executable_files.each do |file|
execute :chmod, "+x #{shared_path}/config/#{file}"
end
# symlink stuff which should be... symlinked
symlinks = fetch(:symlinks)
symlinks.each do |symlink|
execute "whoami && echo ${PATH}"
sudo "ln -nfs #{shared_path}/config/#{symlink[:source]} # sub_strings(symlink[:link])}"
end
end
end
end
在deploy.rb中,我有以下关于ssh的内容:
set :pty, true
set :ssh_options, { forward_agent: true, :keys => %w(/home/SMD/.ssh/id_rsa)}
set :use_sudo, false
set :default_shell, '/bin/bash --login'
我无法弄清问题是什么。 我也担心失败的代码。 ==&GT;
DEBUG[659d52b0] Command: [ ! -d /home/deployer/.rbenv/versions/2.1.2 ]
DEBUG[659d52b0] Finished in 2.413 seconds with exit status 1 (failed).
提前致谢。
答案 0 :(得分:-1)
尝试将类似的内容添加到deploy.rb文件(或相应的部署环境文件)
set :password, ask('Server password', nil)
server 'xxx.xxx.xx.xx', user: 'root', port: 22, password: fetch(:password), roles: %w{web app db}, primary: true