capistrano-unformatt 1.9 → 1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e276954baa4668a17f3a1bc59058490ea127eba
4
- data.tar.gz: ea4b4e09294f6add6e4fb754feb58b0fac2da1a6
3
+ metadata.gz: '09bd3363586991ca0799eeb965c4f711e9d5c403'
4
+ data.tar.gz: 5247400f5c50f5c8ecb11bb9f03fc92d57097ba4
5
5
  SHA512:
6
- metadata.gz: 5654cb76e477bdf7855aa823010d5aa17c283846f84582327d714e192ef630d7fb3e6b09572f97019d384aa49448040299c9695db7db49a5fac0df7ab6ab2003
7
- data.tar.gz: 247243270f9edfb04e36c0617f61ccf9baeb99214499d032dae07a3a04c86f971d98eb77a12de96917347ed7136bc1b7e37ae1fa83934e3d1e044d5b00faf087
6
+ metadata.gz: d2fb33879856577e99383f6c7f7a374707d8781efc62190cd667a46a66935c0d6d7eb82333ea490af45c7941378de83e0538bfb3526590636883d47b4d71ba11
7
+ data.tar.gz: '087615593fadb5122b9a5ae35a2b64f3a300bf7e89e623496c505b5791a2e056160bbb693266ea94a5d8ace3f518d2e91c067fd388ef744689b5aa7233f3e15a'
data/CHANGELOG.md CHANGED
@@ -61,3 +61,7 @@
61
61
  ## v1.9
62
62
 
63
63
  * Added defaults for setup tasks
64
+
65
+ ## v1.10
66
+
67
+ * Improved configuration for nginx
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "capistrano-unformatt"
7
- spec.version = '1.9'
7
+ spec.version = '1.10'
8
8
  spec.authors = ["unformatt"]
9
9
  spec.email = ["unformatt@gmail.com"]
10
10
  spec.description = "Custom recipes for Unformatt projects"
@@ -1,5 +1,9 @@
1
1
  set :setup_yamls, []
2
2
  set :setup_daemons, []
3
+ set :nginx_protocols, ['http']
3
4
  set :setup_nginx, false
4
5
 
6
+ set :app_server_host, '127.0.0.1'
7
+ set :app_server_port, 3000
8
+
5
9
  load File.expand_path("../../tasks/setup.rake", __FILE__)
@@ -2,16 +2,66 @@ upstream <%=fetch(:application)%> {
2
2
  server <%="#{fetch(:app_server_host)}:#{fetch(:app_server_port)}"%>;
3
3
  }
4
4
 
5
- <%- if fetch(:nginx_use_ssl) -%>
6
- server {
7
- listen <%= fetch(:nginx_http_port, 80) %>;
8
- server_name <%=fetch(:nginx_server_names)%>;
9
- rewrite ^ https://$server_name$request_uri? permanent;
10
- }
5
+ <%- if fetch(:nginx_protocols,[]).map(&:to_s).include?('http') -%>
6
+ <%- if fetch(:nginx_redirect_to_ssl, fetch(:nginx_use_ssl, false)) -%>
7
+ server {
8
+ listen <%= fetch(:nginx_http_port, 80) %>;
9
+ server_name <%=fetch(:nginx_http_server_names,fetch(:nginx_server_names))%>;
10
+ rewrite ^ https://$server_name$request_uri? permanent;
11
+ }
12
+ <%- else -%>
13
+ server {
14
+ listen <%= fetch(:nginx_http_port, 80) %>;
15
+ server_name <%=fetch(:nginx_server_names)%>;
16
+ root <%=current_path%>/public;
17
+ access_log <%=fetch(:nginx_access_log, "#{shared_path}/log/nginx-access.log") %>;
18
+ error_log <%=fetch(:nginx_error_log, "#{shared_path}/log/nginx-error.log")%>;
19
+ rewrite_log on;
20
+
21
+ client_max_body_size <%=fetch(:nginx_max_body_size, '4G')%>;
22
+ keepalive_timeout <%=fetch(:nginx_keepalive_timeout, '5')%>;
23
+
24
+ if (-f $document_root/public/maintenance.html) {
25
+ rewrite ^(.*)$ /public/maintenance.html;
26
+ break;
27
+ }
28
+
29
+ location ~ ^/(assets)/ {
30
+ root <%=current_path%>/public;
31
+ gzip_static on;
32
+ expires max;
33
+ add_header Cache-Control public;
34
+ break;
35
+ }
36
+
37
+ location / {
38
+ try_files $uri/index.html $uri.html $uri @<%=fetch(:application)%>;
39
+
40
+ error_page 404 /404.html;
41
+ error_page 422 /422.html;
42
+ error_page 500 502 503 504 /500.html;
43
+ error_page 403 /403.html;
44
+ break;
45
+ }
46
+
47
+ location @<%=fetch(:application)%> {
48
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
49
+ proxy_set_header Host $http_host;
50
+ proxy_headers_hash_bucket_size <%=fetch(:nginx_hash_bucket_size, 1024)%>;
51
+ proxy_headers_hash_max_size <%=fetch(:nginx_hash_max_size, 512)%>;
52
+ proxy_read_timeout <%=fetch(:nginx_read_timeout, 60)%>;
53
+ proxy_send_timeout <%=fetch(:nginx_send_timeout, 60)%>;
54
+ proxy_redirect off;
55
+ proxy_pass http://<%=fetch(:application)%>;
56
+ include proxy_params;
57
+ break;
58
+ }
59
+ }
60
+ <%- end -%>
11
61
  <%- end -%>
