Skip to content

Instantly share code, notes, and snippets.

@denzuko
Forked from jpemberthy/gist:65878
Created November 13, 2010 00:08
Show Gist options
  • Save denzuko/674933 to your computer and use it in GitHub Desktop.
Save denzuko/674933 to your computer and use it in GitHub Desktop.
Devnet Capistrano deployment recipe
load 'deploy' if respond_to?(:namespace)
set :application, do
Capistrano::CLI.ui.ask "Your application name: "
end
set :user, do
Capistrano::CLI.ui.ask "Username: "
end
set :group, "www-data"
set :use_sudo, false
set :scm, :git
set :repository, do
(ENV['giturl']?ENV['giturl']:Capistrano::CLI.ui.ask "Git repository url: ")
end
set :deploy_via, :remote_cache
set :deploy_to, "/srv/vhost/#{application}"
set :environment, "production"
set :domain, "psynosis.local"
role :app, domain
role :web, domain
role :db, domian, :primary => true
set :ssh_options, { :forward_agent => true }
default_run_options[:pty] = true
set :runner, user
set :admin_runner, user
namespace :deploy do
task :start, :roles => [:web, :app] do
run "cd #{deploy_to}/current && nohup thin -C config/#{environment}_config.yml -R config.ru start"
end
task :stop, :roles => [:web, :app] do
run "cd #{deploy_to}/current && nohup thin -C thin/production_config.yml -R config.ru stop"
end
task :restart, :roles => [:web, :app] do
deploy.stop
deploy.start
end
# This will make sure that Capistrano doesn't try to run rake:migrate (this is not a Rails project!)
task :cold do
deploy.update
deploy.start
end
end
namespace :acoplet do
task :log do
run "cat #{deploy_to}/current/log/thin.log"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment