capistrano-unicorn-nginx 3.3.3 → 3.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bb3ef3f0c2a5ffce9901e6c13e7429d6580afe7
4
- data.tar.gz: b10988520574834d2e1c1a656d4d6061a46f4ab6
3
+ metadata.gz: b5914ce5a8fa29d660ca4ed8002d0bd1ca7ab7f6
4
+ data.tar.gz: 85dd5c4b635c5f9ce402a6649e20a79832b0688e
5
5
  SHA512:
6
- metadata.gz: 6036237105e57ca6cff51ac0c715fb255e152768db9cee5fbf7f3d960235da3e9876f5c73caa76aee759de1ef1fc92c52f7ad7187b27ddc4c4320e629920634c
7
- data.tar.gz: 72015998373a8de90105f89ae0b787c97b40d3d7323058e350fbb2ed3be1b74335d11c72735641fd1a844194ff7f440b285ae26ca455d44872d64e9d42a2c43a
6
+ metadata.gz: f22e4b399e997f4fa8b813a23e1ebade0ea889fcfd74602022c1c4c8bf963b6a0c767d26dfb1983be9c6fbdbec4caa176ad3d4e22dd7cb87ff982f809585424e
7
+ data.tar.gz: 9ece26bc3dce9f5ab4dc19f6845eba4532c1302c7871224278046a8e1026ab98db0339065987bc6efd13fdfea30cc973607a983346937a4b09afb7b6e18842f2
@@ -2,6 +2,12 @@
2
2
 
3
3
  ### master
4
4
 
5
+ ### v3.4.0, 2015-09-17
6
+ - Allow customizing paths for SSL certificate and key
7
+ - Use sudo to restart services
8
+ - Remove whitespace in template ERB files
9
+
10
+
5
11
  ### v3.3.3, 2015-05-05
6
12
  - add `unicorn_env` option for passing environmental variables to unicorn (@rhomeister)
7
13
 
@@ -27,12 +27,20 @@ module Capistrano
27
27
  "#{fetch(:nginx_server_name)}.key"
28
28
  end
29
29
 
30
+ def nginx_default_ssl_cert_file_path
31
+ "/etc/ssl/certs/"
32
+ end
33
+
34
+ def nginx_default_ssl_cert_key_file_path
35
+ "/etc/ssl/private/"
36
+ end
37
+
30
38
  def nginx_ssl_cert_file
31
- "/etc/ssl/certs/#{fetch(:nginx_ssl_cert)}"
39
+ "#{fetch(:nginx_ssl_cert_path)}#{fetch(:nginx_ssl_cert)}"
32
40
  end
33
41
 
34
42
  def nginx_ssl_cert_key_file
35
- "/etc/ssl/private/#{fetch(:nginx_ssl_cert_key)}"
43
+ "#{fetch(:nginx_ssl_cert_key_path)}#{fetch(:nginx_ssl_cert_key)}"
36
44
  end
37
45
 
38
46
  # log files
@@ -18,6 +18,8 @@ namespace :load do
18
18
  set :nginx_pass_ssl_client_cert, false
19
19
  set :nginx_ssl_cert, -> { nginx_default_ssl_cert_file_name }
20
20
  set :nginx_ssl_cert_key, -> { nginx_default_ssl_cert_key_file_name }
21
+ set :nginx_ssl_cert_path, -> { nginx_default_ssl_cert_file_path }
22
+ set :nginx_ssl_cert_key_path, -> { nginx_default_ssl_cert_key_file_path }
21
23
  set :nginx_upload_local_cert, true
22
24
  set :nginx_ssl_cert_local_path, -> { ask(:nginx_ssl_cert_local_path, 'Local path to ssl certificate: ') }
23
25
  set :nginx_ssl_cert_key_local_path, -> { ask(:nginx_ssl_cert_key_local_path, 'Local path to ssl certificate key: ') }
@@ -63,7 +63,7 @@ namespace :unicorn do
63
63
  desc "#{command} unicorn"
64
64
  task command do
65
65
  on roles :app do
66
- execute :service, fetch(:unicorn_service), command
66
+ sudo 'service', fetch(:unicorn_service), command
67
67
  end
68
68
  end
69
69
  end
@@ -17,7 +17,7 @@ module Capistrano
17
17
  config_file = File.join(File.dirname(__FILE__), "../../generators/capistrano/unicorn_nginx/templates/#{template_name}")
18
18
  end
19
19
 
20
- ERB.new(File.read(config_file)).result(ERBNamespace.new(locals).get_binding)
20
+ ERB.new(File.read(config_file), nil, '-').result(ERBNamespace.new(locals).get_binding)
21
21
  end
22
22
 
23
23
  # renders the ERB template specified by template_name to a StringIO buffer
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module UnicornNginx
3
- VERSION = "3.3.3"
3
+ VERSION = "3.4.0"
4
4
  end
5
5
  end
@@ -1,13 +1,13 @@
1
- <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert %>
1
+ <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert -%>
2
2
  # source: http://forum.nginx.org/read.php?2,236546,236596
3
3
  map $ssl_client_raw_cert $a {
4
4
  "~^(-.*-\n)(?<1st>[^\n]+)\n((?<b>[^\n]+)\n)?((?<c>[^\n]+)\n)?((?<d>[^\n]+)\n)?((?<e>[^\n]+)\n)?((?<f>[^\n]+)\n)?((?<g>[^\n]+)\n)?((?<h>[^\n]+)\n)?((?<i>[^\n]+)\n)?((?<j>[^\n]+)\n)?((?<k>[^\n]+)\n)?((?<l>[^\n]+)\n)?((?<m>[^\n]+)\n)?((?<n>[^\n]+)\n)?((?<o>[^\n]+)\n)?((?<p>[^\n]+)\n)?((?<q>[^\n]+)\n)?((?<r>[^\n]+)\n)?((?<s>[^\n]+)\n)?((?<t>[^\n]+)\n)?((?<v>[^\n]+)\n)?((?<u>[^\n]+)\n)?((?<w>[^\n]+)\n)?((?<x>[^\n]+)\n)?((?<y>[^\n]+)\n)?((?<z>[^\n]+)\n)?(-.*-)$" $1st;
5
5
  }
