capper 0.9.23 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use --create ruby-1.9.3-p125@capper
1
+ rvm use --create ruby-1.9.3-p194@capper
@@ -1,16 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capper (0.9.20)
5
- capistrano (~> 2.9.0)
4
+ capper (0.9.23)
5
+ capistrano (~> 2.12.0)
6
6
  capistrano_colors (~> 0.5.5)
7
7
  erubis
8
- rvm-capistrano
8
+ rvm-capistrano (~> 1.2.3)
9
9
 
10
10
  GEM
11
11
  remote: http://rubygems.org/
12
12
  specs:
13
- capistrano (2.9.0)
13
+ capistrano (2.12.0)
14
14
  highline
15
15
  net-scp (>= 1.0.0)
16
16
  net-sftp (>= 2.0.0)
@@ -18,15 +18,15 @@ GEM
18
18
  net-ssh-gateway (>= 1.1.0)
19
19
  capistrano_colors (0.5.5)
20
20
  erubis (2.7.0)
21
- highline (1.6.12)
21
+ highline (1.6.13)
22
22
  net-scp (1.0.4)
23
23
  net-ssh (>= 1.99.1)
24
24
  net-sftp (2.0.5)
25
25
  net-ssh (>= 2.0.9)
26
- net-ssh (2.3.0)
26
+ net-ssh (2.5.2)
27
27
  net-ssh-gateway (1.1.0)
28
28
  net-ssh (>= 1.99.1)
29
- rvm-capistrano (1.1.0)
29
+ rvm-capistrano (1.2.3)
30
30
  capistrano (>= 2.0.0)
31
31
 
32
32
  PLATFORMS
data/README.rst CHANGED
@@ -19,6 +19,12 @@ Capper provides sane defaults and many recipes for technologies typically used
19
19
  with Ruby and Python deployments to make ``config/deploy.rb`` much more
20
20
  declarative and terse.
21
21
 
22
+ Release Notes
23
+ =============
24
+
25
+ v1.0.0 (14/07/2012)
26
+ capper has been in production for about 1 year and its API is now considered stable.
27
+
22
28
  Usage
23
29
  =====
24
30
 
@@ -133,6 +139,18 @@ The above snippet will create symlinks from
133
139
  ``#{release_path}/public/uploads`` after ``deploy:update_code`` has run.
134
140
 
135
141
 
142
+ airbrake
143
+ --------
144
+
145
+ The airbrake recipe is merely a copy of airbrakes native capistrano integration
146
+ without after/before hooks, so airbrake notifications can be enabled on-demand
147
+ in stage blocks::
148
+
149
+ stage :production do
150
+ ...
151
+ after "deploy", "airbrake:notify"
152
+ end
153
+
136
154
  bundler
137
155
  -------
138
156
 
@@ -170,18 +188,6 @@ django
170
188
 
171
189
  The django recipe provides setup and migrate tasks for Django.
172
190
 
173
- hoptoad
174
- -------
175
-
176
- The hoptoad recipe is merely a copy of hoptoads native capistrano integration
177
- without after/before hooks, so hoptoad notifications can be enabled on-demand
178
- in stage blocks::
179
-
180
- stage :production do
181
- ...
182
- after "deploy", "hoptoad:notify"
183
- end
184
-
185
191
  monit
186
192
  -----
187
193
 
@@ -203,23 +209,6 @@ The rails recipe sets the default ``rails_env`` to production and includes
203
209
  tasks for deploying the asset pipeline for rails 3.1 applications. It also
204
210
  provdes a migrate task for Rails applications.
205
211
 
206
- resque
207
- ------
208
-
209
- The resque recipe provides integration with Resque. A script to
210
- start/stop resque workers is uploaded to ``#{bin_path}/resque``. The
211
- script supports multiple instances with queue names.
212
-
213
- If monit integration has been enabled via ``capper/monit`` workers are
214
- automatically (re)started during deploy and can be specified via
215
- ``resque_workers``::
216
-
217
- set :resque_workers, {
218
- :important => :important,
219
- :worker1 => :default,
220
- :worker2 => :default
221
- }
222
-
223
212
  rvm
224
213
  ---
225
214
 
@@ -227,8 +216,8 @@ The rvm recipe is an extension to RVMs native capistrano integration. The
227
216
  recipe forces the ``rvm_type`` to ``:user`` and will automatically determine
228
217
  the ruby version and gemset via the projects ``.rvmrc``.
229
218
 
