From 92d9a57f3f8fa5c25ae7d148f53ea61d002caeba Mon Sep 17 00:00:00 2001 From: Manuel Wiedenmann Date: Sat, 25 May 2013 19:38:14 +0200 Subject: [PATCH] adds capistrano for deployment --- Gemfile | 5 ++++ Gemfile.lock | 63 ++++++++++++++++++++++++++++++++++------- config/deploy.rb.SAMPLE | 46 ++++++++++++++++++++++++++++++ 3 files changed, 104 insertions(+), 10 deletions(-) create mode 100644 config/deploy.rb.SAMPLE diff --git a/Gemfile b/Gemfile index 6cf4d543..12f12d13 100644 --- a/Gemfile +++ b/Gemfile @@ -58,4 +58,9 @@ group :development do # Hide assets requests in log gem 'quiet_assets' + + # Deploy with Capistrano + gem 'capistrano', '2.13.5' + gem 'capistrano-ext' + gem 'common_deploy', require: false, git: 'git://github.com/fsmanuel/common_deploy.git' end diff --git a/Gemfile.lock b/Gemfile.lock index 821735fd..9a401c30 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,6 +11,16 @@ GIT acts_as_configurable (0.0.1) rake +GIT + remote: git://github.com/fsmanuel/common_deploy.git + revision: f5aaa761ab7104336756911ed06c46b6f3f82155 + specs: + common_deploy (0.0.1) + capistrano (>= 2.13.5) + capistrano-ext + capistrano-resque (~> 0.1.0) + rvm-capistrano + GIT remote: git://github.com/technoweenie/acts_as_versioned.git revision: 63b1fc8529d028fae632fe80ec0cb25df56cd76b @@ -59,6 +69,18 @@ GEM builder (3.0.4) bullet (4.3.0) uniform_notifier + capistrano (2.13.5) + highline + net-scp (>= 1.0.0) + net-sftp (>= 2.0.0) + net-ssh (>= 2.0.14) + net-ssh-gateway (>= 1.1.0) + capistrano-ext (1.2.1) + capistrano (>= 1.0.0) + capistrano-resque (0.1.0) + capistrano + resque + resque-scheduler chronic (0.9.0) client_side_validations (3.1.4) coderay (1.0.8) @@ -85,6 +107,7 @@ GEM railties (>= 3.1, < 4.1) has_scope (0.5.1) hashery (2.0.1) + highline (1.6.19) hike (1.2.1) i18n (0.6.1) inherited_resources (1.3.1) @@ -114,8 +137,16 @@ GEM activesupport (~> 3.1) polyamorous (~> 0.5.0) mime-types (1.21) - multi_json (1.7.1) + mono_logger (1.1.0) + multi_json (1.7.3) mysql2 (0.3.11) + net-scp (1.1.1) + net-ssh (>= 2.6.5) + net-sftp (2.1.2) + net-ssh (>= 2.6.5) + net-ssh (2.6.7) + net-ssh-gateway (1.2.0) + net-ssh (>= 2.6.5) pdf-reader (1.2.0) Ascii85 (~> 1.0.0) hashery (~> 2.0) @@ -131,7 +162,7 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-protection (1.3.2) + rack-protection (1.5.0) rack rack-ssl (1.3.3) rack @@ -155,18 +186,27 @@ GEM rake (10.0.3) rdoc (3.12.2) json (~> 1.4) - redis (3.0.2) - redis-namespace (1.2.1) + redis (3.0.4) + redis-namespace (1.3.0) redis (~> 3.0.0) responders (0.9.3) railties (~> 3.1) - resque (1.23.0) + resque (1.24.1) + mono_logger (~> 1.0) multi_json (~> 1.0) - redis-namespace (~> 1.0) + redis-namespace (~> 1.2) sinatra (>= 0.9.2) vegas (~> 0.1.2) + resque-scheduler (2.0.1) + redis (>= 2.0.1) + resque (>= 1.20.0) + rufus-scheduler ruby-prof (0.11.2) ruby-rc4 (0.1.5) + rufus-scheduler (2.0.19) + tzinfo (>= 0.3.23) + rvm-capistrano (1.3.0) + capistrano (>= 2.0.0) sass (3.2.1) sass-rails (3.2.5) railties (~> 3.2.0) @@ -179,9 +219,9 @@ GEM simple_form (2.0.3) actionpack (~> 3.0) activemodel (~> 3.0) - sinatra (1.3.3) - rack (~> 1.3, >= 1.3.6) - rack-protection (~> 1.2) + sinatra (1.3.6) + rack (~> 1.4) + rack-protection (~> 1.3) tilt (~> 1.3, >= 1.3.3) sprockets (2.2.2) hike (~> 1.2) @@ -193,7 +233,7 @@ GEM therubyracer (0.10.2) libv8 (~> 3.3.10) thor (0.17.0) - tilt (1.3.6) + tilt (1.4.1) treetop (1.4.12) polyglot polyglot (>= 0.3.1) @@ -227,8 +267,11 @@ DEPENDENCIES better_errors binding_of_caller bullet + capistrano (= 2.13.5) + capistrano-ext client_side_validations coffee-rails (~> 3.2.1) + common_deploy! daemons exception_notification haml-rails diff --git a/config/deploy.rb.SAMPLE b/config/deploy.rb.SAMPLE new file mode 100644 index 00000000..a5d61193 --- /dev/null +++ b/config/deploy.rb.SAMPLE @@ -0,0 +1,46 @@ +require 'bundler/setup' +require 'common_deploy' + +set :application, 'foodsoft' +set :domain, 'foodsoft.com' +set :user, 'foodsoft' +set :default_stage, 'staging' +set :keep_releases, 5 +set :deploy_to, "/mnt/apps/#{application}_#{stage}" +set :repository, 'git@github.com:foodcoops/foodsoft.git' + + +# resque worker +role :resque_worker, domain +role :resque_scheduler, domain +set :workers, { "foodsoft_notifier" => 1 } + + +# rvm +# set :rvm_ruby_string, :local + + +server domain, :web, :app, :db + +# Loads all needed capistrano extensions +load_extensions :bundler, + # :rvm, # if you are using rvm on your server uncomment this line + :passenger, + :multistage, + :resque, + :whenever, + :assets + + +# clean up old releases on each deploy +after "deploy:restart", "deploy:cleanup" + +# restart resque +after "deploy:restart", "resque:restart" + +# update cron +after "deploy:restart", "whenever:update_crontab" + +# install rvm and ruby on every deploy +# before 'deploy', 'rvm:install_rvm' # update RVM +# before 'deploy', 'rvm:install_ruby' # install Ruby and create gemset (both if missing) \ No newline at end of file