繁体   English   中英

Capistrano和Git部署Rails应用

[英]Capistrano and Git Deploy Rails App

当尝试使用Capistrano将Rails应用程序部署到生产服务器时,尽管我直接从GitHub克隆了该项目,但似乎并没有将我的项目识别为git repo。

GIT日志:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean

CAP日志:

$ cap production deploy

    triggering load callbacks
  * 2016-06-01 16:30:26 executing `production'
    triggering start callbacks for `deploy'
  * 2016-06-01 16:30:26 executing `multistage:ensure'
  * 2016-06-01 16:30:26 executing `deploy'
  * 2016-06-01 16:30:26 executing `deploy:update'
 ** transaction: start
  * 2016-06-01 16:30:26 executing `deploy:update_code'
    executing locally: "git ls-remote git@github.com:mitigation/mpm.git r1"
    command finished in 662ms
  * refreshing local cache to revision 8c86d067abde1464f88902566324a99e22cd3147 at /var/folders/xs/5qz1glwj30v51rwpxhyclw880000gn/T/mpm
    executing locally: cd /var/folders/xs/5qz1glwj30v51rwpxhyclw880000gn/T/mpm && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 8c86d067abde1464f88902566324a99e22cd3147 && git clean -q -d -x -f

fatal: Not a git repository (or any of the parent directories): .git

command finished in 13ms
shell command failed with return code pid 52560 exit 128

这是我的Capfile:

load 'deploy'
load 'deploy/assets'
load 'config/deploy' 

这是我的DEPLOY.RB:

require 'soprano'

require 'bundler/capistrano'

require 'capistrano/ext/multistage'

require 'whenever/capistrano'

require 'leipreachan/capistrano2'

set :default_environment, {
  'PATH' => '/home/deploy/.rbenv/shims:/home/deploy/.rbenv/bin:$PATH'
}


set :web_server, :nginx
set :keep_releases, 3

set :repository, 'git@github.com:mitigation/mpm.git'

set :deploy_via, :copy
set :copy_exclude, %w(.git .idea .yardoc tmp log .DS_Store doc/* public/uploads.tar db/*.sql vendor/cache)
set :copy_cache, true

set :bundle_without, [:development, :test]
set :bundle_flags, '--deployment --binstubs'

set :user, 'deploy'

before 'deploy:setup', :db
after 'deploy:create_symlink', 'utils:version'
after 'deploy:update_code', 'db:symlink'

#For troubleshooting only
namespace :deploy do
  task :update_code, :except => { :no_release => true } do
    #on_rollback { run "rm -rf #{release_path}; true" }
    strategy.deploy!
    finalize_update
  end
end

在部署到各种环境的过程中, capistrano3创建一个目录树并将git信息放在一个名为repo_path的文件夹中。 您必须在生产服务器上的该目录内移动,并且“ $ git log ”将起作用,表明其为.git存储库

您也不需要在copy_exclude中使用.git。

尝试针对不同的环境,重新运行capistrano3设置过程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM