Skip to content

Instantly share code, notes, and snippets.

@pristinenoise
Created June 5, 2012 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pristinenoise/2876295 to your computer and use it in GitHub Desktop.
Save pristinenoise/2876295 to your computer and use it in GitHub Desktop.
default columbia deployment
# config/deploy.rb
set :default_stage, "vm_dev"
set :stages, %w(vm_dev vm_test vm_prod)
require 'capistrano/ext/multistage'
require 'bundler/capistrano'
require 'date'
default_run_options[:pty] = true
set :application, "your-application-name"
set :branch do
default_tag = `git tag`.split("\n").last
tag = Capistrano::CLI.ui.ask "Tag to deploy (make sure to push the tag first): [#{default_tag}] "
tag = default_tag if tag.empty?
tag
end
set :scm, :git
set :git_enable_submodules, 1
set :deploy_via, :remote_cache
set :repository, "git@github.com:cul/application-name.git"
set :use_sudo, false
namespace :deploy do
desc "Add tag based on current version"
task :auto_tag, :roles => :app do
current_version = IO.read("VERSION").to_s.strip + Date.today.strftime("-%y%m%d")
tag = Capistrano::CLI.ui.ask "Tag to add: [#{current_version}] "
tag = current_version if tag.empty?
system("git tag -a #{tag} -m 'auto-tagged' && git push origin --tags")
end
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
task :symlink_shared do
run "ln -nfs #{deploy_to}shared/database.yml #{release_path}/config/database.yml"
end
end
after 'deploy:update_code', 'deploy:symlink_shared'
# config/deploy/vm_dev.rb
set :rails_env, "vm_dev"
set :application, "application_name_dev"
set :domain, "bronte.cul.columbia.edu"
set :deploy_to, "/opt/passenger/#{application}/"
set :user, "deployer"
set :scm_passphrase, ""
role :app, domain
role :web, domain
role :db, domain, :primary => true
Application_Name::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
config.cache_classes = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "localhost",
:domain => "bronte.cc.columbia.edu",
:port => "25"
}
# Print deprecation notices to the Rails logger
config.active_support.deprecation = :log
config.assets.compress = true
config.assets.compile = false
config.assets.digest = true
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment