capistrano3-nginx 2.0.1 → 2.0.2

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: 39d6a15b4f7b0023807b6c9924d0ecc3a74ea28d
4
- data.tar.gz: ab02b0e917aa042a113888dddb947a55d6ce9ce0
3
+ metadata.gz: 75a49cbbb0fd1e3ec4362432bb7912913b56767d
4
+ data.tar.gz: 8a91a5b8e45653238dcad99266de0f4787a2def8
5
5
  SHA512:
6
- metadata.gz: 48b67e2caa72c0a94bc13b80cfa474bd7b05e7681927d56f7372cb69863342b264e538f402efa45541d6119aad5ebbd75065fa24c7e05bcd8b7d147a15f0b7ac
7
- data.tar.gz: 933f964e789260dc1b1e9ac47c4e3d070d2746bcd2e7e803adae1765463401fc930dc1c81b19352d68522f73c6cb44aa78478bd01b8c564e53cb53de41d8f834
6
+ metadata.gz: d2ae8ce4d02753a7cef985099e1b15c0c6dc5da168f1d927784eb3f8cb567a09bcb35d5c6baf0f16af2e87f1b59c594af5f8c950eb339dfb78b26f692cb6f0b2
7
+ data.tar.gz: 0aeb78b2e026d02ebf82e3b59a8cbc37f00bc7b82c0cd14d0d42a3713a3764721b93042c87c19a277d3c1ea1d33268126074a43b0c4024114da8c68d4ddea759
data/README.md CHANGED
@@ -38,20 +38,26 @@ cap nginx:site:enable # Enables the site creating a symbolic link i
38
38
  cap nginx:site:remove # Removes the site removing the configuration file from the available folder
39
39
  ```
40
40
 
41
- Configurable options, shown here with examples:
41
+ Configurable options (copy into deploy.rb), shown here with examples:
42
42
 
43
43
  ```ruby
44
44
  # Server name for nginx
45
45
  # No default vaue
46
46
  set :nginx_domains, "foo.bar.com"
47
47
 
48
+ # nginx service script
49
+ # Defaults to using the 'service' convinience script.
50
+ # You might prefer using the init.d instead depending on sudo privilages.
51
+ # default value: "service nginx"
52
+ set :nginx_service_path, "/etc/init.d/nginx"
53
+
48
54
  # Roles the deploy nginx site on,
49
55
  # default value: :web
50
56
  set :nginx_roles, :web
51
57
 
52
58
  # Path, where nginx log file will be stored
53
59
  # default value: "#{shared_path}/log"
54
- set :nginx_log_path, "#{shared_path}/log"
60
+ # set :nginx_log_path, "#{shared_path}/log"
55
61
 
56
62
  # Path where nginx is installed
57
63
  # default value: "/etc/nginx"
@@ -59,7 +65,7 @@ set :nginx_root_path, "/etc/nginx"
59
65
 
60
66
  # Path where to look for static files
61
67
  # default value: "public"
62
- set :nginx_root_path, "my_static_folder"
68
+ set :nginx_static_dir, "my_static_folder"
63
69
 
64
70
  # Path where nginx available site are stored
65
71
  # default value: "sites-available"
@@ -72,14 +78,29 @@ set :nginx_sites_enabled, "sites-enabled"
72
78
  # Path to look for custom config template
73
79
  # `:default` will use the bundled nginx template
74
80
  # default value: :default
75
- set :nginx_template, "#{fetch(:stage_config_path)}/#{stage}/nginx.conf.erb"
76
- set :nginx_tempalte, :default
81
+ set :nginx_template, "#{stage_config_path}/#{fetch :stage}/nginx.conf.erb"
77
82
 
78
- # Use ssl on port 443 to serve on https. Every request to por 80
83
+ # Use SSL on port 443 to serve on https. Every request to por 80
79
84
  # will be rewritten to 443
80
85
  # default value: false
81
86
  set :nginx_use_ssl, false
82
87
 
88
+ # Name of SSL certificate file
89
+ # default value: "#{application}.crt"
90
+ set :nginx_ssl_certificate, 'my-domain.crt'
91
+
92
+ # SSL certificate file path
93
+ # default value: "/etc/ssl/certs"
94
+ set :nginx_ssl_certificate_path, "#{shared_path}/ssl/certs"
95
+
96
+ # Name of SSL certificate private key
97
+ # default value: "#{application}.key"
98
+ set :nginx_ssl_certificate_key, 'my-domain.key'
99
+
100
+ # SSL certificate private key path
101
+ # default value: "/etc/ssl/private"
102
+ set :nginx_ssl_certificate_key_path, "#{shared_path}/ssl/private"
103
+
83
104
  # Whether you want to server an application through a proxy pass
84
105
  # default value: true
85
106
  set :app_server, true
@@ -87,15 +108,15 @@ set :app_server, true
87
108
  # Socket file that nginx will use as upstream to serve the application
88
109
  # Note: Socket upstream has priority over host:port upstreams
89
110
  # no default value
90
- set :app_server_socket, "#{shared_path}/sockets/#{application}.sock"
111
+ set :app_server_socket, "#{shared_path}/sockets/unicorn-#{fetch :application}.sock"
91
112
 
92
113
  # The host that nginx will use as upstream to server the application
93
114
  # default value: 127.0.0.1
94
- set :app_server_port,
115
+ set :app_server_host, "127.0.0.1"
95
116
 
96
117
  # The port the application server is running on
97
118
  # no default value
98
- set :app_server_host,
119
+ set :app_server_port, 8080
99
120
  ```
100
121
 
101
122
  ## Thanks
@@ -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 = 'capistrano3-nginx'
7
- spec.version = '2.0.1'
7
+ spec.version = '2.0.2'
8
8
  spec.authors = ['Juan Ignacio Donoso']
9
9
  spec.email = ['jidonoso@gmail.com']
10
10
  spec.description = %q{Adds suuport to nginx for Capistrano 3.x}
@@ -1,5 +1,6 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
+ set :nginx_service_path, -> { 'service nginx' }
3
4
  set :nginx_roles, -> { :web }
4
5
  set :nginx_log_path, -> { "#{shared_path}/log" }
5
6
  set :nginx_root_path, -> { "/etc/nginx" }
@@ -8,6 +9,10 @@ namespace :load do
8
9
  set :nginx_sites_available, -> { "sites-available" }
9
10
  set :nginx_template, -> { :default }
10
11
  set :nginx_use_ssl, -> { false }
12
+ set :nginx_ssl_certificate, -> { "#{fetch(:application)}.crt" }
13
+ set :nginx_ssl_certificate_path, -> { '/etc/ssl/certs' }
14
+ set :nginx_ssl_certificate_key, -> { "#{fetch(:application)}.crt" }
15
+ set :nginx_ssl_certificate_key_path, -> { '/etc/ssl/private' }
11
16
  set :app_server, -> { true }
12
17
  end
13
18
  end
@@ -23,9 +28,10 @@ namespace :nginx do
23
28
  %w[start stop restart reload].each do |command|
24
29
  desc "#{command.capitalize} nginx service"
25
30
  task command do
31
+ nginx_service = fetch(:nginx_service_path)
26
32
  on release_roles fetch(:nginx_roles) do
27
- if command === 'stop' || (test "sudo nginx -t")
28
- execute :sudo, "service nginx #{command}"
33
+ if command === 'stop' || (test "[ $(sudo #{nginx_service} configtest | grep -c 'fail') -eq 0 ]")
34
+ execute :sudo, "#{nginx_service} #{command}"
29
35
  end
30
36
  end
31
37
  end
@@ -23,8 +23,8 @@ server {
23
23
  <% if fetch(:nginx_use_ssl) %>
24
24
  listen 443;
25
25
  ssl on;
26
- ssl_certificate /etc/ssl/certs/<%= nginx_ssl_certificate %>;
27
- ssl_certificate_key /etc/ssl/private/<%= nginx_ssl_certificate_key %>;
26
+ ssl_certificate <%= fetch(:nginx_ssl_certificate_path) %>/<%= fetch(:nginx_ssl_certificate) %>;
27
+ ssl_certificate_key <%= fetch(:nginx_ssl_certificate_key_path) %>/<%= fetch(:nginx_ssl_certificate_key) %>;
28
28
  <% else %>
29
29
  listen 80;
30
30
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano3-nginx
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Ignacio Donoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-09 00:00:00.000000000 Z
11
+ date: 2014-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano