Capistrano部署命令后没有任何反应

时间:2018-11-10 15:08:26

标签: ruby-on-rails amazon-web-services deployment rubygems capistrano

我正在使用Capistrano gem来管理Ruby on Rails应用程序的部署。它与AWS服务器EC2,MySQL Redis连接。当我将命令设置为“ cap生产部署”或“ cap阶段部署”时,什么都没有发生。我只是被困在那里。

要在此处添加我的SSH密钥,请正确添加。并且在我的AWS安全组中,仅添加了授权IP才具有部署权限。我的IP也已添加。

但是,当我在所有安全组中添加开放端口0.0.0.0/0时,便可以进行部署。但是我不应该为应用程序安全性添加开放端口。

可能是什么原因以及如何解决这些问题?

我的控制台的屏幕截图,没有任何反应

X

下面是我的deploy.rb文件:

SSHKit.config.command_map[:rake] = 'bundle exec rake'
# config valid only for current version of Capistrano
lock '3.8.1'

set :application, 'my_app'
set :repo_url, 'git@gitlab.com:_____'
set :deploy_via, :remote_cache

set :rvm_roles, [:app, :web]
set :rvm_type, :user
set :rvm_ruby_version, 'ruby-2.4.0'

set :log_level, :debug
set :pty, false
set :linked_files, %w{config/application.yml config/database.yml}
set :linked_dirs, %w{log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system public/assets public/uploads}

set :keep_releases, 10
set :whenever_roles, [:web, :app,:db]
set :whenever_identifier, "#{fetch(:application)}_#{fetch(:stage)}"

namespace :deploy do

  desc 'restart (upgrade) unicorn server'
  task :restart do
    invoke 'unicorn:restart'
  end

  after :finishing, 'deploy:cleanup'
  after 'deploy:publishing', 'deploy:restart'

  after :restart, :clear_cache do
    on roles(:web), in: :groups, limit: 3, wait: 10 do
      within release_path do
        execute :rake, 'tmp:cache:clear'
      end
    end
  end

end

namespace :delayed_job do

  desc 'List of running delayed job workers'
  task :list do
    on roles(:all) do |host|
      execute :ps, 'aux | grep delayed_job'
    end
  end

  desc 'Stop delayed_job workers forcefully'
  task :kill do
    on roles(:all) do |host|
      execute :kill, "-9 $(ps aux | grep delayed_job | awk '{print $2}')"
    end
  end

end

task :upload_secret_files do
  on roles(:all) do |host|
    begin
      execute "mkdir -p #{shared_path}/config"
    rescue
    end
    upload! 'config/application.yml', "#{shared_path}/config/application.yml"
    upload! 'config/database.yml', "#{shared_path}/config/database.yml"
  end
end

task :log do
  on roles(:all) do |host|
    execute "tail -f #{current_path}/log/#{fetch(:rails_env)}.log"
  end
end

desc 'Invoke a rake command on the remote server'
task :invoke, [:command] => 'deploy:set_rails_env' do |task, args|
  on primary(:app) do
    within current_path do
      with rails_env: fetch(:rails_env) do
        rake args[:command]
      end
    end
  end
end

1 个答案:

答案 0 :(得分:0)

我一直在努力解决完全相同的问题,并花了几个小时。没有得到什么有关的问题。重新启动本地操作系统后,它才开始工作

相关问题