230
- A ``deploy:setup`` hook is provided to ensure the correct ruby and rubygems
231
- version is installed on all servers.
219
+ A ``deploy:setup`` hook is provided to ensure the correct rvm, ruby and rubygems
220
+ versions are installed on all servers.
232
221
 
233
222
  ruby
234
223
  ----
@@ -296,5 +285,4 @@ Contributing to capper
296
285
  Copyright
297
286
  =========
298
287
 
299
- Copyright (c) 2011 Benedikt Böhm. See LICENSE for
300
- further details.
288
+ Copyright (c) 2011-2012 Benedikt Böhm. See LICENSE for further details.
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.require_paths = ["lib"]
18
18
 
19
19
  s.add_dependency "erubis"
20
- s.add_dependency "capistrano", "~> 2.9.0"
20
+ s.add_dependency "capistrano", "~> 2.12.0"
21
21
  s.add_dependency "capistrano_colors", "~> 0.5.5"
22
- s.add_dependency "rvm-capistrano"
22
+ s.add_dependency "rvm-capistrano", "~> 1.2.3"
23
23
  end
@@ -30,9 +30,6 @@ _cset(:deploy_via, :remote_cache)
30
30
  _cset(:deploy_to) { "/var/app/#{application}" }
31
31
  _cset(:revision) { source.head }
32
32
 
33
- _cset(:ruby_exec_prefix, "")
34
- _cset(:rake) { "#{ruby_exec_prefix} rake" }
35
-
36
33
  _cset(:maintenance_basename, "maintenance")
37
34
 
38
35
  # =========================================================================
@@ -200,7 +197,7 @@ namespace :deploy do
200
197
  task :update do
201
198
  transaction do
202
199
  update_code
203
- symlink
200
+ create_symlink
204
201
  end
205
202
  end
206
203
 
@@ -237,6 +234,14 @@ namespace :deploy do
237
234
  end.join(" && "))
238
235
  end
239
236
 
237
+ desc <<-DESC
238
+ Deprecated API. This has become deploy:create_symlink, please update your recipes
239
+ DESC
240
+ task :symlink, :except => { :no_release => true } do
241
+ Kernel.warn "[Deprecation Warning] This API has changed, please hook `deploy:create_symlink` instead of `deploy:symlink`."
242
+ create_symlink
243
+ end
244
+
240
245
  desc <<-DESC
241
246
  Updates the symlink to the most recently deployed version. Capistrano works \
242
247
  by putting each new release of your application in its own directory. When \
@@ -246,7 +251,7 @@ namespace :deploy do
246
251
  deploy, including `restart') or the 'update' task (which does everything \
247
252
  except `restart').
248
253
  DESC
249
- task :symlink, :except => { :no_release => true } do
254
+ task :create_symlink, :except => { :no_release => true } do
250
255
  on_rollback do
251
256
  if previous_release
252
257
  run "rm -f #{current_path}; ln -s #{previous_release} #{current_path}; true"
@@ -300,7 +305,7 @@ namespace :deploy do
300
305
  task :migrations do
301
306
  update_code
302
307
  migrate
303
- symlink
308
+ create_symlink
304
309
  restart
305
310
  end
306
311
 
@@ -422,11 +427,11 @@ namespace :deploy do
422
427
  DESC
423
428
  task :disable, :roles => :web, :except => { :no_release => true } do
424
429
  require 'erb'
425
- on_rollback { run "rm #{shared_path}/system/#{maintenance_basename}.html" }
430
+ on_rollback { run "rm -f #{shared_path}/system/#{maintenance_basename}.html" }
426
431
 
427
432
  warn <<-EOHTACCESS
428
433
 
429
- # Please add something like this to your site's htaccess to redirect users to the maintenance page.
434
+ # Please add something like this to your site's Apache htaccess to redirect users to the maintenance page.
430
435
  # More Info: http://www.shiftcommathree.com/articles/make-your-rails-maintenance-page-respond-with-a-503
431
436
 
432
437
  ErrorDocument 503 /system/#{maintenance_basename}.html
@@ -435,6 +440,21 @@ namespace :deploy do
435
440
  RewriteCond %{DOCUMENT_ROOT}/system/#{maintenance_basename}.html -f
436
441
  RewriteCond %{SCRIPT_FILENAME} !#{maintenance_basename}.html
437
442
  RewriteRule ^.*$ - [redirect=503,last]
