Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding deploy.

  • Loading branch information...
commit db6b00d23d7e1b4d7c2d5f16ccfdc6a094c009d2 1 parent 4f03856
Marcos Tapajós authored

Showing 2 changed files with 41 additions and 0 deletions. Show diff stats Hide diff stats

  1. +3 0  Capfile
  2. +38 0 config/deploy.rb
3  Capfile
... ... @@ -0,0 +1,3 @@
  1 +load 'deploy' if respond_to?(:namespace) # cap2 differentiator
  2 +Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
  3 +load 'config/deploy'
38 config/deploy.rb
... ... @@ -0,0 +1,38 @@
  1 +set :user, "podcasry"
  2 +set :runner, user
  3 +set :application, "podcast"
  4 +default_run_options[:pty] = true
  5 +set :repository, "git@github.com:vanpelt/rails-app.git"
  6 +set :scm, "git"
  7 +# set :scm_passphrase, "p00p" #This is your custom users password
  8 +set :deploy_to, "/home/#{user}/railsapp/#{application}"
  9 +set :ssh_options, { :forward_agent => true }
  10 +
  11 +namespace :deploy do
  12 + task :restart, :roles => :app do
  13 +# sudo "#{lsws_cmd} restart"
  14 + end
  15 +end
  16 +
  17 +task :after_update_code, :roles => :app do
  18 + run "ln -s #{deploy_to}/shared/awstats/html #{release_path}/public/awstats"
  19 + run "cd #{release_path} && rake db:migrate RAILS_ENV=production"
  20 + run "chmod 755 #{release_path}/public -R"
  21 + run "rm -Rf #{release_path}/public/podcasts"
  22 + run "ln -s #{deploy_to}/shared/podcasts #{release_path}/public/podcasts"
  23 +
  24 + count = (self[:keep_releases] || 10).to_i
  25 + if count >= releases.length
  26 + logger.important "no old releases to clean up"
  27 + else
  28 + logger.info "keeping #{count} of #{releases.length} deployed releases"
  29 + directories = (releases - releases.last(count)).map { |release|
  30 + File.join(releases_path, release) }.join(" ")
  31 + send(:run, "rm -rf #{directories}")
  32 + end
  33 +
  34 +end
  35 +
  36 +role :app, "podcast.rubyonrails.pro.br"
  37 +role :web, "podcast.rubyonrails.pro.br"
  38 +role :db, "podcast.rubyonrails.pro.br", :primary => true

0 comments on commit db6b00d

Please sign in to comment.
Something went wrong with that request. Please try again.