我一直在努力将capistrano v2升级到v3 5天,我正在尝试从本地机器部署到ec2实例开发环境。我不能再走下去了。我的踪迹在这里
$cap开发部署:检查
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 git@github.com: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 git@github.com: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).config/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'
endconfig/deploy/development.rb
set :stage, :development
role :app, %w{ec2-user@70.22.320.14}
role :web, %w{ec2-user@70.22.320.14}
role :db, %w{ec2-user@70.22.320.14}
role :all, %w{ec2-user@70.22.320.14}
server 'ec2-user@70.22.320.14', 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键与capistrano 2一起工作,与我部署的应用程序相同。升级到capistrano v3会带来更大的头痛。我能连续做些什么。请引导我通过正确的步骤。
发布于 2014-01-15 14:19:47
我花了一些时间与capistrano3做斗争,下面是一些提示,它们可能是有用的:
1)官方手册capistranorb.com。有一些关于你应该连续做什么的建议。关于认证和授权的章节也很有帮助。有一些关于在工作站和服务器上配置ssh的提示。我遵循了这个指南,它对我有帮助。通过从头开始遵循本指南来构建您的deploy.rb。
还有有用的指南:guide1,guide2
2)这是我的Capfile。请注意rvm1 1/capstrano3和capstrano3/unicorn。非常有用的宝石。
require 'capistrano/setup'
require 'capistrano/deploy'
require 'capistrano3/unicorn'
require 'rvm1/capistrano3'
require 'capistrano/rvm'
require 'capistrano/bundler'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'3)您可以尝试以下命令:
ssh ubuntu@ec2....amazonaws.com -v 或
ssh git@github.com -v # from your EC2 server若要了解在尝试连接到EC2服务器时发生了什么,请执行以下操作。可能是佩姆钥匙的问题?创建.pub键并尝试使用它。不要忘记将它添加到~/ssh/authorized_keys中
cat id_rsa_aws.pub | ssh ubuntu@....amazonaws.com "cat >>
/home/ubuntu/.ssh/authorized_keys"配置ssh-代理,不要忘记添加~/..bash_profile,如下所示:
eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa_deploy_github
ssh-add ~/.ssh/id_rsa_digital_ocean如果你对ssh有问题,也许你应该看看这个ssh-指南。
你也可以看我的应用程序,在那里我正在使用capistrano3。也许你能为你找到一些东西:#项目
附注:在某些VPS git上没有安装,所以最好检查:
deployer@ec2***.amazonaws.com$ which git如未找到:
deployer@ec2***.amazonaws.com$ sudo apt-get install githttps://stackoverflow.com/questions/21138345
复制相似问题