1. Production logs
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"
end
end
end
cap production logs:tail_rails
2. Commands in 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
.3. Production rails console
Add:
gem 'capistrano-rails-console', require: false
to Gemfile and run bundle.
Add:
require 'capistrano/rails/console'
to Capfile.
Run:
cap production rails:console
(c) https://rubyplus.com
Comments
Post a Comment