simple-capistrano-unicorn 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.ruby-version +1 -0
- data/CHANGELOG.md +2 -3
- data/README.md +12 -4
- data/lib/simple-capistrano-unicorn/namespace.rb +4 -6
- data/lib/simple-capistrano-unicorn/version.rb +1 -1
- data/simple-capistrano-unicorn.gemspec +1 -1
- metadata +60 -72
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p327
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
## v 0.0.
|
1
|
+
## v 0.0.4: Removal of unused variables, and making sure that we don't try to delete pids that aren't there.
|
2
2
|
|
3
|
+
## v 0.0.3: Better documentation.
|
3
4
|
Added better (correct!) documentation, and added possibility to use a different unicorn.stderr.log
|
4
5
|
|
5
6
|
## v 0.0.2: Initial release.
|
6
|
-
|
7
7
|
Added better Capistrano bindings
|
8
8
|
|
9
9
|
## v 0.0.1: Initial release.
|
10
|
-
|
11
10
|
:)
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
Contains a namespace with methods for administrating the unicorn server through capistrano recipes.
|
4
4
|
|
5
|
+
This gem is composed from the gems `capistrano-unicorn-methods` and `capistrano-unicorn`. It is roughly the structure of `capistrano-unicorn-methods` with clever ideas from `capistrano-unicorn`.
|
6
|
+
|
5
7
|
## Setup
|
6
8
|
|
7
9
|
### 1. Require this gem in deploy.rb
|
@@ -20,11 +22,19 @@ You should place this line in `RAILS_ROOT/config/deploy.rb`:
|
|
20
22
|
after :deploy, "unicorn:restart"
|
21
23
|
```
|
22
24
|
|
23
|
-
### 3.
|
25
|
+
### 3. Add unicorn.rb (only for single-stage setup)
|
26
|
+
|
27
|
+
Grab the sample Unicorn configuration here: http://unicorn.bogomips.org/examples/unicorn.conf.rb
|
28
|
+
|
29
|
+
And place it here: `RAILS_ROOT/config/unicorn.rb`
|
30
|
+
|
31
|
+
### 4. Add unicorn stage files (only for multi-stage setup)
|
24
32
|
|
25
33
|
Make sure that you are using the multi-stage extension for Capistrano ( https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension )
|
26
34
|
|
27
|
-
You
|
35
|
+
You can get a sample of the Unicorn configuration here: http://unicorn.bogomips.org/examples/unicorn.conf.rb
|
36
|
+
|
37
|
+
You should create different Unicorn files to use for each of your different environments. The most common setup is to place the Unicorn configuration files in `RAILS_ROOT/config/unicorn/{staging|beta|production}.rb`.
|
28
38
|
|
29
39
|
You can then override the `unicorn_config`-variable that this gem is listening for, by placing this in `RAILS_ROOT/config/deploy.rb`:
|
30
40
|
|
@@ -57,8 +67,6 @@ You can customize the gems behavior by setting any (or all) of the following opt
|
|
57
67
|
* `unicorn_pid` indicates the path for the pid file. Defaults to `"#{shared_path}/pids/unicorn.pid"`.
|
58
68
|
* `unicorn_old_pid` indicates the path for the old pid file, which Unicorn creates when forking a new master. Defaults to `#{shared_path}/pids/unicorn.pid.oldbin`.
|
59
69
|
* `unicorn_config` the path to the unicorn config file. Defaults to `"#{current_path}/config/unicorn.rb"`.
|
60
|
-
* `unicorn_socket` indicates the place that Unicorn should place its socket file. Defaults to `"#{shared_path}/system/unicorn.sock"`.
|
61
70
|
* `unicorn_log` the path where unicorn places its STDERR-log. Defaults to `"#{shared_path}/log/unicorn.stderr.log"`.
|
62
|
-
* `unicorn_port` defines the port that unicorn should listen on. Defaults to `"3000"`.
|
63
71
|
* `use_bundler` defines whether Unicorn should start with `bundle exec` or not. Default to `true`.
|
64
72
|
* `rails_env` sets the environment that the server will run in. Defaults to `"production"`.
|
@@ -9,9 +9,7 @@ module SimpleCapistranoUnicorn
|
|
9
9
|
_cset(:unicorn_pid) { "#{shared_path}/pids/unicorn.pid" }
|
10
10
|
_cset(:unicorn_old_pid) { "#{shared_path}/pids/unicorn.pid.oldbin" }
|
11
11
|
_cset(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
|
12
|
-
_cset(:unicorn_socket) { "#{shared_path}/system/unicorn.sock" }
|
13
12
|
_cset(:unicorn_log) { "#{shared_path}/log/unicorn.stderr.log" }
|
14
|
-
_cset(:unicorn_port) { '3000' }
|
15
13
|
_cset(:use_bundler) { true }
|
16
14
|
_cset(:rails_env) { "production" }
|
17
15
|
|
@@ -37,13 +35,13 @@ module SimpleCapistranoUnicorn
|
|
37
35
|
end
|
38
36
|
|
39
37
|
def start_unicorn(server)
|
40
|
-
run "cd #{current_path}; #{'bundle exec' if use_bundler} unicorn -c #{unicorn_config} -E #{rails_env}
|
38
|
+
run "cd #{current_path}; #{'bundle exec' if use_bundler} unicorn -c #{unicorn_config} -E #{rails_env} -D", :hosts => [server]
|
41
39
|
end
|
42
40
|
|
43
41
|
def clean_old_unicorn(server)
|
44
42
|
if old_unicorn_is_running?(server)
|
45
43
|
run "kill -s QUIT `cat #{unicorn_old_pid}`", :hosts => [server]
|
46
|
-
run "if [ -e #{
|
44
|
+
run "if [ -e #{unicorn_old_pid} ]; then rm #{unicorn_old_pid}; fi", :hosts => [server]
|
47
45
|
logger.info nice_output("Cleaned up old Unicorn", server)
|
48
46
|
end
|
49
47
|
end
|
@@ -74,7 +72,7 @@ module SimpleCapistranoUnicorn
|
|
74
72
|
find_servers(:roles => :app).each do |server|
|
75
73
|
if unicorn_is_running?(server)
|
76
74
|
run "kill -s QUIT `cat #{unicorn_pid}`", :hosts => [server]
|
77
|
-
run "rm #{unicorn_pid}", :hosts => [server]
|
75
|
+
run "if [ -e #{unicorn_pid} ]; then rm #{unicorn_pid}; fi", :hosts => [server]
|
78
76
|
logger.info nice_output("Stopped Unicorn!", server)
|
79
77
|
else
|
80
78
|
logger.info nice_output("Unicorn _not_ running, nothing to stop!", server)
|
@@ -96,7 +94,7 @@ module SimpleCapistranoUnicorn
|
|
96
94
|
logger.info nice_output("Restarted Unicorn!", server)
|
97
95
|
else
|
98
96
|
start_unicorn(server)
|
99
|
-
logger.info nice_output("Unicorn wasn't running,
|
97
|
+
logger.info nice_output("Unicorn wasn't running, started it!", server)
|
100
98
|
end
|
101
99
|
end
|
102
100
|
end
|
@@ -7,7 +7,7 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.version = Capistrano::Unicorn::Methods::VERSION
|
8
8
|
gem.authors = ["Kasper Grubbe"]
|
9
9
|
gem.email = ["kaspergrubbe@gmail.com"]
|
10
|
-
gem.homepage = "http://kaspergrubbe
|
10
|
+
gem.homepage = "http://github.com/kaspergrubbe/simple-capistrano-unicorn"
|
11
11
|
gem.summary = %q{Contains a collection of simple tasks to manage Unicorn with Capistrano.}
|
12
12
|
gem.description = %q{Contains a collection of simple tasks to manage Unicorn with Capistrano.}
|
13
13
|
|
metadata
CHANGED
@@ -1,75 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-capistrano-unicorn
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Kasper Grubbe
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-01-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rake
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
32
22
|
type: :development
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: unicorn
|
36
23
|
prerelease: false
|
37
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
25
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: unicorn
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
46
38
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: capistrano
|
50
39
|
prerelease: false
|
51
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
41
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: capistrano
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
60
54
|
type: :runtime
|
61
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
62
|
description: Contains a collection of simple tasks to manage Unicorn with Capistrano.
|
63
|
-
email:
|
63
|
+
email:
|
64
64
|
- kaspergrubbe@gmail.com
|
65
65
|
executables: []
|
66
|
-
|
67
66
|
extensions: []
|
68
|
-
|
69
67
|
extra_rdoc_files: []
|
70
|
-
|
71
|
-
files:
|
68
|
+
files:
|
72
69
|
- .gitignore
|
70
|
+
- .ruby-version
|
73
71
|
- CHANGELOG.md
|
74
72
|
- Gemfile
|
75
73
|
- README.md
|
@@ -78,38 +76,28 @@ files:
|
|
78
76
|
- lib/simple-capistrano-unicorn/namespace.rb
|
79
77
|
- lib/simple-capistrano-unicorn/version.rb
|
80
78
|
- simple-capistrano-unicorn.gemspec
|
81
|
-
homepage: http://kaspergrubbe
|
79
|
+
homepage: http://github.com/kaspergrubbe/simple-capistrano-unicorn
|
82
80
|
licenses: []
|
83
|
-
|
84
81
|
post_install_message:
|
85
82
|
rdoc_options: []
|
86
|
-
|
87
|
-
require_paths:
|
83
|
+
require_paths:
|
88
84
|
- lib
|
89
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
86
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
- 0
|
97
|
-
version: "0"
|
98
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
92
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
version: "0"
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
107
97
|
requirements: []
|
108
|
-
|
109
98
|
rubyforge_project: simple-capistrano-unicorn
|
110
99
|
rubygems_version: 1.8.24
|
111
100
|
signing_key:
|
112
101
|
specification_version: 3
|
113
102
|
summary: Contains a collection of simple tasks to manage Unicorn with Capistrano.
|
114
103
|
test_files: []
|
115
|
-
|