Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 5.50 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. # Please install the Engine Yard Capistrano gem
  2. # gem install eycap --source http://gems.engineyard.com
  3.  
  4. require "eycap/recipes"
  5.  
  6. # =============================================================================
  7. # ENGINE YARD REQUIRED VARIABLES
  8. # =============================================================================
  9. # You must always specify the application and repository for every recipe. The
  10. # repository must be the URL of the repository you want this recipe to
  11. # correspond to. The :deploy_to variable must be the root of the application.
  12. set :keep_releases,       5
  13. set :application,         "zocalo"
  14. set :user,                "zocalo"
  15. set :deploy_to,           "/data/#{application}"
  16. set :monit_group,         "zocalo"
  17. set :runner,                      "zocalo"
  18. set :repository,          "https://zocalo.svn.ey02.engineyard.com/trunk"
  19. set :scm_username,        "deploy"
  20. set :scm_password,        "nk2s32x0"
  21. set :scm,                 :subversion
  22. set :deploy_via,          :filtered_remote_cache
  23. set :repository_cache,    "/var/cache/engineyard/#{application}"
  24. set :production_database, "zocalo_production"
  25. set :production_dbhost,   "mysql50-8-master"
  26. set :staging_database,    "zocalo_staging"
  27. set :staging_dbhost,      "mysql50-staging-1"
  28. set :development_database,"zocalo_development"
  29. set :development_dbhost,  "mysql50-staging-1"
  30. set :dbuser,              "zocalo"
  31. set :dbpass,              "Vad2s32Uj"
  32. set :use_dj,              true
  33.  
  34. # comment out if it gives you trouble. newest net/ssh needs this set.
  35. ssh_options[:paranoid] = false
  36.  
  37. # =============================================================================
  38. # ROLES
  39. # =============================================================================
  40. # You can define any number of roles, each of which contains any number of
  41. # machines. Roles might include such things as :web, or :app, or :db, defining
  42. # what the purpose of each machine is. You can also specify options that can
  43. # be used to single out a specific subset of boxes in a particular role, like
  44. # :primary => true.
  45.  
  46. task :production do
  47.   role :web, "65.74.186.4:8089" #zocalo [mongrel] [mysql50-8-master]
  48.   role :app, "65.74.186.4:8089", :mongrel => true, :memcached => true, :dj => true
  49.   role :db , "65.74.186.4:8089", :primary => true
  50.   role :app, "65.74.186.4:8090", :no_release => true, :no_symlink => true, :mongrel => true, :memcached => true
  51.  
  52.   set :repository,          "https://zocalo.svn.ey02.engineyard.com/branches/1.4.6"
  53.   set :rails_env, "production"
  54.   set :environment_database, defer { production_database }
  55.   set :environment_dbhost, defer { production_dbhost }
  56. end
  57.  
  58. task :staging do
  59.   role :web, "184.106.197.19" # mongrel
  60.   role :app, "184.106.197.19", :mongrel => true, :memcached => true, :dj => true
  61.   role :db, "184.106.197.19", :primary => true
  62.  
  63.   set :bundler,              '/var/lib/gems/1.8/bin/bundle'
  64.   set :rake,                 "#{bundler} exec rake"
  65.   set :deploy_via,           :remote_cache
  66.   set :scm,                  :git
  67.   set :repository,           "git@github.com:thedigitalants/izoca.git"
  68.   set :rails_env,            "staging"
  69.   set :environment_database, defer { staging_database }
  70.   set :environment_dbhost,   defer { staging_dbhost }
  71.   set :use_sudo,             false
  72.   set :deploy_to,            "/home/zocalo/zocalo"
  73.   set :use_dj,               false
  74. end
  75.  
  76. task :remote_development do
  77.   role :web, "65.74.186.4:8458" #zocalo [mongrel] [mysql50-8-master]
  78.   role :app, "65.74.186.4:8458", :mongrel => true, :memcached => true, :dj => true
  79.   role :db , "65.74.186.4:8458", :primary => true
  80.  
  81.   set :repository,          "https://zocalo.svn.ey02.engineyard.com/trunk"
  82.   set :rails_env, "remote_development"
  83.   set :environment_database, defer { development_database }
  84.   set :environment_dbhost, defer { development_dbhost }
  85. end
  86.  
  87. # =============================================================================
  88. # Any custom after tasks can go here.
  89. # after "deploy:symlink_configs", "zocalo_custom"
  90. # task :zocalo_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
  91. #   run <<-CMD
  92. #   CMD
  93. # end
  94. # =============================================================================
  95.  
  96. after "deploy:symlink_configs", "zocalo_custom"
  97. task :zocalo_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
  98.   run "if [ -d #{latest_release}/public/media ]; then mv #{latest_release}/public/media #{latest_release}/public/media.bak; fi"
  99.   run "ln -nfs #{shared_path}/media #{latest_release}/public/"
  100. end
  101.  
  102. namespace :deploy do
  103.   task :start, :roles => :app do
  104.     run "touch #{current_release}/tmp/restart.txt"
  105.   end
  106.  
  107.   task :stop, :roles => :app do
  108.     # Do nothing.
  109.   end
  110.  
  111.   desc "Bundle required gems"
  112.   task :bundle, :roles => :app do
  113.     run "cd #{latest_release} && #{bundler} install --without cucumber test development"
  114.   end
  115.  
  116.   desc "Restart Application"
  117.   task :restart, :roles => :app do
  118.     run "touch #{current_release}/tmp/restart.txt"
  119.   end
  120. end
  121.  
  122. namespace :dj do
  123.   desc "Restart delayed_job"
  124.   task :restart, :role => :app, :only => {:dj => true} do
  125.     sudo "monit restart all -g dj_#{application}" if use_dj
  126.   end
  127. end
  128.  
  129. # Do not change below unless you know what you are doing!
  130.  
  131. after "deploy", "deploy:cleanup"
  132. after "deploy:migrations" , "deploy:cleanup"
  133. after "deploy:update_code", "deploy:symlink_configs", "deploy:bundle"
  134. after "deploy:restart", "dj:restart"
  135.  
  136. # uncomment the following to have a database backup done before every migration
  137. # before "deploy:migrate", "db:dump"