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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 334f1a9b32d324cb61abc30de2f70652e7e5d01c
4
- data.tar.gz: 491c76d4ccd11448b9603a55c699284bd25e48e9
3
+ metadata.gz: 3ba9014b437c5edd7f11ec63c8837813a8e62e51
4
+ data.tar.gz: 31a185073e53a2affe02dc71014cfc104643dde2
5
5
  SHA512:
6
- metadata.gz: a5ead97ec48101db2a2a10143ed0c2b4a39094ae47b051f37eb007a8b580735aa4b05626b4f7b6e92f29ff26b3b1f6701481031433b2980bb16879723389b72d
7
- data.tar.gz: 26249b36ecb21b3c990d0f8aa40c02044d6bff1813f88babc066c722285cf85439dada54793248239d9cea3a1966969e58f59752dc7f37e2703d2a980b3a0773
6
+ metadata.gz: c2b336eb13f766af1dd17053d348931640d0c802af5d35b38401484fdd9f0b53893f5f0fdf273deaf344e3bdfa2edd463ecc8f1352e2bfa1af3cadb467d25152
7
+ data.tar.gz: 7b0c1270d455a5bf65e48635c6f8b92886f1f92e03e315d589a6808c8792edcfe071d3020db5f28e308faa0d6c94fd01548901906d9b66db47942e948ca83fae
data/README.md CHANGED
@@ -1,189 +1,196 @@
1
- # Capistrano-Nginx-Unicorn
1
+ # Capistrano::UnicornNginx
2
2
 
3
- Capistrano tasks for configuration and management nginx+unicorn combo for zero downtime deployments of Rails applications.
3
+ Capistrano tasks for automatic and sensible unicorn + nginx configuraion.
4
4
 
5
- Provides capistrano tasks to:
5
+ Goals of this plugin:
6
6
 
7
- * easily add application to nginx and reload it's configuration
8
- * create unicorn init script for application, so it will be automatically started when OS restarts
9
- * start/stop unicorn (also can be done using `sudo service unicorn_<your_app> start/stop`)
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
- Provides several capistrano variables for easy customization.
14
- Also, for full customization, all configs can be copied to the application using generators.
11
+ Specifics:
15
12
 
16
- ## Installation
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
- Add this line to your application's Gemfile:
19
+ `capistrano-unicorn-nginx` works only with Capistrano 3!
19
20
 
20
- gem 'capistrano-nginx-unicorn', require: false, group: :development
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
- And then execute:
27
+ ### Installation
23
28
 
24
- $ bundle
29
+ Add this to `Gemfile`:
25
30
 
26
- Or install it yourself as:
31
+ group :development do
32
+ gem 'capistrano', '~> 3.1'
33
+ gem 'capistrano-unicorn-nginx'
34
+ end
27
35
 
28
- $ gem install capistrano-nginx-unicorn
36
+ And then:
29
37
 
30
- ## Usage
38
+ $ bundle install
31
39
 
32
- Add this line to your `deploy.rb`
40
+ ### Setup and usage
33
41
 
34
- require 'capistrano-nginx-unicorn'
42
+ Add this line to `Capfile`
35
43
 
36
- Note, that following capistrano variables should be defined:
44
+ require 'capistrano/unicorn-nginx'
37
45
 
38
- application
39
- current_path
40
- shared_path
41
- user
46
+ Set `nginx_server_name` in stage file, example `config/deploy/production.rb`:
42
47
 
43
- You can check that new tasks are available (`cap -T`):
48
+ set :user, 'deployer' # user doing the deploy
49
+ set :nginx_server_name, 'mydomain.com'
44
50
 
45
- for nginx:
51
+ or if you don't have a domain yet:
46
52
 
47
- # add and enable application to nginx
48
- cap nginx:setup
53
+ set :nginx_server_name, '<server_ip>'
49
54
 
50
- # reload nginx configuration
51
- cap nginx:reload
55
+ And you're all set!
52
56
 
53
- and for unicorn:
57
+ Execute:
54
58
 
55
- # create unicorn configuration and init script
56
- cap unicorn:setup
59
+ $ bundle exec cap deploy production
57
60
 
58
- # start unicorn
59
- cap unicorn:start
61
+ and enjoy watching your app being deployed!
60
62
 
61
- # stop unicorn
62
- cap unicorn:stop
63
+ ### Configuration
63
64
 
64
- # reload unicorn with no downtime
65
- # old workers will process new request until new master is fully loaded
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 shared:
68
+ You'll find the options and their defaults below.
70
69
 
71
- # create logrotate record to rotate application logs
72
- cap logrotate
70
+ In order to override the default, put the option in the stage file, for example:
73
71
 
74
- There is no need to execute any of these tasks manually.
75
- They will be called automatically on different deploy stages:
72
+ # in config/deploy/production.rb
73
+ set :unicorn_workers, 4
76
74
 
77
- * `nginx:setup`, `nginx:reload`, `unicorn:setup` and `logrotate` are hooked to `deploy:setup`
78
- * `unicorn:restart` is hooked to `deploy:restart`
75
+ **Nginx options**
79
76
 
80
- This means that if you run `cap deploy:setup`,
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
- However, if you changed variables or customized templates,
85
- you can run any of these tasks to update configuration.
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
- ## Customization
84
+ - `set :nginx_pid, "/run/nginx.pid"`<br/>
85
+ Path for nginx process pid file.
88
86
 
89
- ### Using variables
87
+ SSL related options:
90
88
 
