简体   繁体   English

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

[英]Capistrano not showing errors or interrupting deploy

I am working on deploying my app with Capistrano, and my deploy ran successfully after first cap production deploy, skipping all the errors, migrations and missing gems. 我正在与Capistrano一起部署我的应用程序,并且在首次进行上限生产部署后,我的部署成功运行,跳过了所有错误,迁移和缺少的gem。

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

Of course the server isn't working because I have a bunch of missing configs, gems, etc. But Cap says all is fine and successfully terminates my deploy! 当然服务器无法正常工作,因为我缺少大量配置,gem等。但是Cap说一切都很好,并成功终止了我的部署!

deploy.rb: 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

deploy/production.rb 部署/生产.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)
 }

Turned out I have set up my Capfile wrong, forgetting the 原来我把Capfile设置错了,忘记了

require 'capistrano/rails'

Line. 线。 Without it capistrano simply uploaded the files without running rails-related commands 如果没有它,capistrano只需上传文件,而无需运行与rails相关的命令

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

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