加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – 与bitbucket存储库一起使用capistrano部署rail

发布时间:2020-12-17 02:46:07 所属栏目:百科 来源:网络整理
导读:获取bitbucket存储库的 github. The authenticity of host ‘github.com (some_ip_address)’ can’t be established. 这是我的部署文件.部署:设置和部署:检查工作正常. require "bundler/capistrano" require "rvm/capistrano"default_run_options[:pty]
获取bitbucket存储库的 github.

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

这是我的部署文件.部署:设置和部署:检查工作正常.

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 app.

服务器:Digital Ocean VPS

存储库:bitbucket.org

我在bitbucket帐户中添加了服务器的ssh密钥.

问题:’cap:deploy’,执行部署后,部署:更新,部署:update_code,deploy:finalize_update,deploy:assets:symlink,

在执行’bundle install’时出现问题,它正在使用github真实性,而我正在使用bitbucket.

解决方法

尝试像这样设置git URL

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

如果您尚未将密钥添加到bitbucket,可以在此处执行https://bitbucket.org/account/user/username/ssh-keys/

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读