Created
December 31, 2011 16:07
-
-
Save vinioliveira/1544442 to your computer and use it in GitHub Desktop.
Recipe for capistrano
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ============================================================================= | |
| # CUSTOM OPTIONS | |
| # ============================================================================= | |
| set :user, "deploy" | |
| set :application, "myapp" | |
| server "127.0.0.1", :app, :web, :db, :primary => true | |
| # ============================================================================= | |
| # DATABASE OPTIONS | |
| # ============================================================================= | |
| set :rails_env, "production" | |
| # ============================================================================= | |
| # DEPLOY TO | |
| # ============================================================================= | |
| set :deploy_to, "/var/www/#{application}" | |
| # ============================================================================= | |
| # REPOSITORY | |
| # ============================================================================= | |
| set :scm, "git" | |
| set :repository, "git@github.com:vinioliveira/appname.git" | |
| set :branch, 'master' | |
| # ============================================================================= | |
| # SSH OPTIONS | |
| # ============================================================================= | |
| ssh_options[:forward_agent] = true | |
| set :use_sudo, false | |
| # ============================================================================= | |
| # DEFAULT RECIPE | |
| # ============================================================================= | |
| namespace :deploy do | |
| task :start do ; end | |
| task :stop do ; end | |
| task :restart, :roles => :app, :except => { :no_release => true } do | |
| run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
| end | |
| end | |
| #RVM hack | |
| $:.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. | |
| set :rvm_bin_path, "$HOME/.rvm/bin" | |
| set :rvm_ruby_string, '1.9.2@myapp' | |
| set :rvm_type, :user | |
| require "bundler/capistrano" | |
| after 'deploy:update_code' do | |
| run "cd #{release_path}; cp config/database.yml.sample config/database.yml" | |
| ## If your application is Rails 3.1 or later | |
| run "cd #{release_path}; RAILS_ENV=production rake assets:precompile" | |
| end | |
| ##Whenever Cron jobs | |
| set :whenever_command, "bundle exec whenever" | |
| require "whenever/capistrano" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment