Created
May 9, 2011 19:27
-
-
Save Houdini/963203 to your computer and use it in GitHub Desktop.
This file contains 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
set :config_yaml, YAML.load_file(File.dirname(__FILE__) + '/deploy_config.yml') | |
set :stages, ['production', 'staging'] | |
set :default_stage, 'staging' | |
require 'capistrano/ext/multistage' | |
# set :whenever_command, "bundle exec whenever" | |
# set(:whenever_update_flags) {"--set environment=#{stage} --update-crontab #{whenever_identifier}"} | |
# require 'whenever/capistrano' | |
set :scm, :git | |
set :scm_verbose, true | |
set :rails_env, :prerelease | |
set :ssh_options, {:forward_agent => true} | |
set :repository_cache, "git_cache" | |
set :deploy_via, :remote_cache | |
set :use_sudo, false | |
before "deploy:symlink", "deploy:bundle_install" | |
after "deploy:symlink", "deploy:update_nginx" | |
namespace :deploy do | |
desc "run bundler install, gem bundler уже должен стоять там" | |
task :bundle_install, :roles => :app do | |
run "gem install bundler" | |
run "gem install bundler && cd #{current_release} && bundle install --without test --without development" | |
end | |
desc "udpate nginx" | |
task :update_nginx, :roles => :app do | |
run "ln -sf #{current_release}/config/nginx/#{application}-#{stage}.conf /opt/nginx/conf/sites-enabled/#{application}.conf" | |
run "sudo /opt/nginx/sbin/nginx -s reload" | |
end | |
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 | |
namespace :db do | |
desc "rake db:create" | |
task :db_create, :roles => :db do | |
run "cd #{current_path} && rake db:create RAILS_ENV=#{rails_env}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment