Is there a way to use capistrano (or similar) to remotely interact with rails console

后端 未结 6 702
情话喂你
情话喂你 2021-02-03 11:50

I\'m loving how capistrano has simplified my deployment workflow, but often times a pushed change will run into issues that I need to log into the server to troubleshoot via the

6条回答
  •  心在旅途
    2021-02-03 12:20

    This is how i do that without Capistrano: https://github.com/mcasimir/remoting (a deployment tool built on top of rake tasks). I've added a task to the README to open a remote console on the server:

    # remote.rake
    namespace :remote do
    
    desc "Open rails console on server"
    task :console do
      require 'remoting/task'
    
      remote('console', config.login, :interactive => true) do
        cd config.dest
        source '$HOME/.rvm/scripts/rvm'
        bundle :exec, "rails c production"
      end
    end
    
    end
    

    Than i can run

    $ rake remote:console
    

提交回复
热议问题