mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.35k stars 490 forks source link

Rails console is not interactive #482

Closed alxx closed 7 years ago

alxx commented 7 years ago

Hi there,

When trying to open a remote console, the terminal hangs:

$ mina server:console -f config/deploy_production.rb
-----> Loading rbenv
       Running via Spring preloader in process 29824
       Loading production environment (Rails 5.0.0.beta3)

Looking at the processes from a separate SSH console shows that the console is actually running:

$ ps aux | grep 'console production'
ubuntu   29792  1.2  0.2  93036 21560 pts/6    Sl+  09:12   0:00 /home/ubuntu/.rbenv/versions/2.2.3/bin/ruby bin/rails console production

But I don't see the console prompt. Unlike the old 'queue', the new 'command' doesn't seem to allow for interaction.

If I terminate mina with Ctrl-C:

^C
-----> Mina: SIGINT received.
       Killed by signal 2.

       irb(main):001:0> 
 !     Run Error

The console seems to have been waiting for input, but none was passed to it.

The relevant section in config/deploy_production.rb:

namespace :server do
  desc 'Run Rails console'

  task :console do
    invoke :'rbenv:load'

    in_path "#{fetch(:current_path)}" do
      command %{#{fetch(:rails)} console production}
    end
  end
end

Any suggestions?

d4be4st commented 7 years ago

There is already a console task for rails you can use:

mina console

But if you set set :execution_mode, :exec you should be able to interact with your task

alxx commented 7 years ago

Thank you. That worked.