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

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 console.

Is there a way to use capistrano or another remote administration tool to interact with the rails console on a server from your local terminal?


cap shell seems promising, but it hangs when you try to start the console:

cap> cd /path/to/application/current
cap> pwd
 ** [out ::] /path/to/application/current
cap> rails c production
 ** [out ::] Loading production environment (Rails 3.0.0)
 ** [out ::] Switch to inspect mode.

if you know a workaround for this, that'd be great


I found pretty nice solution based on

desc "Remote console" 
task :console, :roles => :app do
  env = stage || "production"
  server = find_servers(:roles => [:app]).first
  run_with_tty server, %W( ./script/rails console #{env} )

desc "Remote dbconsole" 
task :dbconsole, :roles => :app do
  env = stage || "production"
  server = find_servers(:roles => [:app]).first
  run_with_tty server, %W( ./script/rails dbconsole #{env} )

def run_with_tty(server, cmd)
  # looks like total pizdets
  command = []
  command += %W( ssh -t #{gateway} -l #{self[:gateway_user] || self[:user]} ) if     self[:gateway]
  command += %W( ssh -t )
  command += %W( -p #{server.port}) if server.port
  command += %W( -l #{user} #{} )
  command += %W( cd #{current_path} )
  # have to escape this once if running via double ssh
  command += [self[:gateway] ? '\&\&' : '&&']
  command += Array(cmd)
  system *command

Need Your Help

Cache <cfstoredproc> results

caching coldfusion coldfusion-8 cfstoredproc

Is there any way to cache the results of a &lt;cfstoredproc&gt; tag? The &lt;cfquery&gt; tag makes it easy with the cachedwithin attribute but there doesn't seem to be anything for &lt;cfstoredproc...

Can apt-get work in Slackware or other Linuxes?

linux debian apt-get package-managers slackware

I know that apt-get is meant to be a packaging manager for Debian. But I'd like to learn if this software can be also ported to different operating systems, especially to Slackware.