我正在努力将capistrano v2升级到v3 5天。我试图从本地机器部署到ec2实例开发环境。我无法继续前进。我的痕迹在这里capistrano版本3升级困惑
$帽开发部署:检查
INFO [429e612c] Running /usr/bin/env mkdir -p /tmp/my_app_name/ on 70.22.320.14
DEBUG [429e612c] Command: (RVM_BIN_PATH=~/.rvm/bin /usr/bin/env mkdir -p /tmp/my_app_name/)
INFO [429e612c] Finished in 6.208 seconds with exit status 0 (successful).
DEBUG Uploading /tmp/my_app_name/git-ssh.sh 0.0%
INFO Uploading /tmp/my_app_name/git-ssh.sh 100.0%
INFO [c3a41f2e] Running /usr/bin/env chmod +x /tmp/my_app_name/git-ssh.sh on 70.22.320.14
DEBUG [c3a41f2e] Command: (RVM_BIN_PATH=~/.rvm/bin /usr/bin/env chmod +x /tmp/my_app_name/git-ssh.sh)
INFO [c3a41f2e] Finished in 0.720 seconds with exit status 0 (successful).
DEBUG [c5891dcc] Running /usr/bin/env git ls-remote [email protected]:example/webapp.git
on 70.22.320.14
DEBUG [c5891dcc] Command: (RVM_BIN_PATH=~/.rvm/bin GIT_ASKPASS=/bin/echo GIT_SSH=/tmp/my_app_name/git-ssh.sh /usr/bin/env git ls-remote [email protected]:example/webapp.git
DEBUG [c5891dcc] /usr/bin/env:
DEBUG [c5891dcc] git
DEBUG [c5891dcc] : No such file or directory
DEBUG [c5891dcc]
DEBUG [c5891dcc] Finished in 0.664 seconds with exit status 127 (failed).
配置/ deploy.rb
set :application, 'my_app_name'
set :repo_url, '.'
set :branch, 'master'
set :scm, :git
set :deploy_to, "/home/ec2-user/capistrano-3/}"
set :ssh_options, {:keys => ["#{ENV['HOME']}/.ssh/my_pem.pem"], :forward_agent =>true}
set :keep_releases, 5
set :rvm_type, :user
set :rvm_ruby_version, '2.0.0-p353'
set :default_env, { rvm_bin_path: '~/.rvm/bin' }
set :whenever_command, "bundle exec whenever"
set :git_shallow_clone, 1
set :deploy_via, :copy
set :log_level, :debug
set :pty, true
set :linked_files, %w{config/database.yml}
SSHKit.config.command_map[:rake] = "bundle exec rake"
SSHKit.config.command_map[:rails] = "bundle exec rails"
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
# Your restart mechanism here, for example:
# execute :touch, release_path.join('tmp/restart.txt')
end
end
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
after :finishing, 'deploy:cleanup'
end
配置/部署/ development.rb
set :stage, :development
role :app, %w{[email protected]}
role :web, %w{[email protected]}
role :db, %w{[email protected]}
role :all, %w{[email protected]}
server 'ec2-user[email protected]', user: 'ec2-user', roles: %w{web app}
Capfile
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r }
我的问题:
我的git的路径不被接受
SSH密钥问题
Git和SSH密钥与Capistrano的工作2为同样的应用程序,我正在部署。升级到capistrano v3会带来更大的头疼。我可以连续做什么。请指导我正确的步骤
无需''SSHKit.config.command_map':rake'和': rails','capistrano/bundler'负责。 –
另外,只需要'server'和'role:app /:web /:db'中的一个。在这种情况下,我认为'服务器'覆盖特定的':app /:web /:db' –