6
- <% end %>
6
+ <% end -%>
7
7
 
8
8
  server {
9
- <% if fetch(:nginx_use_ssl) %>
10
- <% if fetch(:nginx_use_spdy) %>
9
+ <% if fetch(:nginx_use_ssl) -%>
10
+ <% if fetch(:nginx_use_spdy) -%>
11
11
  listen <%= ssl_port %> spdy;
12
12
  <% else %>
13
13
  listen <%= ssl_port %>;
@@ -15,13 +15,13 @@ server {
15
15
  ssl on;
16
16
  ssl_certificate <%= nginx_ssl_cert_file %>;
17
17
  ssl_certificate_key <%= nginx_ssl_cert_key_file %>;
18
- <% else %>
18
+ <% else -%>
19
19
  listen 80;
20
- <% end %>
20
+ <% end -%>
21
21
 
22
- <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert %>
22
+ <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert -%>
23
23
  ssl_verify_client optional_no_ca;
24
- <% end %>
24
+ <% end -%>
25
25
 
26
26
  client_max_body_size 4G;
27
27
  keepalive_timeout 10;
@@ -37,13 +37,13 @@ server {
37
37
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38
38
  proxy_set_header Host $http_host;
39
39
  proxy_redirect off;
40
- <% if fetch(:nginx_use_ssl) %>
40
+ <% if fetch(:nginx_use_ssl) -%>
41
41
  proxy_set_header X-Forwarded-Proto https;
42
- <% end %>
43
- <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert %>
42
+ <% end -%>
43
+ <% if fetch(:nginx_use_ssl) && nginx_pass_ssl_client_cert -%>
44
44
  # source: http://forum.nginx.org/read.php?2,236546,236596
45
45
  proxy_set_header X-Client-Cert $a$b$c$d$e$f$g$h$i$j$k$l$m$n$o$p$q$r$s$t$v$u$w$x$y$z;
46
- <% end %>
46
+ <% end -%>
47
47
 
48
48
  proxy_pass http://unicorn_<%= fetch(:nginx_config_name) %>;
49
49
  # limit_req zone=one;
@@ -1,25 +1,25 @@
1
1
  upstream unicorn_<%= fetch(:nginx_config_name) %> {
2
- <% if fetch(:unicorn_use_tcp) %>
3
- <% roles(:app).each do |role| %>
2
+ <% if fetch(:unicorn_use_tcp) -%>
3
+ <% roles(:app).each do |role| -%>
4
4
  server <%= role.hostname %>:<%= fetch(:unicorn_tcp_listen_port)%> fail_timeout=<%= fetch(:nginx_fail_timeout) %>;
5
- <% end %>
6
- <% else %>
5
+ <% end -%>
6
+ <% else -%>
7
7
  server unix:/tmp/unicorn.<%= fetch(:nginx_config_name) %>.sock fail_timeout=<%= fetch(:nginx_fail_timeout) %>;
8
- <% end %>
8
+ <% end -%>
9
9
  }
10
10
 
11
- <% if fetch(:nginx_use_ssl) %>
11
+ <% if fetch(:nginx_use_ssl) -%>
12
12
  server {
13
13
  listen 80;
14
14
  server_name <%= fetch(:nginx_server_name) %>;
15
15
  rewrite ^(.*) https://$host$1 permanent;
16
16
  }
17
- <% end %>
17
+ <% end -%>
18
18
 
19
19
  <% # render the default server directive. If SSL is enabled, port 443 is used %>
20
20
  <%= template_to_s("_default_server_directive.erb", ssl_port: 443, nginx_pass_ssl_client_cert: false).to_s %>
21
21
 
22
- <% if fetch(:nginx_pass_ssl_client_cert) %>
22
+ <% if fetch(:nginx_pass_ssl_client_cert) -%>
23
23
  <% # render the server directive with SSL client certificate authentication enabled on port 444 %>
24
24
  <%= template_to_s("_default_server_directive.erb", ssl_port: 444, nginx_pass_ssl_client_cert: true).to_s %>
25
- <% end %>
25
+ <% end -%>
@@ -3,11 +3,11 @@ pid "<%= fetch(:unicorn_pid) %>"
3
3
  stdout_path "<%= unicorn_log_file %>"
4
4
  stderr_path "<%= unicorn_error_log_file %>"
5
5
 
6
- <% if fetch(:unicorn_use_tcp) %>
6
+ <% if fetch(:unicorn_use_tcp) -%>
7
7
  listen <%= fetch(:unicorn_tcp_listen_port) %>
8
- <% else %>
8
+ <% else -%>
9
9
  listen "/tmp/unicorn.<%= fetch(:nginx_config_name) %>.sock"
10
- <% end %>
10
+ <% end -%>
11
11
 
12
12
  worker_processes <%= fetch(:unicorn_workers) %>
13
13
  timeout <%= fetch(:unicorn_worker_timeout) %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-unicorn-nginx
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.3
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Stranders
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-05-05 00:00:00.000000000 Z
12
+ date: 2015-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
107
  version: '0'
108
108
  requirements: []
109
109
  rubyforge_project:
110
- rubygems_version: 2.2.2
110
+ rubygems_version: 2.4.5
111
111
  signing_key:
112
112
  specification_version: 4
113
113
  summary: Capistrano tasks for automatic and sensible unicorn + nginx configuraion.