- # Please install the Engine Yard Capistrano gem
- # gem install eycap --source http://gems.engineyard.com
- require "eycap/recipes"
- # =============================================================================
- # ENGINE YARD REQUIRED VARIABLES
- # =============================================================================
- # You must always specify the application and repository for every recipe. The
- # repository must be the URL of the repository you want this recipe to
- # correspond to. The :deploy_to variable must be the root of the application.
- set :keep_releases, 5
- set :application, "zocalo"
- set :user, "zocalo"
- set :deploy_to, "/data/#{application}"
- set :monit_group, "zocalo"
- set :runner, "zocalo"
- set :repository, "https://zocalo.svn.ey02.engineyard.com/trunk"
- set :scm_username, "deploy"
- set :scm_password, "nk2s32x0"
- set :scm, :subversion
- set :deploy_via, :filtered_remote_cache
- set :repository_cache, "/var/cache/engineyard/#{application}"
- set :production_database, "zocalo_production"
- set :production_dbhost, "mysql50-8-master"
- set :staging_database, "zocalo_staging"
- set :staging_dbhost, "mysql50-staging-1"
- set :development_database,"zocalo_development"
- set :development_dbhost, "mysql50-staging-1"
- set :dbuser, "zocalo"
- set :dbpass, "Vad2s32Uj"
- set :use_dj, true
- # comment out if it gives you trouble. newest net/ssh needs this set.
- ssh_options[:paranoid] = false
- # =============================================================================
- # ROLES
- # =============================================================================
- # You can define any number of roles, each of which contains any number of
- # machines. Roles might include such things as :web, or :app, or :db, defining
- # what the purpose of each machine is. You can also specify options that can
- # be used to single out a specific subset of boxes in a particular role, like
- # :primary => true.
- task :production do
- role :web, "65.74.186.4:8089" #zocalo [mongrel] [mysql50-8-master]
- role :app, "65.74.186.4:8089", :mongrel => true, :memcached => true, :dj => true
- role :db , "65.74.186.4:8089", :primary => true
- role :app, "65.74.186.4:8090", :no_release => true, :no_symlink => true, :mongrel => true, :memcached => true
- set :repository, "https://zocalo.svn.ey02.engineyard.com/branches/1.4.6"
- set :rails_env, "production"
- set :environment_database, defer { production_database }
- set :environment_dbhost, defer { production_dbhost }
- end
- task :staging do
- role :web, "184.106.197.19" # mongrel
- role :app, "184.106.197.19", :mongrel => true, :memcached => true, :dj => true
- role :db, "184.106.197.19", :primary => true
- set :bundler, '/var/lib/gems/1.8/bin/bundle'
- set :rake, "#{bundler} exec rake"
- set :deploy_via, :remote_cache
- set :scm, :git
- set :repository, "git@github.com:thedigitalants/izoca.git"
- set :rails_env, "staging"
- set :environment_database, defer { staging_database }
- set :environment_dbhost, defer { staging_dbhost }
- set :use_sudo, false
- set :deploy_to, "/home/zocalo/zocalo"
- set :use_dj, false
- end
- task :remote_development do
- role :web, "65.74.186.4:8458" #zocalo [mongrel] [mysql50-8-master]
- role :app, "65.74.186.4:8458", :mongrel => true, :memcached => true, :dj => true
- role :db , "65.74.186.4:8458", :primary => true
- set :repository, "https://zocalo.svn.ey02.engineyard.com/trunk"
- set :rails_env, "remote_development"
- set :environment_database, defer { development_database }
- set :environment_dbhost, defer { development_dbhost }
- end
- # =============================================================================
- # Any custom after tasks can go here.
- # after "deploy:symlink_configs", "zocalo_custom"
- # task :zocalo_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
- # run <<-CMD
- # CMD
- # end
- # =============================================================================
- after "deploy:symlink_configs", "zocalo_custom"
- task :zocalo_custom, :roles => :app, :except => {:no_release => true, :no_symlink => true} do
- run "if [ -d #{latest_release}/public/media ]; then mv #{latest_release}/public/media #{latest_release}/public/media.bak; fi"
- run "ln -nfs #{shared_path}/media #{latest_release}/public/"
- end
- namespace :deploy do
- task :start, :roles => :app do
- run "touch #{current_release}/tmp/restart.txt"
- end
- task :stop, :roles => :app do
- # Do nothing.
- end
- desc "Bundle required gems"
- task :bundle, :roles => :app do
- run "cd #{latest_release} && #{bundler} install --without cucumber test development"
- end
- desc "Restart Application"
- task :restart, :roles => :app do
- run "touch #{current_release}/tmp/restart.txt"
- end
- end
- namespace :dj do
- desc "Restart delayed_job"
- task :restart, :role => :app, :only => {:dj => true} do
- sudo "monit restart all -g dj_#{application}" if use_dj
- end
- end
- # Do not change below unless you know what you are doing!
- after "deploy", "deploy:cleanup"
- after "deploy:migrations" , "deploy:cleanup"
- after "deploy:update_code", "deploy:symlink_configs", "deploy:bundle"
- after "deploy:restart", "dj:restart"
- # uncomment the following to have a database backup done before every migration
- # before "deploy:migrate", "db:dump"