443
+
444
+ # Or if you are using Nginx add this to your server config:
445
+
446
+ root #{current_path}/public;
447
+ try_files $uri/index.html $uri.html $uri @application;
448
+
449
+ error_page 503 /system/maintenance.html;
450
+
451
+ location @application {
452
+ if (-f $document_root/system/maintenance.html) {
453
+ return 503;
454
+ }
455
+
456
+ proxy_pass ...;
457
+ }
438
458
  EOHTACCESS
439
459
 
440
460
  upload_template_file("maintenance.html",
@@ -449,7 +469,7 @@ namespace :deploy do
449
469
  web-accessible again.
450
470
  DESC
451
471
  task :enable, :roles => :web, :except => { :no_release => true } do
452
- run "rm #{shared_path}/system/#{maintenance_basename}.html"
472
+ run "rm -f #{shared_path}/system/#{maintenance_basename}.html"
453
473
  end
454
474
  end
455
475
  end
@@ -28,9 +28,4 @@ namespace :bundle do
28
28
  "fi"
29
29
  run "mkdir -p #{bundle_dir}"
30
30
  end
31
-
32
- desc "Clear the current bundle"
33
- task :clear do
34
- run "rm -rf #{bundle_dir}"
35
- end
36
31
  end
@@ -5,7 +5,7 @@ after 'deploy:update_code', 'django:setup'
5
5
  before 'deploy:migrate', 'django:migrate'
6
6
 
7
7
  namespace :django do
8
- desc "Generate rails configuration and helpers"
8
+ desc "Generate django configuration and helpers"
9
9
  task :setup, :roles => :app, :except => { :no_release => true } do
10
10
  upload_template_file("manage.py",
11
11
  File.join(bin_path, "manage.py"),
@@ -1,4 +1,5 @@
1
1
  _cset(:ruby_exec_prefix, "")
2
+ _cset(:ruby) { "#{ruby_exec_prefix} ruby" }
2
3
  _cset(:rake) { "#{ruby_exec_prefix} rake" }
3
4
 
4
5
  before "deploy:setup", "gemrc:setup"
@@ -1,20 +1,28 @@
1
1
  load "capper/ruby"
2
2
 
3
- require 'rvm/capistrano'
3
+ # workaround broken capistrano detection in rvm
4
+ require "capistrano"
5
+ Kernel.const_set("Capistrano", Capistrano)
6
+
7
+ require "rvm/capistrano"
4
8
 
5
9
  set(:rvm_type, :user)
6
10
  set(:rvm_ruby_string, File.read(".rvmrc").gsub(/^rvm( use)? --create (.*)/, '\2').strip)
7
11
 
8
- _cset(:rvm_version, "1.11.7")
9
- _cset(:rvm_installer_url, "http://get.rvm.io")
12
+ _cset(:rvm_version, "1.14.5")
13
+ set(:rvm_install_type) { rvm_version }
14
+
15
+ before "deploy:setup", "rvm:install_ruby"
16
+ before "rvm:install_ruby", "rvm:install_rvm"
17
+ before "rvm:install_rvm", "rvm:install_rvmrc"
18
+ after "rvm:install_ruby", "rvm:auto_gem"
19
+ after "rvm:install_ruby", "rvm:install_rubygems"
10
20
 
11
- before "deploy:setup", "rvm:setup"
12
- after "deploy:symlink", "rvm:trust_rvmrc"
21
+ after "deploy:create_symlink", "rvm:trust_rvmrc"
13
22
 
14
23
  namespace :rvm do
15
- desc "Install RVM and Ruby"
16
- task :setup, :except => {:no_release => true} do
17
- # setup rvmrc
24
+ desc "Install a global .rvmrc"
25
+ task :install_rvmrc, :except => {:no_release => true} do
18
26
  rvmrc = <<-EOS
19
27
  export rvm_path="#{deploy_to}/.rvm"
20
28
  export rvm_verbose_flag=0
@@ -22,41 +30,16 @@ export rvm_gem_options="--no-rdoc --no-ri"
22
30
  EOS
23
31
 
24
32
  put(rvmrc, "#{deploy_to}/.rvmrc")
33
+ end
25
34
 
26
- # download rvm installer
27
- run("curl -s -L #{rvm_installer_url} > #{deploy_to}/rvm-installer; " +
28
- "chmod +x #{deploy_to}/rvm-installer",
29
- :shell => "/bin/bash")
30
-
31
- # install rvm
32
- run("if ! test -d #{deploy_to}/.rvm; then " +
33
- "#{deploy_to}/rvm-installer --branch #{rvm_version}; fi",
34
- :shell => "/bin/bash")
35
-
36
- # update rvm if version differs
37
- run("source ~/.rvm/scripts/rvm && " +
38
- "if ! rvm version | grep -q 'rvm #{rvm_version}'; then " +
39
- "#{deploy_to}/rvm-installer --branch #{rvm_version}; fi",
40
- :shell => "/bin/bash")
41
-
42
- # remove rvm installer
43
- run("rm -f #{deploy_to}/rvm-installer",
44
- :shell => "/bin/bash")
45
-
46
- # install requested ruby version
47
- wo_gemset = rvm_ruby_string.gsub(/@.*/, '')
48
-
49
- run("echo silent > ~/.curlrc", :shell => "/bin/bash")
50
- run("source ~/.rvm/scripts/rvm && " +
51
- "if ! rvm list rubies | grep -q #{wo_gemset}; then " +
52
- "rvm install #{wo_gemset}; fi && " +
53
- "rvm use --create #{rvm_ruby_string} >/dev/null",
54
- :shell => "/bin/bash")
55
- run("rm ~/.curlrc")
56
-
57
- # this ensures that Gentoos declare -x RUBYOPT="-rauto_gem" is ignored.
35
+ desc "Ensure that Gentoos declare -x RUBYOPT=\"-rauto_gem\" is ignored"
36
+ task :auto_gem do
37
+ wo_gemset = rvm_ruby_string.split('@').first
58
38
  run "touch ~/.rvm/rubies/#{wo_gemset}/lib/ruby/site_ruby/auto_gem.rb"
39
+ end
59
40
 
41
+ desc "Install the specified rubygems version"
42
+ task :install_rubygems do
60
43
  # if specified freeze rubygems version, otherwise don't touch it
61
44
  if fetch(:rvm_rubygems_version, false)
62
45
  run("rvm rubygems #{rvm_rubygems_version}")
@@ -68,6 +51,11 @@ export rvm_gem_options="--no-rdoc --no-ri"
68
51
  run "cd #{current_release} && rvm --force gemset empty"
69
52
  end
70
53
 
54
+ desc "Reinstall the current ruby version"
55
+ task :reinstall do
56
+ set(:rvm_install_ruby, :reinstall)
57
+ end
58
+
71
59
  # prevents interactive rvm dialog
72
60
  task :trust_rvmrc, :except => {:no_release => true} do
73
61
  run "rvm rvmrc trust #{release_path} >/dev/null"
@@ -19,4 +19,4 @@ if [[ $# -ge 1 ]]; then
19
19
  MAX="--max-priority $1" && shift
20
20
  fi
21
21
 
22
- exec <%= ruby_exec_prefix %> ./script/delayed_job $CMD --prefix <%= application %> --identifier $ID --pid-dir=<%= pid_path %> $MIN $MAX
22
+ exec <%= ruby %> ./script/delayed_job $CMD --prefix <%= application %> --identifier $ID --pid-dir=<%= pid_path %> $MIN $MAX
@@ -9,7 +9,7 @@ fi
9
9
  cd <%= current_path %> >/dev/null
10
10
 
11
11
  if [[ -e ./script/console ]]; then
12
- exec <%= ruby_exec_prefix %> ruby ./script/console
12
+ exec <%= ruby %> ./script/console
13
13
  else
14
- exec <%= ruby_exec_prefix %> ruby ./script/rails console
14
+ exec <%= ruby %> ./script/rails console
15
15
  fi
@@ -1,3 +1,3 @@
1
1
  module Capper
2
- VERSION = "0.9.23"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -7,7 +7,7 @@ set(:whenever_update_flags) { "--update-crontab #{whenever_identifier} --set env
7
7
  set(:whenever_clear_flags) { "--clear-crontab #{whenever_identifier}" }
8
8
 
9
9
  after "deploy:update_code", "whenever:clear_crontab"
10
- after "deploy:symlink", "whenever:update_crontab"
10
+ after "deploy:create_symlink", "whenever:update_crontab"
11
11
  after "deploy:rollback", "whenever:update_crontab"
12
12
 
13
13
  namespace :whenever do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.23
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-02 00:00:00.000000000 Z
12
+ date: 2012-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
16
- requirement: &16657880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,21 +21,31 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16657880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: capistrano
27
- requirement: &16654740 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: 2.9.0
37
+ version: 2.12.0
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *16654740
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.12.0
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: capistrano_colors
38
- requirement: &16651620 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
@@ -43,18 +53,28 @@ dependencies:
43
53
  version: 0.5.5
44
54
  type: :runtime
45
55
  prerelease: false
46
- version_requirements: *16651620
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.5.5
47
62
  - !ruby/object:Gem::Dependency
48
63
  name: rvm-capistrano
49
- requirement: &16666500 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
50
65
  none: false
51
66
  requirements:
52
- - - ! '>='
67
+ - - ~>
53
68
  - !ruby/object:Gem::Version
54
- version: '0'
69
+ version: 1.2.3
55
70
  type: :runtime
56
71
  prerelease: false
57
- version_requirements: *16666500
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.2.3
58
78
  description: Capper is a collection of opinionated Capistrano recipes
59
79
  email:
60
80
  - bb@xnull.de
@@ -81,14 +101,12 @@ files:
81
101
  - lib/capper/multistage.rb
82
102
  - lib/capper/python.rb
83
103
  - lib/capper/rails.rb
84
- - lib/capper/resque.rb
85
104
  - lib/capper/ruby.rb
86
105
  - lib/capper/rvm.rb
87
106
  - lib/capper/templates/delayed_job.sh.erb
88
107
  - lib/capper/templates/maintenance.html.erb
89
108
  - lib/capper/templates/manage.py.erb
90
109
  - lib/capper/templates/rails.console.sh.erb
91
- - lib/capper/templates/resque.sh.erb
92
110
  - lib/capper/templates/unicorn.rb.erb
93
111
  - lib/capper/templates/unicorn.sh.erb
94
112
  - lib/capper/templates/uwsgi.sh.erb
@@ -121,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
139
  version: '0'
122
140
  requirements: []
123
141
  rubyforge_project:
124
- rubygems_version: 1.8.17
142
+ rubygems_version: 1.8.24
125
143
  signing_key:
126
144
  specification_version: 3
127
145
  summary: Capper is a collection of opinionated Capistrano recipes
@@ -1,40 +0,0 @@
1
- # configuration variables
2
- _cset(:resque_workers, {})
3
-
4
- # these cannot be overriden
5
- set(:resque_script) { File.join(bin_path, "resque") }
6
-
7
- after "deploy:update_code", "resque:setup"
8
- after "deploy:restart", "resque:restart"
9
-
10
- monit_config "resque", <<EOF, :roles => :worker
11
- <% resque_workers.each do |name, queue| %>
12
- check process resque_<%= name %>
13
- with pidfile <%= pid_path %>/resque.<%= name %>.pid
14
- <% if queue.nil? %>
15
- start program = "<%= resque_script %> <%= name %> * start"
16
- stop program = "<%= resque_script %> <%= name %> * stop"
17
- <% else %>
18
- start program = "<%= resque_script %> <%= name %> <%= queue %> start"
19
- stop program = "<%= resque_script %> <%= name %> <%= queue %> stop"
20
- <% end %>
21
- group resque
22
-
23
- <% end %>
24
- EOF
25
-
26
- namespace :resque do
27
- desc "Generate resque configuration files"
28
- task :setup, :roles => :worker, :except => { :no_release => true } do
29
- upload_template_file("resque.sh",
30
- resque_script,
31
- :mode => "0755")
32
- end
33
-
34
- desc "Restart resque workers"
35
- task :restart, :roles => :worker, :except => { :no_release => true } do
36
- if fetch(:monitrc, false)
37
- run "monit -g resque restart all"
38
- end
39
- end
40
- end
@@ -1,34 +0,0 @@
1
- #!/bin/bash
2
- export HOME=<%= deploy_to %>
3
- export RAILS_ENV=<%= rails_env %>
4
-
5
- if [[ -e "${HOME}"/.rvm/scripts/rvm ]]; then
6
- source "${HOME}"/.rvm/scripts/rvm
7
- fi
8
-
9
- WORKER="$1" && shift
10
- QUEUE="$1" && shift
11
-
12
- PIDFILE=<%= pid_path %>/resque.${WORKER}.pid
13
- CMD="<%= rake %> environment resque:work QUEUE=${QUEUE} PIDFILE=${PIDFILE}"
14
-
15
- cd <%= current_path %> >/dev/null
16
-
17
- sig () {
18
- test -s "$PIDFILE" && kill -$1 $(<$PIDFILE)
19
- }
20
-
21
- case $1 in
22
- start)
23
- sig 0 && echo >&2 "Already running" && exit 0
24
- exec $CMD
25
- ;;
26
- stop)
27
- sig TERM && exit 0
28
- echo >&2 "Not running"
29
- ;;
30
- *)
31
- echo >&2 "Usage: $0 <start|stop>"
32
- exit 1
33
- ;;
34
- esac