Commit 862f2cb1

mo khan <mo@mokhan.ca>
2014-08-23 03:18:50
move old cap to old_cap folder.
1 parent dc568f8
config/deploy.rb
@@ -1,38 +1,58 @@
-require 'bundler/capistrano'
-require 'dotenv/deployment/capistrano'
-
-load "config/recipes/environments"
-load "config/recipes/base"
-load "config/recipes/nginx"
-load "config/recipes/unicorn"
-load "config/recipes/postgresql"
-load "config/recipes/delayed_job"
-load "config/recipes/monit"
-load "config/tasks/utility"
-load "config/tasks/rails"
-
-set :application, "cakeside"
-set :user, "deployer"
-set :use_sudo, false
-default_run_options[:pty] = true # password prompt
-
-# git
-set :scm, :git
-set :scm_verbose, true
-set :repository,  "git@bitbucket.org:cakeside/cakeside.git"
-set :branch, "master"
-set :deploy_via, :remote_cache
-
-#copy
-#set :scm, :none
-#set :repository, "."
-#set :deploy_via, :copy
-
-set :deploy_to, "/home/#{user}/apps/#{application}"
-set :keep_releases, 3
-set :normalize_asset_timestamps, false
-set :ssh_options, {:forward_agent => true}
-
-after "deploy", "deploy:cleanup" # remove old releases
-
-require './config/boot'
+# config valid only for Capistrano 3.1
+lock '3.2.1'
+
+set :application, 'cakeside'
+set :repo_url, 'git@bitbucket.org:cakeside/cakeside.git'
+
+# Default branch is :master
+# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
+
+# Default deploy_to directory is /var/www/my_app
+# set :deploy_to, '/var/www/my_app'
+
+# Default value for :scm is :git
+# set :scm, :git
+
+# Default value for :format is :pretty
+# set :format, :pretty
+
+# Default value for :log_level is :debug
+# set :log_level, :debug
+
+# Default value for :pty is false
+# set :pty, true
+
+# Default value for :linked_files is []
+# set :linked_files, %w{config/database.yml}
+
+# Default value for linked_dirs is []
+# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}
+
+# Default value for default_env is {}
+# set :default_env, { path: "/opt/ruby/bin:$PATH" }
+
+# Default value for keep_releases is 5
+# set :keep_releases, 5
+
+namespace :deploy do
+
+  desc 'Restart application'
+  task :restart do
+    on roles(:app), in: :sequence, wait: 5 do
+      # Your restart mechanism here, for example:
+      # execute :touch, release_path.join('tmp/restart.txt')
+    end
+  end
+
+  after :publishing, :restart
+
+  after :restart, :clear_cache do
+    on roles(:web), in: :groups, limit: 3, wait: 10 do
+      # Here we can do anything such as:
+      # within release_path do
+      #   execute :rake, 'cache:clear'
+      # end
+    end
+  end
+
+end
config/recipes/templates/500.sh.erb → old_cap/recipes/templates/500.sh.erb
File renamed without changes
config/recipes/base.rb → old_cap/recipes/base.rb
File renamed without changes
config/recipes/delayed_job.rb → old_cap/recipes/delayed_job.rb
File renamed without changes
config/recipes/environments.rb → old_cap/recipes/environments.rb
File renamed without changes
config/recipes/monit.rb → old_cap/recipes/monit.rb
File renamed without changes
config/recipes/nginx.rb → old_cap/recipes/nginx.rb
File renamed without changes
config/recipes/postgresql.rb → old_cap/recipes/postgresql.rb
File renamed without changes
config/recipes/unicorn.rb → old_cap/recipes/unicorn.rb
File renamed without changes
config/tasks/rails.rb → old_cap/tasks/rails.rb
File renamed without changes
config/tasks/utility.rb → old_cap/tasks/utility.rb
File renamed without changes
old_cap/Capfile
@@ -0,0 +1,3 @@
+load 'deploy'
+load 'deploy/assets'
+load 'config/deploy' # remove this line to skip loading any of the default tasks
old_cap/deploy.rb
@@ -0,0 +1,38 @@
+require 'bundler/capistrano'
+require 'dotenv/deployment/capistrano'
+
+load "config/recipes/environments"
+load "config/recipes/base"
+load "config/recipes/nginx"
+load "config/recipes/unicorn"
+load "config/recipes/postgresql"
+load "config/recipes/delayed_job"
+load "config/recipes/monit"
+load "config/tasks/utility"
+load "config/tasks/rails"
+
+set :application, "cakeside"
+set :user, "deployer"
+set :use_sudo, false
+default_run_options[:pty] = true # password prompt
+
+# git
+set :scm, :git
+set :scm_verbose, true
+set :repository,  "git@bitbucket.org:cakeside/cakeside.git"
+set :branch, "master"
+set :deploy_via, :remote_cache
+
+#copy
+#set :scm, :none
+#set :repository, "."
+#set :deploy_via, :copy
+
+set :deploy_to, "/home/#{user}/apps/#{application}"
+set :keep_releases, 3
+set :normalize_asset_timestamps, false
+set :ssh_options, {:forward_agent => true}
+
+after "deploy", "deploy:cleanup" # remove old releases
+
+require './config/boot'
Capfile
@@ -1,3 +1,25 @@
-load 'deploy'
-load 'deploy/assets'
-load 'config/deploy' # remove this line to skip loading any of the default tasks
+# Load DSL and Setup Up Stages
+require 'capistrano/setup'
+
+# Includes default deployment tasks
+require 'capistrano/deploy'
+
+# Includes tasks from other gems included in your Gemfile
+#
+# For documentation on these, see for example:
+#
+#   https://github.com/capistrano/rvm
+#   https://github.com/capistrano/rbenv
+#   https://github.com/capistrano/chruby
+#   https://github.com/capistrano/bundler
+#   https://github.com/capistrano/rails
+#
+# require 'capistrano/rvm'
+# require 'capistrano/rbenv'
+# require 'capistrano/chruby'
+# require 'capistrano/bundler'
+# require 'capistrano/rails/assets'
+# require 'capistrano/rails/migrations'
+
+# Loads custom tasks from `lib/capistrano/tasks' if you have any defined.
+Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
Gemfile
@@ -38,8 +38,12 @@ gem 'ejs', '~> 1.1.1'
 gem 'js-routes', '~> 0.9.8'
 
 group :development do