91
- You can customize nginx and unicorn configs using capistrano variables:
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
- ```ruby
95
- # path to customized templates (see below for details)
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
- # server name for nginx, default value: no (will be prompted if not set)
100
- # set this to your site name as it is visible from outside
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
- # path, where unicorn pid file will be stored
105
- # default value: `"#{current_path}/tmp/pids/unicorn.pid"`
106
- set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
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
- # path, where nginx pid file will be stored (used in logrotate recipe)
109
- # default value: `"/run/nginx.pid"`
110
- set :nginx_pid, "/run/nginx.pid"
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
- # path, where unicorn config file will be stored
113
- # default value: `"#{shared_path}/config/unicorn.rb"`
114
- set :unicorn_config, "#{shared_path}/config/unicorn.rb"
117
+ **Unicorn options**
115
118
 
116
- # path, where unicorn log file will be stored
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
- # user name to run unicorn
121
- # default value: `user` (user varibale defined in your `deploy.rb`)
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
- # number of unicorn workers
125
- # default value: no (will be prompted if not set)
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
- # if set, nginx will be configured to 443 port and port 80 will be auto rewritten to 443
129
- # also, on `nginx:setup`, paths to ssl certificate and key will be configured
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
- # if set, it will ask to upload certificates from a local path. Otherwise, it will expect
135
- # the certificate and key defined in the next 2 variables to be already in the server.
136
- set :nginx_upload_local_certificate, { true }
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
- # remote file name of the certificate, only makes sense if `nginx_use_ssl` is set
139
- # default value: `nginx_server_name + ".crt"`
140
- set :nginx_ssl_certificate, "#{nginx_server_name}.crt"
134
+ - `set :unicorn_workers, 2`<br/>
135
+ Number of unicorn workers.
141
136
 
142
- # remote file name of the certificate, only makes sense if `nginx_use_ssl` is set
143
- # default value: `nginx_server_name + ".key"`
144
- set :nginx_ssl_certificate_key, "#{nginx_server_name}.key"
137
+ ### How it works
145
138
 
146
- # local path to file with certificate, only makes sense if `nginx_use_ssl` is set
147
- # this file will be copied to remote server
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
- # local path to file with certificate key, only makes sense if `nginx_use_ssl` is set
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
- For example, of you site name is `example.com` and you want to use 8 unicorn workers,
158
- your `deploy.rb` will look like this:
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
- ```ruby
161
- set :server_name, "example.com"
162
- set :unicorn_workers, 4
163
- require 'capistrano-nginx-unicorn'
164
- ```
151
+ **Unicorn**
165
152
 
166
- ### Template Customization
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
- If you want to change default templates, you can generate them using `rails generator`
160
+ ### Template customization
169
161
 
170
- rails g capistrano:nginx_unicorn:config
162
+ If you want to change default templates, you can generate them using
163
+ `rails generator`:
171
164
 
172
- This will copy default templates to `config/deploy/templates` directory,
173
- so you can customize them as you like, and capistrano tasks will use this templates instead of default.
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:nginx_unicorn:config config/templates
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
- # TODO:
188
+ ### Bug reports and pull requests
180
189
 
181
- * add tests
190
+ ...are very welcome!
182
191
 
183
- ## Contributing
192
+ ### Thanks
184
193
 
185
- 1. Fork it
186
- 2. Create your feature branch (`git checkout -b my-new-feature`)
187
- 3. Commit your changes (`git commit -am 'Add some feature'`)
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 = "Create and manage unicorn + nginx configs from capistrano"
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
- set :nginx_ssl_certificate, -> { "#{fetch(:nginx_server_name)}.crt" }
13
- set :nginx_ssl_certificate_key, -> { "#{fetch(:nginx_server_name)}.key" }
14
- set :nginx_upload_local_certificate, true
15
- set :nginx_ssl_certificate_local_path, -> { ask(:nginx_ssl_certificate_local_path, "Local path to ssl certificate: ") }
16
- set :nginx_ssl_certificate_key_local_path, -> { ask(:nginx_ssl_certificate_key_local_path, "Local path to ssl certificate key: ") }
17
- set :nginx_config_path, "/etc/nginx/sites-available"
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(:web) do
25
- next if file_exists? "#{fetch(:nginx_config_path)}/#{fetch(:nginx_config_name)}"
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("nginx_conf.erb", "/tmp/nginx_#{fetch(:nginx_config_name)}")
29
- if fetch(:nginx_config_path) == "/etc/nginx/sites-available"
30
- sudo :mv, "/tmp/nginx_#{fetch(:nginx_config_name)} /etc/nginx/sites-available/#{fetch(:nginx_config_name)}"
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(:web) do
41
- if fetch(:nginx_use_ssl)
42
- if fetch(:nginx_upload_local_certificate)
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
- sudo :chown, "root:root /etc/ssl/certs/#{fetch(:nginx_ssl_certificate)}"
51
- sudo :chown, "root:root /etc/ssl/private/#{fetch(:nginx_ssl_certificate_key)}"
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(:web) do
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(:app) do
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", "/tmp/unicorn_init"
24
- execute :chmod, "+x", "/tmp/unicorn_init"
25
- sudo :mv, "/tmp/unicorn_init /etc/init.d/#{fetch(:unicorn_service_name)}"
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(:app) do
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(:app) do
46
- execute "service #{fetch(:unicorn_service_name)} #{command}"
45
+ on roles :app do
46
+ execute :service, fetch(:unicorn_service_name), command
47
47
  end
48
48
  end
49
49
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module UnicornNginx
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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: Create and manage unicorn + nginx configs from capistrano
106
+ summary: Capistrano tasks for automatic and sensible unicorn + nginx configuraion.
107
107
  test_files: []