capistrano-unicorn 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
data/examples/rails3.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# ------------------------------------------------------------------------------
|
2
|
+
# Sample rails 3 config
|
3
|
+
# ------------------------------------------------------------------------------
|
4
|
+
|
5
|
+
# Set your full path to application.
|
6
|
+
app_path = "/path/to/app"
|
7
|
+
|
8
|
+
# Set unicorn options
|
9
|
+
worker_processes 1
|
10
|
+
preload_app true
|
11
|
+
timeout 180
|
12
|
+
listen 9000
|
13
|
+
|
14
|
+
# Spawn unicorn master worker for user apps (group: apps)
|
15
|
+
user 'apps', 'apps'
|
16
|
+
|
17
|
+
# Fill path to your app
|
18
|
+
working_directory app_path
|
19
|
+
|
20
|
+
# Should be 'production' by default, otherwise use other env
|
21
|
+
rails_env = ENV['RAILS_ENV'] || 'production'
|
22
|
+
|
23
|
+
# Log everything to one file
|
24
|
+
stderr_path "log/unicorn.log"
|
25
|
+
stdout_path "log/unicorn.log"
|
26
|
+
|
27
|
+
# Set master PID location
|
28
|
+
pid "#{app_path}/tmp/pids/unicorn.pid"
|
29
|
+
|
30
|
+
before_fork do |server, worker|
|
31
|
+
ActiveRecord::Base.connection.disconnect!
|
32
|
+
|
33
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
34
|
+
if File.exists?(old_pid) && server.pid != old_pid
|
35
|
+
begin
|
36
|
+
Process.kill("QUIT", File.read(old_pid).to_i)
|
37
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
38
|
+
# someone else did our job for us
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
after_fork do |server, worker|
|
44
|
+
ActiveRecord::Base.establish_connection
|
45
|
+
end
|
@@ -22,8 +22,8 @@ module CapistranoUnicorn
|
|
22
22
|
task :start, :roles => :app, :except => {:no_release => true} do
|
23
23
|
config_path = "#{current_path}/config/unicorn/#{unicorn_env}.rb"
|
24
24
|
if remote_file_exists?(config_path)
|
25
|
-
logger.important("Starting...")
|
26
|
-
run "cd #{current_path} && bundle exec unicorn -c #{config_path} -E #{unicorn_env} -D"
|
25
|
+
logger.important("Starting...", "Unicorn")
|
26
|
+
run "cd #{current_path} && BUNDLE_GEMFILE=#{current_path}/Gemfile bundle exec unicorn -c #{config_path} -E #{unicorn_env} -D"
|
27
27
|
else
|
28
28
|
logger.important("Config file for \"#{unicorn_env}\" environment was not found at \"#{config_path}\"", "Unicorn")
|
29
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-09 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
16
|
-
requirement: &
|
16
|
+
requirement: &2165782000 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2165782000
|
25
25
|
description: Capistrano plugin that integrates Unicorn server tasks.
|
26
26
|
email: dan.sosedoff@gmail.com
|
27
27
|
executables: []
|
@@ -32,6 +32,7 @@ files:
|
|
32
32
|
- Gemfile
|
33
33
|
- README.md
|
34
34
|
- capistrano-unicorn.gemspec
|
35
|
+
- examples/rails3.rb
|
35
36
|
- lib/capistrano-unicorn.rb
|
36
37
|
- lib/capistrano-unicorn/capistrano_integration.rb
|
37
38
|
- lib/capistrano-unicorn/version.rb
|
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
56
|
version: '0'
|
56
57
|
requirements: []
|
57
58
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.8.
|
59
|
+
rubygems_version: 1.8.10
|
59
60
|
signing_key:
|
60
61
|
specification_version: 3
|
61
62
|
summary: Unicorn integration for Capistrano
|