vlad-unicorn 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/History.txt +8 -0
- data/README.txt +5 -1
- data/Rakefile +1 -1
- data/docs/rails-configuration.txt +12 -0
- data/lib/vlad/unicorn.rb +1 -2
- data/lib/vlad/unicorn_common.rb +19 -15
- data/lib/vlad/unicorn_rails.rb +1 -2
- metadata +11 -28
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -29,6 +29,9 @@ or for legacy Rails (1.2.x thru 2.2.x) apps
|
|
29
29
|
rescue LoadError
|
30
30
|
end
|
31
31
|
|
32
|
+
For more on specific issues when deploying Rails applications, see
|
33
|
+
rails-configuration.txt[link:docs/rails-configuration_txt.html].
|
34
|
+
|
32
35
|
== REQUIREMENTS:
|
33
36
|
|
34
37
|
* Vlad[http://rubyhitsquad.com/Vlad_the_Deployer.html]
|
@@ -57,7 +60,8 @@ unicorn_use_sudo:: Whether to use sudo to run the 'unicorn' command on
|
|
57
60
|
the remote host. Probably necessary if you specify a
|
58
61
|
user and group in unicorn.rb.
|
59
62
|
|
60
|
-
|
63
|
+
For more on specific issues when deploying Rails applications, see
|
64
|
+
rails-configuration.txt[link:docs/rails-configuration_txt.html].
|
61
65
|
|
62
66
|
== LICENSE:
|
63
67
|
|
data/Rakefile
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
= Configuring Unicorn for Rails
|
2
2
|
|
3
|
+
== Setting environment and prefix
|
4
|
+
|
3
5
|
The astute observer will notice the lack of variables in vlad-unicorn to set
|
4
6
|
the Rails environment or a path prefix for the app (the +unicorn_rails+
|
5
7
|
command allows this with with the +--env+ and +--path+ options, respectively).
|
@@ -8,3 +10,13 @@ environment variables in the unicorn.rb config file, like so:
|
|
8
10
|
|
9
11
|
ENV['RAILS_ENV'] = 'production'
|
10
12
|
ENV['RAILS_RELATIVE_URL_ROOT'] = '/prefix'
|
13
|
+
|
14
|
+
== Using with Rails 2.3 and Bundler
|
15
|
+
|
16
|
+
When using Rails 2.3 with Bundler, you have to <code>bundle exec</code>
|
17
|
+
everything. This can be done by setting +unicorn_command+ in your deploy.rb.
|
18
|
+
Since Vlad doesn't change into the +RAILS_ROOT+ directory before attempting to
|
19
|
+
run remote commands, though, you have to explicitly tell Bundler where the
|
20
|
+
Gemfile is:
|
21
|
+
|
22
|
+
set :unicorn_command, "bundle --gemfile=#{current_path}/Gemfile exec unicorn_rails"
|
data/lib/vlad/unicorn.rb
CHANGED
data/lib/vlad/unicorn_common.rb
CHANGED
@@ -2,9 +2,9 @@ require 'vlad'
|
|
2
2
|
|
3
3
|
module Vlad
|
4
4
|
module Unicorn
|
5
|
-
VERSION = '2.
|
5
|
+
VERSION = '2.1.0' #:nodoc:
|
6
6
|
|
7
|
-
# Runs +cmd+ using sudo if the +:
|
7
|
+
# Runs +cmd+ using sudo if the +:unicorn_use_sudo+ variable is set.
|
8
8
|
def self.maybe_sudo(cmd)
|
9
9
|
if unicorn_use_sudo
|
10
10
|
sudo cmd
|
@@ -12,29 +12,33 @@ module Vlad
|
|
12
12
|
run cmd
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
def self.signal(sig = '0')
|
17
|
+
%(test -s "#{unicorn_pid}" && kill -#{sig} `cat "#{unicorn_pid}"`)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.start(opts = '')
|
21
|
+
cmd = signal('HUP')
|
22
|
+
cmd << %( || #{unicorn_command} -D --config-file #{unicorn_config} #{opts})
|
23
|
+
maybe_sudo %(sh -c '#{cmd}')
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.stop
|
27
|
+
cmd = signal('QUIT')
|
28
|
+
cmd << %( || echo "stale pid file #{unicorn_pid}")
|
29
|
+
maybe_sudo %(sh -c '#{cmd}')
|
30
|
+
end
|
15
31
|
end
|
16
32
|
end
|
17
33
|
|
18
34
|
namespace :vlad do
|
19
|
-
|
20
35
|
set :unicorn_command, "unicorn"
|
21
36
|
set(:unicorn_config) { "#{current_path}/config/unicorn.rb" }
|
22
37
|
set :unicorn_use_sudo, false
|
23
38
|
set(:unicorn_pid) { "#{shared_path}/pids/unicorn.pid" }
|
24
39
|
|
25
|
-
def unicorn(opts = '')
|
26
|
-
cmd = "#{unicorn_command} -D --config-file #{unicorn_config}"
|
27
|
-
cmd << " #{opts}"
|
28
|
-
cmd
|
29
|
-
end
|
30
|
-
|
31
40
|
desc "Stop the app servers"
|
32
41
|
remote_task :stop_app, :roles => :app do
|
33
|
-
|
34
|
-
cmd << %(if [ -f "#{unicorn_pid}" ])
|
35
|
-
cmd << %(then kill `cat #{unicorn_pid}` || echo "stale pid file #{unicorn_pid}")
|
36
|
-
cmd << %(fi)
|
37
|
-
Vlad::Unicorn.maybe_sudo %Q(sh -c '#{cmd.join("; ")}')
|
42
|
+
Vlad::Unicorn.stop
|
38
43
|
end
|
39
|
-
|
40
44
|
end
|
data/lib/vlad/unicorn_rails.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vlad-unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
|
+
- 1
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 2.0.0
|
10
|
+
version: 2.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Kevin R. Bullock
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
19
|
-
default_executable:
|
18
|
+
date: 2011-09-30 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: vlad
|
@@ -34,37 +33,21 @@ dependencies:
|
|
34
33
|
type: :runtime
|
35
34
|
version_requirements: *id001
|
36
35
|
- !ruby/object:Gem::Dependency
|
37
|
-
name:
|
36
|
+
name: hoe
|
38
37
|
prerelease: false
|
39
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
40
|
requirements:
|
42
41
|
- - ">="
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
43
|
+
hash: 35
|
45
44
|
segments:
|
46
45
|
- 2
|
47
|
-
-
|
46
|
+
- 9
|
48
47
|
- 4
|
49
|
-
version: 2.
|
48
|
+
version: 2.9.4
|
50
49
|
type: :development
|
51
50
|
version_requirements: *id002
|
52
|
-
- !ruby/object:Gem::Dependency
|
53
|
-
name: hoe
|
54
|
-
prerelease: false
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 21
|
61
|
-
segments:
|
62
|
-
- 2
|
63
|
-
- 6
|
64
|
-
- 1
|
65
|
-
version: 2.6.1
|
66
|
-
type: :development
|
67
|
-
version_requirements: *id003
|
68
51
|
description: |-
|
69
52
|
Unicorn app server support for Vlad. Adds support for vlad:start_app and
|
70
53
|
vlad:stop_app using Unicorn[http://unicorn.bogomips.org/].
|
@@ -90,7 +73,7 @@ files:
|
|
90
73
|
- lib/vlad/unicorn_common.rb
|
91
74
|
- lib/vlad/unicorn_rails.rb
|
92
75
|
- test/test_vlad_unicorn.rb
|
93
|
-
|
76
|
+
- .gemtest
|
94
77
|
homepage: http://bitbucket.org/krbullock/vlad-unicorn/
|
95
78
|
licenses: []
|
96
79
|
|
@@ -121,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
104
|
requirements: []
|
122
105
|
|
123
106
|
rubyforge_project: hitsquad
|
124
|
-
rubygems_version: 1.
|
107
|
+
rubygems_version: 1.8.9
|
125
108
|
signing_key:
|
126
109
|
specification_version: 3
|
127
110
|
summary: Unicorn app server support for Vlad
|