Never been to CodeSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

http://installingcats.com

Remove sudo password request when deploying

Change the sudoers list by adding a NOPASSWD: [Cmnd_Alias] line.

In terminal: visudo

# Cmnd alias specification
Cmnd_Alias HTTPD = /usr/local/sbin/apachectl, /etc/init.d/apache2

# User privilege specification
[user] ALL = NOPASSWD: HTTPD


Be sure that the NOPASSWD line is last in visudo, else, it risks being overwritten by later specifications.

Variables for capistrano

Cap uses lots of symbols for pointing to variables.

When adjusting the value of a cap variable that is located in the standard.rb task library, you must use :set to adjust its value within your own recipe file (such as deploy.rb).

Example: :migrate_env is declared in Cap's standard.rb. To adjust its value, do not use a local variable named migrate_env to do so, it won't apply to the standard.rb library tasks.

set :migrate_geoip, "load_geoipcountry=false"
set :migrate_env, "#{migrate_geoip}"

Capistrano namespaces

when namespace is specified for a task, all subsequent tasks are assumed to be in the same namespace, reverting to non-namespaced task if not found

desc "OVERRIDE of deploy:cold"
deploy.task :cold, :roles => :app do
  puts "Overridden!"
  puts "Deploy method: #{deploy_via.to_s}"
  puts "Copy Strat: #{copy_strategy.to_s}"
  update
  migrate
  refresh_db
  mrs
end