Skip to content

Instantly share code, notes, and snippets.

@jonpaul
Created October 21, 2011 17:40
Show Gist options
  • Save jonpaul/1304454 to your computer and use it in GitHub Desktop.
Save jonpaul/1304454 to your computer and use it in GitHub Desktop.
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) # Add RVM's lib directory to the load path.
require "rvm/capistrano" # Load RVM's capistrano plugin.
default_run_options[:pty] = true
set :rvm_ruby_string, '1.9.2-p290' # Or whatever env you want it to run in.
set :application, "masterdatamachine"
set :domain, '50.57.132.151'
set :applicationdir, "/var/www/#{application}"
set :repository, "[email protected]:glideint/Master-Data-Machine.git"
set :scm, :git
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :user, 'deploy'
set :scm_passphrase, '1q2w3e4r!QAZ'
set :use_sudo, false
set :deploy_to, "/var/www/#{application}"
set :deploy_via, :remote_cache
set :branch, 'master'
set :migrate_target, :current
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
# if you're still using the script/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
after "deploy:finalize_update", "deploy:bundle_gems"
after "deploy:finalize_update", "rvm:trust_rvmrc"
after "deploy:bundle_gems", "deploy:restart"
after "deploy:finalize_update", "db:db_configs"
namespace :rvm do
task :trust_rvmrc do
run "rvm rvmrc trust #{release_path}"
end
end
namespace :db do
desc "Sets Up Config's for the Production Database"
puts "\n\n=== Cloning Configs for the Production Database! ===\n\n"
task :db_configs, :except => { :no_release => true }, :role => :app do
run "ln -s ~/database.yml #{release_path}/config/database.yml && ln -s ~/mongoid.yml #{release_path}/config/mongoid.yml"
end
desc "Populates the Production Database"
task :seed do
puts "\n\n=== Populating the Production Database! ===\n\n"
run "cd #{current_path}; rake db:seed RAILS_ENV=production"
end
end
namespace :deploy do
task :bundle_gems do
run "cd #{release_path} && bundle install --deployment"
end
task :start do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
task :stop do ; end #Not used
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment