capistrano-unicorn-nginx 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +134 -127
- data/capistrano-unicorn-nginx.gemspec +1 -1
- data/lib/capistrano/tasks/nginx.rake +24 -28
- data/lib/capistrano/tasks/unicorn.rake +9 -9
- data/lib/capistrano/unicorn_nginx/version.rb +1 -1
- data/lib/generators/capistrano/unicorn_nginx/config_generator.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ba9014b437c5edd7f11ec63c8837813a8e62e51
|
4
|
+
data.tar.gz: 31a185073e53a2affe02dc71014cfc104643dde2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2b336eb13f766af1dd17053d348931640d0c802af5d35b38401484fdd9f0b53893f5f0fdf273deaf344e3bdfa2edd463ecc8f1352e2bfa1af3cadb467d25152
|
7
|
+
data.tar.gz: 7b0c1270d455a5bf65e48635c6f8b92886f1f92e03e315d589a6808c8792edcfe071d3020db5f28e308faa0d6c94fd01548901906d9b66db47942e948ca83fae
|
data/README.md
CHANGED
@@ -1,189 +1,196 @@
|
|
1
|
-
# Capistrano
|
1
|
+
# Capistrano::UnicornNginx
|
2
2
|
|
3
|
-
Capistrano tasks for
|
3
|
+
Capistrano tasks for automatic and sensible unicorn + nginx configuraion.
|
4
4
|
|
5
|
-
|
5
|
+
Goals of this plugin:
|
6
6
|
|
7
|
-
*
|
8
|
-
*
|
9
|
-
*
|
10
|
-
* reload unicorn using `USR2` signal to load new application version with zero downtime
|
11
|
-
* creates logrotate record to rotate application logs
|
7
|
+
* automatic unicorn and nginx configuration for Rails apps
|
8
|
+
* **no manual ssh** to the server required
|
9
|
+
* zero downtime deployments enabled
|
12
10
|
|
13
|
-
|
14
|
-
Also, for full customization, all configs can be copied to the application using generators.
|
11
|
+
Specifics:
|
15
12
|
|
16
|
-
|
13
|
+
* generates nginx config file on the server
|
14
|
+
* generates unicorn initializer and config files<br/>
|
15
|
+
application is started automatically after server restart
|
16
|
+
* capistrano tasks for server management, example: `unicorn:restart`<br/>
|
17
|
+
see below for all available tasks
|
17
18
|
|
18
|
-
|
19
|
+
`capistrano-unicorn-nginx` works only with Capistrano 3!
|
19
20
|
|
20
|
-
|
21
|
+
This project was based on
|
22
|
+
[capistrano-nginx-unicorn](https://github.com/kalys/capistrano-nginx-unicorn).
|
23
|
+
I contributed a lot to Capistrano 3 version of that plugin. In the end I
|
24
|
+
decided to create my own project to bring in additional improvements, without
|
25
|
+
having to ask for permissions and wait for merging.
|
21
26
|
|
22
|
-
|
27
|
+
### Installation
|
23
28
|
|
24
|
-
|
29
|
+
Add this to `Gemfile`:
|
25
30
|
|
26
|
-
|
31
|
+
group :development do
|
32
|
+
gem 'capistrano', '~> 3.1'
|
33
|
+
gem 'capistrano-unicorn-nginx'
|
34
|
+
end
|
27
35
|
|
28
|
-
|
36
|
+
And then:
|
29
37
|
|
30
|
-
|
38
|
+
$ bundle install
|
31
39
|
|
32
|
-
|
40
|
+
### Setup and usage
|
33
41
|
|
34
|
-
|
42
|
+
Add this line to `Capfile`
|
35
43
|
|
36
|
-
|
44
|
+
require 'capistrano/unicorn-nginx'
|
37
45
|
|
38
|
-
|
39
|
-
current_path
|
40
|
-
shared_path
|
41
|
-
user
|
46
|
+
Set `nginx_server_name` in stage file, example `config/deploy/production.rb`:
|
42
47
|
|
43
|
-
|
48
|
+
set :user, 'deployer' # user doing the deploy
|
49
|
+
set :nginx_server_name, 'mydomain.com'
|
44
50
|
|
45
|
-
|
51
|
+
or if you don't have a domain yet:
|
46
52
|
|
47
|
-
|
48
|
-
cap nginx:setup
|
53
|
+
set :nginx_server_name, '<server_ip>'
|
49
54
|
|
50
|
-
|
51
|
-
cap nginx:reload
|
55
|
+
And you're all set!
|
52
56
|
|
53
|
-
|
57
|
+
Execute:
|
54
58
|
|
55
|
-
|
56
|
-
cap unicorn:setup
|
59
|
+
$ bundle exec cap deploy production
|
57
60
|
|
58
|
-
|
59
|
-
cap unicorn:start
|
61
|
+
and enjoy watching your app being deployed!
|
60
62
|
|
61
|
-
|
62
|
-
cap unicorn:stop
|
63
|
+
### Configuration
|
63
64
|
|
64
|
-
|
65
|
-
|
66
|
-
# then old workers will be automatically killed and new workers will start processing requests
|
67
|
-
cap unicorn:restart
|
65
|
+
As described in the Usage section, this plugin works with minimal setup.
|
66
|
+
However, configuration is possible.
|
68
67
|
|
69
|
-
and
|
68
|
+
You'll find the options and their defaults below.
|
70
69
|
|
71
|
-
|
72
|
-
cap logrotate
|
70
|
+
In order to override the default, put the option in the stage file, for example:
|
73
71
|
|
74
|
-
|
75
|
-
|
72
|
+
# in config/deploy/production.rb
|
73
|
+
set :unicorn_workers, 4
|
76
74
|
|
77
|
-
|
78
|
-
* `unicorn:restart` is hooked to `deploy:restart`
|
75
|
+
**Nginx options**
|
79
76
|
|
80
|
-
|
81
|
-
nginx and unicorn will be automatically configured.
|
82
|
-
And after each deploy, unicorn will be automatically reloaded.
|
77
|
+
Defaults are listed near option name in the first line.
|
83
78
|
|
84
|
-
|
85
|
-
|
79
|
+
- `set :nginx_server_name` # no default, required<br/>
|
80
|
+
Your application's domain. You will be prompted if this option is not set.
|
81
|
+
If you do not have a domain, you can put server IP - in this case you can
|
82
|
+
deploy only one application on the server.
|
86
83
|
|
87
|
-
|
84
|
+
- `set :nginx_pid, "/run/nginx.pid"`<br/>
|
85
|
+
Path for nginx process pid file.
|
88
86
|
|
89
|
-
|
87
|
+
SSL related options:
|
90
88
|
|
91
|
-
|
89
|
+
- `set :nginx_use_ssl, false`<br/>
|
90
|
+
If set to `true`, nginx will be configured to 443 port and port 80 will be auto
|
91
|
+
routed to 443. Also, on `nginx:setup`, paths to ssl certificate and key will be
|
92
|
+
configured. Certificate file and key will be uploaded to `/etc/ssl/certs/`
|
93
|
+
and `/etc/ssl/private/` directories on the server.
|
92
94
|
|
95
|
+
- `set :nginx_upload_local_cert, true`<br/>
|
96
|
+
If `true`, certificates will be uploaded from a local path. Otherwise, it
|
97
|
+
is expected for the certificate and key defined in the next 2 variables to be
|
98
|
+
already on the server.
|
93
99
|
|
94
|
-
|
95
|
-
|
96
|
-
# default value: "config/deploy/templates"
|
97
|
-
set :templates_path, "config/deploy/templates"
|
100
|
+
- `set :nginx_ssl_cert, "#{fetch(:nginx_server_name)}.crt"`<br/>
|
101
|
+
Remote file name of the certificate. Only makes sense if `nginx_use_ssl` is set.
|
98
102
|
|
99
|
-
|
100
|
-
|
101
|
-
# this will allow 1 nginx to serve several sites with different `server_name`
|
102
|
-
set :nginx_server_name, "example.com"
|
103
|
+
- `set :nginx_ssl_cert_key, "#{fetch(:nginx_server_name)}.key"`<br/>
|
104
|
+
Remote file name of the certificate. Only makes sense if `nginx_use_ssl` is set.
|
103
105
|
|
104
|
-
|
105
|
-
|
106
|
-
|
106
|
+
- `set :nginx_ssl_cert_local_path` # no default, required if
|
107
|
+
`nginx_use_ssl = true` and `nginx_upload_local_cert = true`<br/>
|
108
|
+
Local path to file with certificate. Only makes sense if `nginx_use_ssl` is
|
109
|
+
set. This file will be copied to remote server. Example value:
|
110
|
+
`set :nginx_ssl_cert_local_path, "/home/user/ssl/myssl.cert"`
|
107
111
|
|
108
|
-
|
109
|
-
|
110
|
-
|
112
|
+
- `set :nginx_ssl_cert_key_local_path` # no default<br/>
|
113
|
+
Local path to file with certificate key. Only makes sense if `nginx_use_ssl` is set.
|
114
|
+
This file will be copied to remote server. Example value:
|
115
|
+
`set :nginx_ssl_cert_key_local_path, "/home/user/ssl/myssl.key"`
|
111
116
|
|
112
|
-
|
113
|
-
# default value: `"#{shared_path}/config/unicorn.rb"`
|
114
|
-
set :unicorn_config, "#{shared_path}/config/unicorn.rb"
|
117
|
+
**Unicorn options**
|
115
118
|
|
116
|
-
|
117
|
-
# default value: `"#{shared_path}/config/unicorn.rb"`
|
118
|
-
set :unicorn_log, "#{shared_path}/config/unicorn.rb"
|
119
|
+
Defaults are listed near option name in the first line.
|
119
120
|
|
120
|
-
|
121
|
-
|
122
|
-
set :unicorn_user, "user"
|
121
|
+
- `set :unicorn_pid, shared_path.join("tmp/pids/unicorn.pid")`<br/>
|
122
|
+
Path for unicorn process pid file.
|
123
123
|
|
124
|
-
|
125
|
-
|
126
|
-
set :unicorn_workers, 4
|
124
|
+
- `set :unicorn_config, shared_path.join("config/unicorn.rb")`<br/>
|
125
|
+
Path for unicorn config file.
|
127
126
|
|
128
|
-
|
129
|
-
|
130
|
-
# and certificate file and key will be copied to `/etc/ssl/certs` and `/etc/ssl/private/` directories
|
131
|
-
# default value: false
|
132
|
-
set :nginx_use_ssl, false
|
127
|
+
- `set :unicorn_log, shared_path.join("log/unicorn.log")`<br/>
|
128
|
+
Unicorn log path.
|
133
129
|
|
134
|
-
|
135
|
-
|
136
|
-
set :
|
130
|
+
- `set :user` # no default, required<br/>
|
131
|
+
User name to run unicorn. This should be the name of the user doing the deploy,
|
132
|
+
example: `set :user, 'deploy'`
|
137
133
|
|
138
|
-
|
139
|
-
|
140
|
-
set :nginx_ssl_certificate, "#{nginx_server_name}.crt"
|
134
|
+
- `set :unicorn_workers, 2`<br/>
|
135
|
+
Number of unicorn workers.
|
141
136
|
|
142
|
-
|
143
|
-
# default value: `nginx_server_name + ".key"`
|
144
|
-
set :nginx_ssl_certificate_key, "#{nginx_server_name}.key"
|
137
|
+
### How it works
|
145
138
|
|
146
|
-
|
147
|
-
|
148
|
-
# default value: none (will be prompted if not set)
|
149
|
-
set :nginx_ssl_certificate_local_path, "/home/ivalkeen/ssl/myssl.cert"
|
139
|
+
`capistrano-unicorn-nginx` integrates seamlessly with the capistrano deploy task.
|
140
|
+
Here's what happens when you run `bundle exec cap production deploy`:
|
150
141
|
|
151
|
-
|
152
|
-
# this file will be copied to remote server
|
153
|
-
# default value: none (will be prompted if not set)
|
154
|
-
set :nginx_ssl_certificate_key_local_path, "/home/ivalkeen/ssl/myssl.key"
|
155
|
-
```
|
142
|
+
**Nginx**
|
156
143
|
|
157
|
-
|
158
|
-
|
144
|
+
- `after :started, "nginx:setup"`<br/>
|
145
|
+
Generates and uploads nginx config file. Symlinks config file to `/etc/nginx/sites-enabled`.
|
146
|
+
- `after :started, "nginx:setup_ssl"`<br/>
|
147
|
+
Performs SSL related tasks (false by default).
|
148
|
+
- `after :publishing, "nginx:reload"`<br/>
|
149
|
+
Reloads nginx.
|
159
150
|
|
160
|
-
|
161
|
-
set :server_name, "example.com"
|
162
|
-
set :unicorn_workers, 4
|
163
|
-
require 'capistrano-nginx-unicorn'
|
164
|
-
```
|
151
|
+
**Unicorn**
|
165
152
|
|
166
|
-
|
153
|
+
- `after :updated, "unicorn:setup_initializer"`<br/>
|
154
|
+
Uploads unicorn initializer file.
|
155
|
+
- `after :updated, "unicorn:setup_app_config"`<br/>
|
156
|
+
Generates unicorn application config file
|
157
|
+
- `after :publishing, "unicorn:restart"`<br/>
|
158
|
+
Restarts unicorn after new release.
|
167
159
|
|
168
|
-
|
160
|
+
### Template customization
|
169
161
|
|
170
|
-
|
162
|
+
If you want to change default templates, you can generate them using
|
163
|
+
`rails generator`:
|
171
164
|
|
172
|
-
|
173
|
-
|
165
|
+
$ bundle exec rails g capistrano:unicorn_nginx:config
|
166
|
+
|
167
|
+
This will copy default templates to `config/deploy/templates` directory, so you
|
168
|
+
can customize them as you like, and capistrano tasks will use this templates
|
169
|
+
instead of default.
|
174
170
|
|
175
171
|
You can also provide path, where to generate templates:
|
176
172
|
|
177
|
-
rails g capistrano:
|
173
|
+
$ bundle exec rails g capistrano:unicorn_nginx:config config/templates
|
174
|
+
|
175
|
+
### More Capistrano automation?
|
176
|
+
|
177
|
+
If you'd like to streamline your Capistrano deploys, you might want to check
|
178
|
+
these zero-configuration, plug-n-play plugins:
|
179
|
+
|
180
|
+
- [capistrano-postgresql](https://github.com/bruno-/capistrano-postgresql)<br/>
|
181
|
+
plugin that automates postgresql configuration and setup
|
182
|
+
- [capistrano-rbenv-install](https://github.com/bruno-/capistrano-rbenv-install)<br/>
|
183
|
+
would you like Capistrano to install rubies for you?
|
184
|
+
- [capistrano-safe-deploy-to](https://github.com/bruno-/capistrano-safe-deploy-to)<br/>
|
185
|
+
if you're annoyed that Capistrano does **not** create a deployment path for the
|
186
|
+
app on the server (default `/var/www/myapp`), this is what you need!
|
178
187
|
|
179
|
-
|
188
|
+
### Bug reports and pull requests
|
180
189
|
|
181
|
-
|
190
|
+
...are very welcome!
|
182
191
|
|
183
|
-
|
192
|
+
### Thanks
|
184
193
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
189
|
-
5. Create new Pull Request
|
194
|
+
[@kalys](https://github.com/kalys) - for his
|
195
|
+
[capistrano-nginx-unicorn](https://github.com/kalys/capistrano-nginx-unicorn)
|
196
|
+
plugin.
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
17
17
|
Works *only* with Capistrano 3+. For Capistrano 2 try version 0.0.8 of this
|
18
18
|
gem: http://rubygems.org/gems/capistrano-nginx-unicorn
|
19
19
|
EOF
|
20
|
-
gem.summary = "
|
20
|
+
gem.summary = "Capistrano tasks for automatic and sensible unicorn + nginx configuraion."
|
21
21
|
gem.homepage = "https://github.com/bruno-/capistrano-unicorn-nginx"
|
22
22
|
|
23
23
|
gem.files = `git ls-files`.split($/)
|
@@ -7,55 +7,51 @@ namespace :load do
|
|
7
7
|
set :templates_path, "config/deploy/templates"
|
8
8
|
set :nginx_server_name, -> { ask(:nginx_server_name, "Nginx server name: ") }
|
9
9
|
set :nginx_config_name, -> { "#{fetch(:application)}_#{fetch(:stage)}" }
|
10
|
-
set :nginx_use_ssl, false
|
11
10
|
set :nginx_pid, "/run/nginx.pid"
|
12
|
-
|
13
|
-
set :
|
14
|
-
set :
|
15
|
-
set :
|
16
|
-
set :
|
17
|
-
set :
|
11
|
+
# ssl options
|
12
|
+
set :nginx_use_ssl, false
|
13
|
+
set :nginx_ssl_cert, -> { "#{fetch(:nginx_server_name)}.crt" }
|
14
|
+
set :nginx_ssl_cert_key, -> { "#{fetch(:nginx_server_name)}.key" }
|
15
|
+
set :nginx_upload_local_cert, true
|
16
|
+
set :nginx_ssl_cert_local_path, -> { ask(:nginx_ssl_cert_local_path, "Local path to ssl certificate: ") }
|
17
|
+
set :nginx_ssl_cert_key_local_path, -> { ask(:nginx_ssl_cert_key_local_path, "Local path to ssl certificate key: ") }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
namespace :nginx do
|
22
22
|
desc "Setup nginx configuration"
|
23
23
|
task :setup do
|
24
|
-
on roles
|
25
|
-
|
24
|
+
on roles :web do
|
25
|
+
config_name = fetch(:nginx_config_name)
|
26
|
+
next if file_exists? "/etc/nginx/sites-available/#{config_name}"
|
26
27
|
|
27
28
|
execute :mkdir, "-p", shared_path.join("log")
|
28
|
-
template
|
29
|
-
|
30
|
-
|
31
|
-
sudo :ln, "-fs", "/etc/nginx/sites-available/#{fetch(:nginx_config_name)} /etc/nginx/sites-enabled/#{fetch(:nginx_config_name)}"
|
32
|
-
else
|
33
|
-
sudo :mv, "/tmp/#{fetch(:nginx_config_name)} #{fetch(:nginx_config_path)}/#{fetch(:nginx_config_name)}"
|
34
|
-
end
|
29
|
+
template "nginx_conf.erb", "#{fetch(:tmp_dir)}/#{config_name}"
|
30
|
+
sudo :mv, "#{fetch(:tmp_dir)}/#{config_name}", "/etc/nginx/sites-available/#{config_name}"
|
31
|
+
sudo :ln, "-fs", "/etc/nginx/sites-available/#{config_name}", "/etc/nginx/sites-enabled/#{config_name}"
|
35
32
|
end
|
36
33
|
end
|
37
34
|
|
38
35
|
desc "Setup nginx ssl certs"
|
39
36
|
task :setup_ssl do
|
40
|
-
on roles
|
41
|
-
|
42
|
-
|
43
|
-
upload! fetch(:nginx_ssl_certificate_local_path), "/tmp/#{fetch(:nginx_ssl_certificate)}"
|
44
|
-
upload! fetch(:nginx_ssl_certificate_key_local_path), "/tmp/#{fetch(:nginx_ssl_certificate_key)}"
|
45
|
-
|
46
|
-
sudo :mv, "/tmp/#{fetch(:nginx_ssl_certificate)} /etc/ssl/certs/#{fetch(:nginx_ssl_certificate)}"
|
47
|
-
sudo :mv, "/tmp/#{fetch(:nginx_ssl_certificate_key)} /etc/ssl/private/#{fetch(:nginx_ssl_certificate_key)}"
|
48
|
-
end
|
37
|
+
on roles :web do
|
38
|
+
next unless fetch(:nginx_use_ssl)
|
39
|
+
next if file_exists?("/etc/ssl/certs/#{fetch(:nginx_ssl_cert)}") && file_exists?("/etc/ssl/private/#{fetch(:nginx_ssl_cert_key)}")
|
49
40
|
|
50
|
-
|
51
|
-
|
41
|
+
if fetch(:nginx_upload_local_cert)
|
42
|
+
upload! fetch(:nginx_ssl_cert_local_path), "#{fetch(:tmp_dir)}/#{fetch(:nginx_ssl_cert)}"
|
43
|
+
upload! fetch(:nginx_ssl_cert_key_local_path), "#{fetch(:tmp_dir)}/#{fetch(:nginx_ssl_cert_key)}"
|
44
|
+
sudo :mv, "#{fetch(:tmp_dir)}/#{fetch(:nginx_ssl_cert)}", "/etc/ssl/certs/#{fetch(:nginx_ssl_cert)}"
|
45
|
+
sudo :mv, "#{fetch(:tmp_dir)}/#{fetch(:nginx_ssl_cert_key)}", "/etc/ssl/private/#{fetch(:nginx_ssl_cert_key)}"
|
52
46
|
end
|
47
|
+
sudo :chown, "root:root", "/etc/ssl/certs/#{fetch(:nginx_ssl_cert)}"
|
48
|
+
sudo :chown, "root:root", "/etc/ssl/private/#{fetch(:nginx_ssl_cert_key)}"
|
53
49
|
end
|
54
50
|
end
|
55
51
|
|
56
52
|
desc "Reload nginx configuration"
|
57
53
|
task :reload do
|
58
|
-
on roles
|
54
|
+
on roles :web do
|
59
55
|
sudo "/etc/init.d/nginx reload"
|
60
56
|
end
|
61
57
|
end
|
@@ -6,7 +6,7 @@ namespace :load do
|
|
6
6
|
task :defaults do
|
7
7
|
set :unicorn_service_name, -> { "unicorn_#{fetch(:application)}_#{fetch(:stage)}" }
|
8
8
|
set :templates_path, "config/deploy/templates"
|
9
|
-
set :unicorn_pid, -> { shared_path.join("pids/unicorn.pid") }
|
9
|
+
set :unicorn_pid, -> { shared_path.join("tmp/pids/unicorn.pid") }
|
10
10
|
set :unicorn_config, -> { shared_path.join("config/unicorn.rb") }
|
11
11
|
set :unicorn_log, -> { shared_path.join("log/unicorn.log") }
|
12
12
|
set :unicorn_user, -> { fetch(:user) }
|
@@ -17,24 +17,24 @@ end
|
|
17
17
|
namespace :unicorn do
|
18
18
|
desc "Setup Unicorn initializer"
|
19
19
|
task :setup_initializer do
|
20
|
-
on roles
|
20
|
+
on roles :app do
|
21
21
|
next if file_exists? "/etc/init.d/#{fetch(:unicorn_service_name)}"
|
22
22
|
|
23
|
-
template "unicorn_init.erb", "/
|
24
|
-
execute :chmod, "+x", "/
|
25
|
-
sudo :mv, "/
|
23
|
+
template "unicorn_init.erb", "#{fetch(:tmp_dir)}/unicorn_init"
|
24
|
+
execute :chmod, "+x", "#{fetch(:tmp_dir)}/unicorn_init"
|
25
|
+
sudo :mv, "#{fetch(:tmp_dir)}/unicorn_init", "/etc/init.d/#{fetch(:unicorn_service_name)}"
|
26
26
|
sudo "update-rc.d -f #{fetch(:unicorn_service_name)} defaults"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
30
|
desc "Setup Unicorn app configuration"
|
31
31
|
task :setup_app_config do
|
32
|
-
on roles
|
32
|
+
on roles :app do
|
33
33
|
next if file_exists? fetch(:unicorn_config)
|
34
34
|
|
35
35
|
execute :mkdir, "-p", shared_path.join("config")
|
36
36
|
execute :mkdir, "-p", shared_path.join("log")
|
37
|
-
execute :mkdir, "-p", shared_path.join("pids")
|
37
|
+
execute :mkdir, "-p", shared_path.join("tmp/pids")
|
38
38
|
template "unicorn.rb.erb", fetch(:unicorn_config)
|
39
39
|
end
|
40
40
|
end
|
@@ -42,8 +42,8 @@ namespace :unicorn do
|
|
42
42
|
%w[start stop restart].each do |command|
|
43
43
|
desc "#{command} unicorn"
|
44
44
|
task command do
|
45
|
-
on roles
|
46
|
-
execute
|
45
|
+
on roles :app do
|
46
|
+
execute :service, fetch(:unicorn_service_name), command
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
@@ -12,7 +12,6 @@ module Capistrano
|
|
12
12
|
copy_file "nginx_conf.erb", "#{templates_path}/nginx_conf.erb"
|
13
13
|
copy_file "unicorn.rb.erb", "#{templates_path}/unicorn.rb.erb"
|
14
14
|
copy_file "unicorn_init.erb", "#{templates_path}/unicorn_init.erb"
|
15
|
-
copy_file "logrotate.erb", "#{templates_path}/logrotate.erb"
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
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: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno Sutic
|
@@ -103,5 +103,5 @@ rubyforge_project:
|
|
103
103
|
rubygems_version: 2.1.5
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
|
-
summary:
|
106
|
+
summary: Capistrano tasks for automatic and sensible unicorn + nginx configuraion.
|
107
107
|
test_files: []
|