capistrano_recipes 1.0.5 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +6 -14
- data/capistrano_recipes.gemspec +1 -1
- data/lib/capistrano/recipes/nginx.rb +32 -0
- data/lib/capistrano/recipes/templates/nginx.vhost.erb +12 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MGJiM2Y0NTY0OGEwNGQzYjllMTIwZWEwZjkzM2QxYmRhMTEyMGI2YWRjMTdh
|
10
|
-
MTcxNTg5MjM4NzNlYzE5Y2M3N2RlNDIyOTZhNzk4NWNkMjFjYzJmZjdhMjkz
|
11
|
-
OTNlYmJmZjdjMGY4NmQxNmZjMTc2MjM5Y2ZmYzMxNjVkYmEwN2I=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ZDgzM2IwMTRkNTQ2OTczOGIzZTZmOWQwYzk4OGFhMGE3ZTgwNWZjYWRiMGRk
|
14
|
-
YTUyM2NjZDdlYzIzNmU0YzdmZjQwZDA5YWI0NTU3NzI1YzJlMWQzODVlZGVm
|
15
|
-
OTcwYmFhYjk4NTllOTZlN2EwNzE5NDFhOGY4OTgyOGI2NmFjZmY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 122570754efd076c4abea7cf73802fefd22c5607
|
4
|
+
data.tar.gz: 0556b85e858cba70703becfea75f6053aa057051
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 213dff16815537617f6cf526fe132a316a1ae956841c35061fdcfb2550d78efa938696189f53c3796c195da42fe713acd0042c55f8dc26d80d418dc3b2d50918
|
7
|
+
data.tar.gz: 6e77174d533b8998da024ca38713a771e6e695952e4e1ca0e8fe2217346a31e940a2f545cdb0fa60e67404d2974880fcaeb37de753d83137b564fffde526f7c4
|
data/capistrano_recipes.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'capistrano_recipes'
|
7
|
-
s.version = '1.0
|
7
|
+
s.version = '1.1.0'
|
8
8
|
s.authors = ['Fernando Aleman']
|
9
9
|
s.email = ['fernandoaleman@mac.com']
|
10
10
|
s.description = 'Capistrano recipes to make your deployments fast and easy'
|
@@ -46,14 +46,46 @@ module CapistranoRecipes
|
|
46
46
|
|
47
47
|
# Nginx ssl key file
|
48
48
|
_cset :nginx_ssl_key, lambda { "#{application}.key" }
|
49
|
+
|
50
|
+
# Whether or not to use auth basic
|
51
|
+
_cset :use_auth_basic, false
|
52
|
+
|
53
|
+
# Nginx auth basic username
|
54
|
+
_cset :nginx_auth_basic_username, lambda { ask "Enter #{rails_env} auth basic username " }
|
55
|
+
|
56
|
+
# Nginx auth basic password
|
57
|
+
_cset :nginx_auth_basic_password, lambda { password_prompt "Enter #{rails_env} auth basic password " }
|
58
|
+
|
59
|
+
# Nginx htpasswd path on server
|
60
|
+
_cset :nginx_htpasswd_path, lambda{ "#{shared_path}/htpasswd" }
|
61
|
+
|
62
|
+
# Nginx htpasswd file on server
|
63
|
+
_cset :nginx_htpasswd_file, lambda{ File.join nginx_htpasswd_path, "htpasswd" }
|
49
64
|
|
50
65
|
def using_ssl?
|
51
66
|
fetch(:use_ssl)
|
52
67
|
end
|
68
|
+
|
69
|
+
def using_auth_basic?
|
70
|
+
fetch(:use_auth_basic)
|
71
|
+
end
|
53
72
|
|
54
73
|
namespace :nginx do
|
74
|
+
desc 'Add HTTP Basic Authentication'
|
75
|
+
task :auth_basic, :roles => :web, :except => { :no_release => true } do
|
76
|
+
htpasswd = "#{nginx_auth_basic_username}:#{%Q{#{nginx_auth_basic_password}}.crypt(%Q{#{application}})}"
|
77
|
+
commands = []
|
78
|
+
commands << "mkdir -p #{nginx_htpasswd_path}"
|
79
|
+
commands << "if (test -f #{nginx_htpasswd_file}); then #{sudo} mv #{nginx_htpasswd_file} /tmp/htpasswd; fi"
|
80
|
+
commands << "echo '#{htpasswd}' >> /tmp/htpasswd"
|
81
|
+
commands << "#{sudo} mv /tmp/htpasswd #{nginx_htpasswd_file}"
|
82
|
+
|
83
|
+
run commands.join(" && ")
|
84
|
+
end
|
85
|
+
|
55
86
|
desc 'Create and upload nginx vhost'
|
56
87
|
task :setup, :roles => :web, :except => { :no_release => true } do
|
88
|
+
auth_basic if using_auth_basic?
|
57
89
|
upload_template nginx_local_site_available_template, nginx_remote_site_available_file
|
58
90
|
run "#{sudo} ln -nfs #{nginx_remote_site_available_file} #{nginx_remote_site_enabled_link}"
|
59
91
|
restart
|
@@ -18,7 +18,12 @@ server {
|
|
18
18
|
root <%= current_path %>/public;
|
19
19
|
access_log <%= shared_path %>/log/access.log main;
|
20
20
|
error_log <%= shared_path %>/log/error.log info;
|
21
|
-
|
21
|
+
|
22
|
+
<% if using_auth_basic? %>
|
23
|
+
auth_basic "Restricted Access";
|
24
|
+
auth_basic_user_file <%= nginx_htpasswd_file %>;
|
25
|
+
|
26
|
+
<% end %>
|
22
27
|
# Rewrite all the requests to the maintenance.html
|
23
28
|
# page if it exists in the doc root. This is for
|
24
29
|
# capistrano's disable web task
|
@@ -76,7 +81,12 @@ server {
|
|
76
81
|
root <%= current_path %>/public;
|
77
82
|
access_log <%= shared_path %>/log/ssl-access.log main;
|
78
83
|
error_log <%= shared_path %>/log/ssl-error.log info;
|
79
|
-
|
84
|
+
|
85
|
+
<% if using_auth_basic? %>
|
86
|
+
auth_basic "Restricted Access";
|
87
|
+
auth_basic_user_file <%= nginx_htpasswd_file %>;
|
88
|
+
|
89
|
+
<% end %>
|
80
90
|
ssl on;
|
81
91
|
ssl_certificate <%= File.join nginx_ssl_certs_path, nginx_ssl_cert %>;
|
82
92
|
ssl_certificate_key <%= File.join nginx_ssl_private_path, nginx_ssl_key %>;
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Aleman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -101,17 +101,17 @@ require_paths:
|
|
101
101
|
- lib
|
102
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
103
|
requirements:
|
104
|
-
- -
|
104
|
+
- - '>='
|
105
105
|
- !ruby/object:Gem::Version
|
106
106
|
version: '0'
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - '>='
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.0.
|
114
|
+
rubygems_version: 2.0.6
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Capistrano deployment recipes
|