12
62
 
63
+ <%- if fetch(:nginx_protocols,[]).map(&:to_s).include?('https') -%>
13
64
  server {
14
- <%- if fetch(:nginx_use_ssl) -%>
15
65
  listen <%= fetch(:nginx_https_port, 443) %>;
16
66
  ssl on;
17
67
  ssl_certificate <%=fetch(:nginx_ssl_certificate)%>;
@@ -19,15 +69,16 @@ server {
19
69
  ssl_session_cache shared:SSL:10m;
20
70
  ssl_session_timeout 5m;
21
71
  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
22
- ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
72
+ <%- if fetch(:nginx_ssl_ciphers,'').present? -%>
73
+ ssl_ciphers "<%= fetch(:nginx_ssl_ciphers) %>";
23
74
  ssl_prefer_server_ciphers on;
24
- ssl_dhparam /etc/ssl/private/dhparams.pem;
75
+ ssl_dhparam <%= fetch(:nginx_dhparams_path, '/etc/ssl/private/dhparams.pem') %>;
25
76
  <%- end -%>
26
77
 
27
78
  server_name <%=fetch(:nginx_server_names)%>;
28
79
  root <%=current_path%>/public;
29
- access_log <%=shared_path%>/log/nginx-access.log;
30
- error_log <%=shared_path%>/log/nginx-error.log;
80
+ access_log <%=fetch(:nginx_access_log, "#{shared_path}/log/nginx-access.log") %>;
81
+ error_log <%=fetch(:nginx_error_log, "#{shared_path}/log/nginx-error.log")%>;
31
82
  rewrite_log on;
32
83
 
33
84
  client_max_body_size <%=fetch(:nginx_max_body_size, '4G')%>;
@@ -59,9 +110,7 @@ server {
59
110
  location @<%=fetch(:application)%> {
60
111
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
61
112
  proxy_set_header Host $http_host;
62
- <%- if fetch(:nginx_use_ssl) -%>
63
113
  proxy_set_header X-Forwarded-Proto https;
64
- <%- end -%>
65
114
  proxy_headers_hash_bucket_size <%=fetch(:nginx_hash_bucket_size, 1024)%>;
66
115
  proxy_headers_hash_max_size <%=fetch(:nginx_hash_max_size, 512)%>;
67
116
  proxy_read_timeout <%=fetch(:nginx_read_timeout, 60)%>;
@@ -72,3 +121,4 @@ server {
72
121
  break;
73
122
  }
74
123
  }
124
+ <%- end -%>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-unformatt
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.9'
4
+ version: '1.10'
5
5
  platform: ruby
6
6
  authors:
7
7
  - unformatt