Capistrano 3.11 Tips

Tail Production Log

Add a custom Capistrano rake task to lib/capistrano/tasks/tail.rake.

namespace :logs do
  desc "tail rails logs. Usage cap production logs:tail_rails"
  task :tail_rails do
    on roles(:app) do
      execute "tail -f #{shared_path}/log/#{fetch(:rails_env)}.log"

You can now tail the production log from your local machine:

cap production logs:tail_rails

Run Commands on Server

Add :

require 'capistrano/console'

to Capfile

Now you can run:

bundle exec cap production console

to run commands on the server terminal. Useful to run commands like: uptime.

Play with Rails Production Console


gem 'capistrano-rails-console', require: false

to Gemfile and run bundle.


require 'capistrano/rails/console'

to Capfile.


cap production rails:console

to play in production rails console.

Run Migration on Deploy

Make sure you have the db role in the config/deploy/production.rb file as follows:

server 'ip-address-goes-here', user: 'deploy-user', roles: %w{app web db}

Related Articles

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.