-  gem 'capistrano', '~> 2.15.5'
-  gem 'capistrano-ext', '~> 1.2.1'
+  #gem 'capistrano', '~> 2.15.5'
+  #gem 'capistrano-ext', '~> 1.2.1'
+  gem 'capistrano', '~> 3.0', require: false
+  gem 'capistrano-rails', '~> 1.1', require: false
+  gem 'capistrano-bundler', '~> 1.1', require: false
+  gem 'capistrano-rbenv', '~> 2.0', require: false
   gem 'bullet'
   gem 'better_errors'
   gem 'lol_dba'
Gemfile.lock
@@ -52,14 +52,19 @@ GEM
     bullet (4.13.1)
       activesupport (>= 3.0.0)
       uniform_notifier (>= 1.6.0)
-    capistrano (2.15.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 (3.2.1)
+      i18n
+      rake (>= 10.0.0)
+      sshkit (~> 1.3)
+    capistrano-bundler (1.1.3)
+      capistrano (~> 3.1)
+      sshkit (~> 1.2)
+    capistrano-rails (1.1.1)
+      capistrano (~> 3.1)
+      capistrano-bundler (~> 1.1)
+    capistrano-rbenv (2.0.2)
+      capistrano (~> 3.1)
+      sshkit (~> 1.3)
     capybara (2.4.1)
       mime-types (>= 1.16)
       nokogiri (>= 1.3.3)
@@ -81,6 +86,7 @@ GEM
       coffee-script-source
       execjs
     coffee-script-source (1.7.0)
+    colorize (0.7.3)
     daemons (1.1.9)
     dalli (2.7.2)
     database_cleaner (1.3.0)
@@ -146,7 +152,6 @@ GEM
     gibbon (1.1.3)
       httparty
       multi_json (>= 1.3.4)
-    highline (1.6.21)
     hike (1.2.3)
     http (0.6.1)
       http_parser.rb (~> 0.6.0)
@@ -193,11 +198,7 @@ GEM
     naught (1.0.0)
     net-scp (1.2.1)
       net-ssh (>= 2.6.5)
-    net-sftp (2.1.2)
-      net-ssh (>= 2.6.5)
     net-ssh (2.9.1)
-    net-ssh-gateway (1.2.0)
-      net-ssh (>= 2.6.5)
     newrelic_rpm (3.9.0.229)
     nokogiri (1.6.2.1)
       mini_portile (= 0.6.0)
@@ -281,6 +282,10 @@ GEM
       activesupport (>= 3.0)
       sprockets (~> 2.8)
     sqlite3 (1.3.9)
+    sshkit (1.5.1)
+      colorize
+      net-scp (>= 1.1.2)
+      net-ssh (>= 2.8.0)
     subexec (0.2.3)
     teaspoon (0.8.0)
       railties (>= 3.2.5, < 5)
@@ -332,8 +337,10 @@ DEPENDENCIES
   binding_of_caller
   bootstrap-sass (~> 2.3.0)
   bullet
-  capistrano (~> 2.15.5)
-  capistrano-ext (~> 1.2.1)
+  capistrano (~> 3.0)
+  capistrano-bundler (~> 1.1)
+  capistrano-rails (~> 1.1)
+  capistrano-rbenv (~> 2.0)
   capybara
   carrierwave (~> 0.9.0)
   coffee-rails (~> 4.0.0)