How could I create a "nice" Capistrano deployment?
How do I set up a good index for cap:deploy
?
I want the commands to be nice on the remote server cp
:
nice -n 19 cp ...
Not sure about cp . Not using SCM?
I tried with my setup (I am using subversion) and it seems to work. In deploy.rb add:
set :scm_command, "nice -19 svn"
It seems a little more complicated, if you are not using SCM you will have to overload checkout () in deploy / scm / none.rb.
For those who want to have a good assets:precomile
job for a assets:precomile
very time consuming, the following.
namespace :deploy do
task :map_bins_to_nice do
SSHKit.config.command_map.prefix[:rake]&.unshift('nice -n 19')
end
end
Capistrano::DSL.stages.each do |stage|
after stage, 'deploy:map_bins_to_nice'
end
Note that this makes every rake
task niced. Eg rake db:migrate
.
This was originally taken from the following post (Japanese). http://d.hatena.ne.jp/nekonokataomoi/20140819/1408443332