簡體   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