capistrano-exts 1.12.1 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/examples/php_fpm/deploy/development.rb +27 -0
- data/examples/php_fpm/deploy/production.rb +27 -0
- data/examples/php_fpm/deploy/staging.rb +27 -0
- data/examples/php_fpm/deploy.rb +13 -6
- data/examples/rails_passenger/deploy/development.rb +27 -0
- data/examples/rails_passenger/deploy/production.rb +27 -0
- data/examples/rails_passenger/deploy/staging.rb +27 -0
- data/examples/rails_passenger/deploy.rb +13 -6
- data/examples/rails_reverse_proxy/deploy/development.rb +27 -0
- data/examples/rails_reverse_proxy/deploy/production.rb +27 -0
- data/examples/rails_reverse_proxy/deploy/staging.rb +27 -0
- data/examples/rails_reverse_proxy/deploy.rb +13 -6
- data/lib/capistrano-exts/receipts/functions.rb +7 -0
- data/lib/capistrano-exts/receipts/god.rb +0 -3
- data/lib/capistrano-exts/receipts/mysql.rb +2 -2
- data/lib/capistrano-exts/receipts/rails.rb +1 -0
- data/lib/capistrano-exts/receipts/rvm.rb +90 -0
- data/lib/capistrano-exts/receipts/servers/web_server/nginx.rb +9 -5
- data/lib/capistrano-exts/receipts/servers/web_server.rb +8 -8
- data/lib/capistrano-exts/receipts.rb +1 -1
- data/lib/capistrano-exts/templates/multistage.rb +27 -3
- data/lib/capistrano-exts/version.rb +2 -2
- metadata +18 -17
data/README.md
CHANGED
@@ -237,6 +237,33 @@ set :php_fpm_port, '9000'
|
|
237
237
|
#
|
238
238
|
#############
|
239
239
|
|
240
|
+
#############
|
241
|
+
# Rvm
|
242
|
+
#
|
243
|
+
|
244
|
+
# Enable RVM?
|
245
|
+
set :enable_rvm, false
|
246
|
+
|
247
|
+
# What's the type of rvm ?
|
248
|
+
# :system and :user
|
249
|
+
set :rvm_type, :system
|
250
|
+
|
251
|
+
# What rvm string should we use ?
|
252
|
+
set :rvm_ruby_string, "1.9.2"
|
253
|
+
|
254
|
+
# Set the rvm_path, usually you should define rvm_type
|
255
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
256
|
+
# the user, but if your is installed somewhere different from the default path
|
257
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
258
|
+
# set :rvm_path, "/path/to/rvm"
|
259
|
+
|
260
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
261
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
262
|
+
|
263
|
+
#
|
264
|
+
#
|
265
|
+
#############
|
266
|
+
|
240
267
|
#############
|
241
268
|
# Unicorn
|
242
269
|
#
|
@@ -236,6 +236,33 @@ set :php_fpm_port, '9000'
|
|
236
236
|
#
|
237
237
|
#############
|
238
238
|
|
239
|
+
#############
|
240
|
+
# Rvm
|
241
|
+
#
|
242
|
+
|
243
|
+
# Enable RVM?
|
244
|
+
set :enable_rvm, false
|
245
|
+
|
246
|
+
# What's the type of rvm ?
|
247
|
+
# :system and :user
|
248
|
+
set :rvm_type, :system
|
249
|
+
|
250
|
+
# What rvm string should we use ?
|
251
|
+
set :rvm_ruby_string, "1.9.2"
|
252
|
+
|
253
|
+
# Set the rvm_path, usually you should define rvm_type
|
254
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
255
|
+
# the user, but if your is installed somewhere different from the default path
|
256
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
257
|
+
# set :rvm_path, "/path/to/rvm"
|
258
|
+
|
259
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
260
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
261
|
+
|
262
|
+
#
|
263
|
+
#
|
264
|
+
#############
|
265
|
+
|
239
266
|
#############
|
240
267
|
# Unicorn
|
241
268
|
#
|
@@ -236,6 +236,33 @@ set :php_fpm_port, '9000'
|
|
236
236
|
#
|
237
237
|
#############
|
238
238
|
|
239
|
+
#############
|
240
|
+
# Rvm
|
241
|
+
#
|
242
|
+
|
243
|
+
# Enable RVM?
|
244
|
+
set :enable_rvm, false
|
245
|
+
|
246
|
+
# What's the type of rvm ?
|
247
|
+
# :system and :user
|
248
|
+
set :rvm_type, :system
|
249
|
+
|
250
|
+
# What rvm string should we use ?
|
251
|
+
set :rvm_ruby_string, "1.9.2"
|
252
|
+
|
253
|
+
# Set the rvm_path, usually you should define rvm_type
|
254
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
255
|
+
# the user, but if your is installed somewhere different from the default path
|
256
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
257
|
+
# set :rvm_path, "/path/to/rvm"
|
258
|
+
|
259
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
260
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
261
|
+
|
262
|
+
#
|
263
|
+
#
|
264
|
+
#############
|
265
|
+
|
239
266
|
#############
|
240
267
|
# Unicorn
|
241
268
|
#
|
data/examples/php_fpm/deploy.rb
CHANGED
@@ -20,19 +20,26 @@ set :capistrano_extensions, [:multistage, :git, :deploy, :mysql, :contao, :serve
|
|
20
20
|
default_run_options[:pty] = true
|
21
21
|
ssh_options[:forward_agent] = true
|
22
22
|
|
23
|
+
# Bundler
|
24
|
+
# set :bundle_gemfile, "Gemfile"
|
25
|
+
# set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
|
26
|
+
# set :bundle_flags, "--deployment --quiet"
|
27
|
+
# set :bundle_without, [:development, :test]
|
28
|
+
# set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
|
29
|
+
# set :bundle_roles, [:app]
|
30
|
+
|
23
31
|
##################
|
24
32
|
## DEPENDENCIES ##
|
25
33
|
##################
|
26
34
|
|
27
35
|
after "deploy", "deploy:cleanup" # keeps only last 5 releases
|
28
36
|
|
29
|
-
|
30
|
-
##
|
31
|
-
|
37
|
+
##################
|
38
|
+
## REQUIREMENTS ##
|
39
|
+
##################
|
32
40
|
|
33
41
|
# Require capistrano-exts
|
34
42
|
require 'capistrano-exts'
|
35
43
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# require "rvm/capistrano"
|
44
|
+
# Require bundler tasks
|
45
|
+
# require 'bundler/capistrano'
|
@@ -237,6 +237,33 @@ set :web_server_mode, :passenger
|
|
237
237
|
#
|
238
238
|
#############
|
239
239
|
|
240
|
+
#############
|
241
|
+
# Rvm
|
242
|
+
#
|
243
|
+
|
244
|
+
# Enable RVM?
|
245
|
+
set :enable_rvm, true
|
246
|
+
|
247
|
+
# What's the type of rvm ?
|
248
|
+
# :system and :user
|
249
|
+
set :rvm_type, :system
|
250
|
+
|
251
|
+
# What rvm string should we use ?
|
252
|
+
set :rvm_ruby_string, "1.9.2"
|
253
|
+
|
254
|
+
# Set the rvm_path, usually you should define rvm_type
|
255
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
256
|
+
# the user, but if your is installed somewhere different from the default path
|
257
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
258
|
+
# set :rvm_path, "/path/to/rvm"
|
259
|
+
|
260
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
261
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
262
|
+
|
263
|
+
#
|
264
|
+
#
|
265
|
+
#############
|
266
|
+
|
240
267
|
#############
|
241
268
|
# Unicorn
|
242
269
|
#
|
@@ -237,6 +237,33 @@ set :web_server_mode, :passenger
|
|
237
237
|
#
|
238
238
|
#############
|
239
239
|
|
240
|
+
#############
|
241
|
+
# Rvm
|
242
|
+
#
|
243
|
+
|
244
|
+
# Enable RVM?
|
245
|
+
set :enable_rvm, true
|
246
|
+
|
247
|
+
# What's the type of rvm ?
|
248
|
+
# :system and :user
|
249
|
+
set :rvm_type, :system
|
250
|
+
|
251
|
+
# What rvm string should we use ?
|
252
|
+
set :rvm_ruby_string, "1.9.2"
|
253
|
+
|
254
|
+
# Set the rvm_path, usually you should define rvm_type
|
255
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
256
|
+
# the user, but if your is installed somewhere different from the default path
|
257
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
258
|
+
# set :rvm_path, "/path/to/rvm"
|
259
|
+
|
260
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
261
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
262
|
+
|
263
|
+
#
|
264
|
+
#
|
265
|
+
#############
|
266
|
+
|
240
267
|
#############
|
241
268
|
# Unicorn
|
242
269
|
#
|
@@ -237,6 +237,33 @@ set :web_server_mode, :passenger
|
|
237
237
|
#
|
238
238
|
#############
|
239
239
|
|
240
|
+
#############
|
241
|
+
# Rvm
|
242
|
+
#
|
243
|
+
|
244
|
+
# Enable RVM?
|
245
|
+
set :enable_rvm, true
|
246
|
+
|
247
|
+
# What's the type of rvm ?
|
248
|
+
# :system and :user
|
249
|
+
set :rvm_type, :system
|
250
|
+
|
251
|
+
# What rvm string should we use ?
|
252
|
+
set :rvm_ruby_string, "1.9.2"
|
253
|
+
|
254
|
+
# Set the rvm_path, usually you should define rvm_type
|
255
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
256
|
+
# the user, but if your is installed somewhere different from the default path
|
257
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
258
|
+
# set :rvm_path, "/path/to/rvm"
|
259
|
+
|
260
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
261
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
262
|
+
|
263
|
+
#
|
264
|
+
#
|
265
|
+
#############
|
266
|
+
|
240
267
|
#############
|
241
268
|
# Unicorn
|
242
269
|
#
|
@@ -20,19 +20,26 @@ set :capistrano_extensions, [:multistage, :git, :deploy, :mysql, :rails, :server
|
|
20
20
|
default_run_options[:pty] = true
|
21
21
|
ssh_options[:forward_agent] = true
|
22
22
|
|
23
|
+
# Bundler
|
24
|
+
# set :bundle_gemfile, "Gemfile"
|
25
|
+
# set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
|
26
|
+
# set :bundle_flags, "--deployment --quiet"
|
27
|
+
# set :bundle_without, [:development, :test]
|
28
|
+
# set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
|
29
|
+
# set :bundle_roles, [:app]
|
30
|
+
|
23
31
|
##################
|
24
32
|
## DEPENDENCIES ##
|
25
33
|
##################
|
26
34
|
|
27
35
|
after "deploy", "deploy:cleanup" # keeps only last 5 releases
|
28
36
|
|
29
|
-
|
30
|
-
##
|
31
|
-
|
37
|
+
##################
|
38
|
+
## REQUIREMENTS ##
|
39
|
+
##################
|
32
40
|
|
33
41
|
# Require capistrano-exts
|
34
42
|
require 'capistrano-exts'
|
35
43
|
|
36
|
-
#
|
37
|
-
|
38
|
-
# require "rvm/capistrano"
|
44
|
+
# Require bundler tasks
|
45
|
+
require 'bundler/capistrano'
|
@@ -237,6 +237,33 @@ set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
|
|
237
237
|
#
|
238
238
|
#############
|
239
239
|
|
240
|
+
#############
|
241
|
+
# Rvm
|
242
|
+
#
|
243
|
+
|
244
|
+
# Enable RVM?
|
245
|
+
set :enable_rvm, true
|
246
|
+
|
247
|
+
# What's the type of rvm ?
|
248
|
+
# :system and :user
|
249
|
+
set :rvm_type, :system
|
250
|
+
|
251
|
+
# What rvm string should we use ?
|
252
|
+
set :rvm_ruby_string, "1.9.2"
|
253
|
+
|
254
|
+
# Set the rvm_path, usually you should define rvm_type
|
255
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
256
|
+
# the user, but if your is installed somewhere different from the default path
|
257
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
258
|
+
# set :rvm_path, "/path/to/rvm"
|
259
|
+
|
260
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
261
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
262
|
+
|
263
|
+
#
|
264
|
+
#
|
265
|
+
#############
|
266
|
+
|
240
267
|
#############
|
241
268
|
# Unicorn
|
242
269
|
#
|
@@ -250,6 +250,33 @@ set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
|
|
250
250
|
#
|
251
251
|
#############
|
252
252
|
|
253
|
+
#############
|
254
|
+
# Rvm
|
255
|
+
#
|
256
|
+
|
257
|
+
# Enable RVM?
|
258
|
+
set :enable_rvm, true
|
259
|
+
|
260
|
+
# What's the type of rvm ?
|
261
|
+
# :system and :user
|
262
|
+
set :rvm_type, :system
|
263
|
+
|
264
|
+
# What rvm string should we use ?
|
265
|
+
set :rvm_ruby_string, "1.9.2"
|
266
|
+
|
267
|
+
# Set the rvm_path, usually you should define rvm_type
|
268
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
269
|
+
# the user, but if your is installed somewhere different from the default path
|
270
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
271
|
+
# set :rvm_path, "/path/to/rvm"
|
272
|
+
|
273
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
274
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
275
|
+
|
276
|
+
#
|
277
|
+
#
|
278
|
+
#############
|
279
|
+
|
253
280
|
#############
|
254
281
|
# Unicorn
|
255
282
|
#
|
@@ -250,6 +250,33 @@ set :reverse_proxy_socket, -> { "#{shared_path}/sockets/unicorn.sock"}
|
|
250
250
|
#
|
251
251
|
#############
|
252
252
|
|
253
|
+
#############
|
254
|
+
# Rvm
|
255
|
+
#
|
256
|
+
|
257
|
+
# Enable RVM?
|
258
|
+
set :enable_rvm, true
|
259
|
+
|
260
|
+
# What's the type of rvm ?
|
261
|
+
# :system and :user
|
262
|
+
set :rvm_type, :system
|
263
|
+
|
264
|
+
# What rvm string should we use ?
|
265
|
+
set :rvm_ruby_string, "1.9.2"
|
266
|
+
|
267
|
+
# Set the rvm_path, usually you should define rvm_type
|
268
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
269
|
+
# the user, but if your is installed somewhere different from the default path
|
270
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
271
|
+
# set :rvm_path, "/path/to/rvm"
|
272
|
+
|
273
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
274
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
275
|
+
|
276
|
+
#
|
277
|
+
#
|
278
|
+
#############
|
279
|
+
|
253
280
|
#############
|
254
281
|
# Unicorn
|
255
282
|
#
|
@@ -20,19 +20,26 @@ set :capistrano_extensions, [:multistage, :git, :deploy, :mysql, :rails, :server
|
|
20
20
|
default_run_options[:pty] = true
|
21
21
|
ssh_options[:forward_agent] = true
|
22
22
|
|
23
|
+
# Bundler
|
24
|
+
# set :bundle_gemfile, "Gemfile"
|
25
|
+
# set :bundle_dir, File.join(fetch(:shared_path), 'bundle')
|
26
|
+
# set :bundle_flags, "--deployment --quiet"
|
27
|
+
# set :bundle_without, [:development, :test]
|
28
|
+
# set :bundle_cmd, "bundle" # e.g. "/opt/ruby/bin/bundle"
|
29
|
+
# set :bundle_roles, [:app]
|
30
|
+
|
23
31
|
##################
|
24
32
|
## DEPENDENCIES ##
|
25
33
|
##################
|
26
34
|
|
27
35
|
after "deploy", "deploy:cleanup" # keeps only last 5 releases
|
28
36
|
|
29
|
-
|
30
|
-
##
|
31
|
-
|
37
|
+
##################
|
38
|
+
## REQUIREMENTS ##
|
39
|
+
##################
|
32
40
|
|
33
41
|
# Require capistrano-exts
|
34
42
|
require 'capistrano-exts'
|
35
43
|
|
36
|
-
#
|
37
|
-
#
|
38
|
-
# require "rvm/capistrano"
|
44
|
+
# Require bundler tasks
|
45
|
+
# require 'bundler/capistrano'
|
@@ -7,6 +7,13 @@ unless Capistrano::Configuration.respond_to?(:instance)
|
|
7
7
|
end
|
8
8
|
|
9
9
|
Capistrano::Configuration.instance(:must_exist).load do
|
10
|
+
# Taken from the capistrano code.
|
11
|
+
def _cset(name, *args, &block)
|
12
|
+
unless exists?(name)
|
13
|
+
set(name, *args, &block)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
10
17
|
# Taken from Stackoverflow
|
11
18
|
# http://stackoverflow.com/questions/1661586/how-can-you-check-to-see-if-a-file-exists-on-the-remote-server-in-capistrano
|
12
19
|
def remote_file_exists?(full_path)
|
@@ -314,7 +314,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
314
314
|
end
|
315
315
|
|
316
316
|
desc "[internal] write database #{var.gsub(/_/, ' ')}"
|
317
|
-
task "write_#{var}" do
|
317
|
+
task "write_#{var}", :roles => :app, :except => { :no_release => true } do
|
318
318
|
unless exists?("mysql_#{var}_file".to_sym) and remote_file_exists?(fetch "mysql_#{var}_file".to_sym)
|
319
319
|
mysql_credentials_file = fetch "mysql_#{var}_file".to_sym
|
320
320
|
credentials_formatted_content = credentials_formatted(fetch "mysql_#{var}".to_sym)
|
@@ -337,7 +337,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
337
337
|
end
|
338
338
|
|
339
339
|
desc "Get Mysql #{var.gsub(/_/, ' ')}"
|
340
|
-
task "#{var}", :roles => :
|
340
|
+
task "#{var}", :roles => :db, :except => { :no_release => true } do
|
341
341
|
unless exists?("mysql_#{var}".to_sym)
|
342
342
|
# Fetch configs
|
343
343
|
mysql_credentials_host_regex = fetch "mysql_#{var}_host_regex".to_sym
|
@@ -52,5 +52,6 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
52
52
|
|
53
53
|
# Capistrano is broken
|
54
54
|
# See: https://github.com/capistrano/capistrano/issues/81
|
55
|
+
# TODO: Should be conditional, only if bundle:install exists
|
55
56
|
before "deploy:assets:precompile", "bundle:install"
|
56
57
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# Verify that Capistrano is version 2
|
2
|
+
unless Capistrano::Configuration.respond_to?(:instance)
|
3
|
+
abort "This extension requires Capistrano 2"
|
4
|
+
end
|
5
|
+
|
6
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
7
|
+
# Let users set the type of their rvm install.
|
8
|
+
_cset(:rvm_type, :system)
|
9
|
+
|
10
|
+
# Define rvm_path
|
11
|
+
# This is used in the default_shell command to pass the required variable to rvm-shell, allowing
|
12
|
+
# rvm to boostrap using the proper path. This is being lost in Capistrano due to the lack of a
|
13
|
+
# full environment.
|
14
|
+
_cset(:rvm_path) do
|
15
|
+
case rvm_type
|
16
|
+
when :root, :system
|
17
|
+
"/usr/local/rvm"
|
18
|
+
when :local, :user, :default
|
19
|
+
"$HOME/.rvm/"
|
20
|
+
else
|
21
|
+
rvm_type.to_s.empty? ? "$HOME/.rvm" : rvm_type.to_s
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Let users override the rvm_bin_path
|
26
|
+
_cset(:rvm_bin_path) do
|
27
|
+
case rvm_type
|
28
|
+
when :root, :system
|
29
|
+
"/usr/local/rvm/bin"
|
30
|
+
when :local, :user, :default
|
31
|
+
"$HOME/.rvm/bin"
|
32
|
+
else
|
33
|
+
rvm_type.to_s.empty? ? "#{rvm_path}/bin" : rvm_type.to_s
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Use the default ruby on the server, by default :)
|
38
|
+
_cset(:rvm_ruby_string, "default")
|
39
|
+
|
40
|
+
# Set the rvm shell
|
41
|
+
set :rvm_shell do
|
42
|
+
shell = "exec #{File.join(fetch(:rvm_bin_path), "rvm-shell")}"
|
43
|
+
ruby = fetch(:rvm_ruby_string).to_s.strip
|
44
|
+
shell = "rvm_path=#{fetch :rvm_path} #{shell} '#{ruby}'" unless ruby.empty?
|
45
|
+
shell
|
46
|
+
end
|
47
|
+
|
48
|
+
namespace :rvm do
|
49
|
+
desc "[internal] Upload rvm wrapper"
|
50
|
+
task :install_shell_wrapper do
|
51
|
+
if exists?(:enable_rvm) && fetch(:enable_rvm) == true
|
52
|
+
shell_contents = <<-EOS
|
53
|
+
#!/bin/sh
|
54
|
+
if test -d "#{fetch :rvm_path}"
|
55
|
+
then
|
56
|
+
#{fetch :rvm_shell} "$@"
|
57
|
+
else
|
58
|
+
exec bash "$@"
|
59
|
+
fi
|
60
|
+
EOS
|
61
|
+
|
62
|
+
rvm_shell_wrapper_path = "/tmp/rvm_shell_wrapper.sh"
|
63
|
+
|
64
|
+
put shell_contents, rvm_shell_wrapper_path, :mode => 0755
|
65
|
+
|
66
|
+
set :default_shell, rvm_shell_wrapper_path
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "[internal] Remove rvm wrapper"
|
71
|
+
task :remove_shell_wrapper do
|
72
|
+
if exists?(:enable_rvm) && fetch(:enable_rvm) == true
|
73
|
+
default_shell = fetch(:default_shell)
|
74
|
+
set :default_shell, nil
|
75
|
+
|
76
|
+
run <<-CMD
|
77
|
+
rm -f #{default_shell}
|
78
|
+
CMD
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Install the wrapper once the config has been parsed
|
84
|
+
after "multistage:ensure", "rvm:install_shell_wrapper"
|
85
|
+
|
86
|
+
# Remove the shell before exiting
|
87
|
+
on :exit do
|
88
|
+
find_and_execute_task "rvm:remove_shell_wrapper"
|
89
|
+
end
|
90
|
+
end
|
@@ -16,7 +16,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
16
16
|
_cset :nginx_init_path, "/etc/init.d/nginx"
|
17
17
|
|
18
18
|
desc "[internal] Generate Nginx configuration"
|
19
|
-
task :generate_configuration do
|
19
|
+
task :generate_configuration, :roles => :web, :except => { :no_release => true } do
|
20
20
|
web_server_mode = fetch :web_server_mode
|
21
21
|
nginx = Capistrano::Extensions::Server::Nginx.new web_server_mode
|
22
22
|
|
@@ -43,33 +43,37 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
43
43
|
nginx.php_fpm_port = fetch :php_fpm_port
|
44
44
|
end
|
45
45
|
|
46
|
+
# Set the reverse proxy data
|
47
|
+
nginx.reverse_proxy_server_address = fetch(:reverse_proxy_server_address) if exists?(:reverse_proxy_server_address)
|
48
|
+
nginx.reverse_proxy_server_port = fetch(:reverse_proxy_server_port) if exists?(:reverse_proxy_server_port)
|
49
|
+
|
46
50
|
set :web_conf, nginx
|
47
51
|
set :web_conf_contents, nginx.render
|
48
52
|
end
|
49
53
|
|
50
54
|
desc "Start nginx web server"
|
51
|
-
task :start do
|
55
|
+
task :start, :roles => :web, :except => { :no_release => true } do
|
52
56
|
run <<-CMD
|
53
57
|
#{try_sudo} #{fetch :nginx_init_path} start
|
54
58
|
CMD
|
55
59
|
end
|
56
60
|
|
57
61
|
desc "Stop nginx web server"
|
58
|
-
task :stop do
|
62
|
+
task :stop, :roles => :web, :except => { :no_release => true } do
|
59
63
|
run <<-CMD
|
60
64
|
#{try_sudo} #{fetch :nginx_init_path} stop
|
61
65
|
CMD
|
62
66
|
end
|
63
67
|
|
64
68
|
desc "Restart nginx web server"
|
65
|
-
task :restart do
|
69
|
+
task :restart, :roles => :web, :except => { :no_release => true } do
|
66
70
|
run <<-CMD
|
67
71
|
#{try_sudo} #{fetch :nginx_init_path} restart
|
68
72
|
CMD
|
69
73
|
end
|
70
74
|
|
71
75
|
desc "Resload nginx web server"
|
72
|
-
task :reload do
|
76
|
+
task :reload, :roles => :web, :except => { :no_release => true } do
|
73
77
|
run <<-CMD
|
74
78
|
#{try_sudo} #{fetch :nginx_init_path} reload
|
75
79
|
CMD
|
@@ -16,17 +16,17 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
16
16
|
namespace :server do
|
17
17
|
namespace :web_server do
|
18
18
|
desc "Prepare the web server"
|
19
|
-
task :setup, :roles => :web do
|
19
|
+
task :setup, :roles => :web, :except => { :no_release => true } do
|
20
20
|
# Empty task, server preparation goes into callbacks
|
21
21
|
end
|
22
22
|
|
23
23
|
desc "Finished preparing the web server"
|
24
|
-
task :finish do
|
24
|
+
task :finish, :roles => :web, :except => { :no_release => true } do
|
25
25
|
# Empty task, server preparation goes into callbacks
|
26
26
|
end
|
27
27
|
|
28
28
|
desc "[internal] Generate Web configuration"
|
29
|
-
task :generate_web_configuration do
|
29
|
+
task :generate_web_configuration, :roles => :web, :except => { :no_release => true } do
|
30
30
|
if exists?(:web_server_app)
|
31
31
|
web_server_app = fetch :web_server_app
|
32
32
|
|
@@ -42,7 +42,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
desc "[internal] Generate authentification"
|
45
|
-
task :generate_authentification do
|
45
|
+
task :generate_authentification, :roles => :web, :except => { :no_release => true } do
|
46
46
|
if exists?(:web_server_auth_credentials)
|
47
47
|
web_server_auth_credentials = fetch :web_server_auth_credentials
|
48
48
|
contents = Array.new
|
@@ -65,12 +65,12 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
desc "[internal] Generate Apache configuration"
|
68
|
-
task :generate_apache_configuration do
|
68
|
+
task :generate_apache_configuration, :roles => :web, :except => { :no_release => true } do
|
69
69
|
# TODO: Write Apache config generator
|
70
70
|
end
|
71
71
|
|
72
72
|
desc "[internal] Write authentification file"
|
73
|
-
task :write_web_server_auth_file do
|
73
|
+
task :write_web_server_auth_file, :roles => :web, :except => { :no_release => true } do
|
74
74
|
if exists?(:web_server_auth_file) and not remote_file_exists?(fetch :web_server_auth_file)
|
75
75
|
web_server_auth_file = fetch :web_server_auth_file
|
76
76
|
web_server_auth_file_contents = fetch :web_server_auth_file_contents
|
@@ -104,14 +104,14 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
desc "print authentification file"
|
107
|
-
task :print_http_auth do
|
107
|
+
task :print_http_auth, :roles => :web, :except => { :no_release => true } do
|
108
108
|
read("#{fetch :deploy_to}/.http_basic_auth").split("\n").each do |m|
|
109
109
|
logger.trace "username: #{m.split(':').first.chomp} password: #{m.split(':').last.chomp}"
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
113
|
desc "[internal] Write web configuration file"
|
114
|
-
task :write_web_conf_file do
|
114
|
+
task :write_web_conf_file, :roles => :web, :except => { :no_release => true } do
|
115
115
|
if exists?(:web_conf_file)
|
116
116
|
web_conf_file = fetch :web_conf_file
|
117
117
|
random_file = "/tmp/#{fetch :application}_#{Digest::SHA1.hexdigest web_conf_contents}"
|
@@ -8,7 +8,7 @@ unless Capistrano::Configuration.respond_to?(:instance)
|
|
8
8
|
abort "This extension requires Capistrano 2"
|
9
9
|
end
|
10
10
|
|
11
|
-
DEFAULT_RECEIPTS = %w{functions deploy web files}
|
11
|
+
DEFAULT_RECEIPTS = %w{functions rvm deploy web files}
|
12
12
|
|
13
13
|
Capistrano::Configuration.instance(:must_exist).load do
|
14
14
|
on :load do
|
@@ -49,9 +49,6 @@ set :deploy_via, :remote_cache
|
|
49
49
|
# Keep only the last 5 releases
|
50
50
|
set :keep_releases, 5
|
51
51
|
|
52
|
-
# Using RVM? Set this to the ruby version/gemset to use
|
53
|
-
set :rvm_ruby_string, "1.9.3"
|
54
|
-
|
55
52
|
#############
|
56
53
|
# Contents
|
57
54
|
#
|
@@ -235,6 +232,33 @@ set :web_server_mode, :reverse_proxy
|
|
235
232
|
#
|
236
233
|
#############
|
237
234
|
|
235
|
+
#############
|
236
|
+
# Rvm
|
237
|
+
#
|
238
|
+
|
239
|
+
# Enable RVM?
|
240
|
+
set :enable_rvm, true
|
241
|
+
|
242
|
+
# What's the type of rvm ?
|
243
|
+
# :system and :user
|
244
|
+
set :rvm_type, :system
|
245
|
+
|
246
|
+
# What rvm string should we use ?
|
247
|
+
set :rvm_ruby_string, "1.9.2"
|
248
|
+
|
249
|
+
# Set the rvm_path, usually you should define rvm_type
|
250
|
+
# and this would be defined depending if your rvm is installed system wide or for
|
251
|
+
# the user, but if your is installed somewhere different from the default path
|
252
|
+
# /usr/local/rvm or $HOME/.rvm then please uncomment and edit the following setting
|
253
|
+
# set :rvm_path, "/path/to/rvm"
|
254
|
+
|
255
|
+
# Set the rvm bin path, which will be set using the rvm_type
|
256
|
+
# set :rvm_bin_path, "/path/to/rvm/bin"
|
257
|
+
|
258
|
+
#
|
259
|
+
#
|
260
|
+
#############
|
261
|
+
|
238
262
|
#############
|
239
263
|
# Unicorn
|
240
264
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-exts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.13.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-09-21 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2154565740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 2.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2154565740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: capistrano_colors
|
27
|
-
requirement: &
|
27
|
+
requirement: &2154565280 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.5.5
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2154565280
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: i18n
|
38
|
-
requirement: &
|
38
|
+
requirement: &2154564800 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 0.6.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2154564800
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activesupport
|
49
|
-
requirement: &
|
49
|
+
requirement: &2154564280 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 3.1.0
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2154564280
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: guard
|
60
|
-
requirement: &
|
60
|
+
requirement: &2154563660 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 0.6.2
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2154563660
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: guard-bundler
|
71
|
-
requirement: &
|
71
|
+
requirement: &2154563000 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 0.1.3
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2154563000
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &2154562260 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ~>
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: 0.4.3
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2154562260
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rspec
|
93
|
-
requirement: &
|
93
|
+
requirement: &2154561800 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ~>
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: 2.6.0
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2154561800
|
102
102
|
description: ! 'Capistrano exts is a set of helper tasks to help with the initial
|
103
103
|
server
|
104
104
|
|
@@ -156,6 +156,7 @@ files:
|
|
156
156
|
- lib/capistrano-exts/receipts/multistage.rb
|
157
157
|
- lib/capistrano-exts/receipts/mysql.rb
|
158
158
|
- lib/capistrano-exts/receipts/rails.rb
|
159
|
+
- lib/capistrano-exts/receipts/rvm.rb
|
159
160
|
- lib/capistrano-exts/receipts/servers.rb
|
160
161
|
- lib/capistrano-exts/receipts/servers/db_server.rb
|
161
162
|
- lib/capistrano-exts/receipts/servers/web_server.rb
|