Capistrano没有显示错误或中断部署

时间:2015-03-24 12:00:47

标签: ruby-on-rails ruby-on-rails-4 capistrano capistrano3

我正在使用Capistrano部署我的应用程序,并且我的部署在第一次上限生产部署后成功运行,跳过所有错误,迁移和缺少宝石。

INFO [b6487eaf] Finished in 0.329 seconds with exit status 0 (successful).

当然服务器无法运行,因为我有一堆丢失的配置,宝石等。但是Cap说一切都很好并且成功终止了我的部署!

deploy.rb:

lock '3.4.0'

set :application, 'myapp'
set :repo_url, 'git@github.com:name/myapp.git'

set :deploy_to, '/home/deploy/myapp'
set :deploy_user, 'deploy'

set :linked_files, fetch(:linked_files, []).push('config/database.yml', '.env')

set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'public/uploads')

namespace :deploy do

  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
      execute :touch, release_path.join('tmp/restart.txt')
    end
  end

  after :publishing, :restart

end

部署/ production.rb

role :app, %w{deploy@123.456.78.09}
role :web, %w{deploy@123.456.78.09}
role :db, %w{deploy@123.456.78.09}

set :rails_env, :production

server '123.456.78.09', user: 'deploy', roles: %w{app db web}, primary: true

 set :ssh_options, {
   keys: %w(/Users/user/.ssh/id_rsa),
   forward_agent: true,
   auth_methods: %w(publickey password)
 }

1 个答案:

答案 0 :(得分:0)

原来我设置了我的Capfile错误,忘记了

require 'capistrano/rails'

线。没有它,capistrano只需上传文件而无需运行与rails相关的命令