ruby-on-rails - 使用 capistrano 部署 rails 应用程序的 bitbucket 存储库问题

标签 ruby-on-rails deployment capistrano bitbucket rvm-capistrano

获取 githubbitbucket存储库。

The authenticity of host 'github.com (some_ip_address)' can't be established.



这是我的部署文件。 deploy:setupdeploy:check工作正常。
require "bundler/capistrano" 
require "rvm/capistrano"

default_run_options[:pty] = true 
ssh_options[:forward_agent] = true

set :repository, 'ssh://git@bitbucket.org/username/repo.git' 
set :scm :git 
set :scm_verbose, true
set :user, 'root'
set :deploy_via, :remote_cache
set :migrate_target, :current
set :branch, 'master'
set :application, 'my_app_name' 
set :domain, 'my_domain_ip_address'
set :applicationdir, "/home/deploy/domains/#{application}"
set :deploy_to, "/home/deploy/domains/#{application}"
role :web, domain role :app, domain role :db,  domain, :primary => true
set :keep_releases, 5
set :rvm_type, :system

after 'deploy:restart', 'deploy:cleanup'

namespace :deploy do   
  task :start do ; end   
  task :stop do ; end   
  task :restart, :roles => :app, :except => { :no_release => true } do
    run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
    run "#{try_sudo} chmod 777 #{File.join(current_path,'tmp/')}"
    run "#{try_sudo} chmod 777 #{File.join(current_path,'log/')}"
  end
  task :after_deploy do
    run "cd #{current_path} && bundle install --deployment"
    run "cd #{current_path}; RAILS_ENV=#{rails_env} bundle exec rake db:migrate"
    run "#{try_sudo} chmod 777 -R #{current_path}/tmp/"
    run "#{try_sudo} chmod 777 -R #{current_path}/log/"
    run "#{try_sudo} chmod 777 . #{current_path}/log/"   
  end 
end

after 'deploy', 'deploy:after_deploy'

注意:我是第一次尝试部署 rails 应用程序。
Server: Digital Ocean VPSRepository: bitbucket.org
我加了 ssh keyserverbitbucket帐户。

问题:虽然 'cap:deploy' , 执行 deploy,deploy:update,deploy:update_code,deploy:finalize_update,deploy:assets:symlink,

执行时遇到问题 'bundle install' , 求github真实性,同时使用 bitbucket .

最佳答案

尝试设置 git URL像这样

set :repository, 'git@bitbucket.org:username/repo.git'

如果您还没有添加您的 keys到bitbucket,你可以在这里做https://bitbucket.org/account/user/username/ssh-keys/

关于ruby-on-rails - 使用 capistrano 部署 rails 应用程序的 bitbucket 存储库问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18712163/

相关文章:

javascript - React Router 服务器端渲染 Rails

sql - 在 Rails 中连接不相关的表

java - 部署完成后启动调度程序

ruby - 为什么 Ruby 给出错误 "point is not on curve"?

ruby-on-rails - 如何向多个收件人发送电子邮件

ruby-on-rails - 搜索模型 tagged_with 或 title like (with acts_as_taggable_on)

java - 将 JVM 参数传递到 list 文件(用于 JRI + Javafx 部署)

deployment - Erlang/OTP 生产应用部署简介

ruby-on-rails-3 - Net-SSH/Capistrano 问题 : "Could not parse PKey: no start line"

ruby-on-rails - 如何在生产中部署 resque worker?