capistrano-shoryuken 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/capistrano/shoryuken/version.rb +1 -1
- data/lib/capistrano/tasks/capistrano2.rb +2 -3
- data/lib/capistrano/tasks/shoryuken.cap +131 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDZmODU5ZjljNGE4N2NkMWI2MjcyN2NhM2I1YjZlMTYzMTU3MTE5ZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjgwMTVjMmYzOWNkN2E5MzY5NDE1YmM5ODRiMDRiMTc2MzM1OTcwMg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWNhMTY0ZWRkZjU3MGNkYTQxY2ZhMjU2NzVmMWIzYTUyZDM1YTIzNmYzMGNk
|
10
|
+
NDJjYjcyODllM2I4NDU5N2JmMTBmMzczOWJhM2RmNWYzNzdmN2Q1MWIzOWZh
|
11
|
+
NWVkOWQ5NjI2NzdiMmMzOGEwZmIxMWViMDJiNmEzM2M4MTczYzY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjRjZDdlNTJhODcxOGE5OTE4ZGM3NmI4OTNmYmY5ZmFiODdjYTJiZWZmNGNl
|
14
|
+
MWRlYTg0NGY2YTgzN2I2NDJlMmE5YWRkNWYxYjlmMDlhYzNhMzU0NTdiZGQw
|
15
|
+
ODNiOGJkOTMzNjQxZWZhNmRjOGM4ODk3OTFlMzc5ZDZmNmE1YjQ=
|
@@ -5,9 +5,8 @@ Capistrano::Configuration.instance.load do
|
|
5
5
|
_cset(:shoryuken_pid) { File.join(shared_path, 'pids', 'shoryuken.pid') }
|
6
6
|
_cset(:shoryuken_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
|
7
7
|
_cset(:shoryuken_log) { File.join(shared_path, 'log', 'shoryuken.log') }
|
8
|
-
|
9
8
|
_cset(:shoryuken_config) { "#{current_path}/config/shoryuken.yml" }
|
10
|
-
_cset(:shoryuken_options) {
|
9
|
+
_cset(:shoryuken_options) { '--rails' }
|
11
10
|
_cset(:shoryuken_queues) { nil }
|
12
11
|
|
13
12
|
_cset(:shoryuken_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec shoryuken" }
|
@@ -39,7 +38,7 @@ Capistrano::Configuration.instance.load do
|
|
39
38
|
task :start, roles: lambda { fetch(:shoryuken_role) }, on_no_matching_servers: :continue do
|
40
39
|
pid_file = fetch(:shoryuken_pid)
|
41
40
|
|
42
|
-
args = ['--
|
41
|
+
args = ['--daemon']
|
43
42
|
args.push "--pidfile '#{pid_file}'"
|
44
43
|
logfile = fetch(:shoryuken_log) and args.push "--logfile '#{logfile}'"
|
45
44
|
config = fetch(:shoryuken_config) and args.push "--config '#{config}'"
|
@@ -0,0 +1,131 @@
|
|
1
|
+
namespace :load do
|
2
|
+
task :defaults do
|
3
|
+
set :shoryuken_default_hooks, -> { true }
|
4
|
+
|
5
|
+
set :shoryuken_pid, -> { File.join(shared_path, 'tmp', 'pids', 'shoryuken.pid') }
|
6
|
+
set :shoryuken_env, -> { fetch(:rack_env, fetch(:rails_env, fetch(:stage))) }
|
7
|
+
set :shoryuken_log, -> { File.join(shared_path, 'log', 'shoryuken.log') }
|
8
|
+
set :shoryuken_config, -> { File.join(release_path, 'config', 'shoryuken.yml') }
|
9
|
+
set :shoryuken_options, -> { '--rails' }
|
10
|
+
|
11
|
+
set :shoryuken_role, -> { :app }
|
12
|
+
|
13
|
+
# Rbenv and RVM integration
|
14
|
+
set :rbenv_map_bins, fetch(:rbenv_map_bins).to_a.concat(%w(shoryuken))
|
15
|
+
set :rvm_map_bins, fetch(:rvm_map_bins).to_a.concat(%w(shoryuken))
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
namespace :deploy do
|
20
|
+
before :starting, :check_shoryuken_hooks do
|
21
|
+
invoke 'shoryuken:add_default_hooks' if fetch(:shoryuken_default_hooks)
|
22
|
+
end
|
23
|
+
after :publishing, :restart_shoryuken do
|
24
|
+
invoke 'shoryuken:restart' if fetch(:shoryuken_default_hooks)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
namespace :shoryuken do
|
29
|
+
|
30
|
+
def pid_file_signal(pid_file, signal=nil, options={})
|
31
|
+
args = ['kill', "-#{signal}", '$(', 'cat', pid_file, ')']
|
32
|
+
args.delete_at(1) if args[1]=='-'
|
33
|
+
if options[:quiet]
|
34
|
+
args << '>/dev/null' << '2>&1'
|
35
|
+
test(*args)
|
36
|
+
else
|
37
|
+
execute(*args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def pid_file_exists?(pid_file)
|
42
|
+
test('[', '-f', pid_file, ']')
|
43
|
+
end
|
44
|
+
|
45
|
+
def pid_process_exists?(pid_file)
|
46
|
+
pid_file_exists?(pid_file) and pid_file_signal(pid_file, '0', quiet: true)
|
47
|
+
end
|
48
|
+
|
49
|
+
task :add_default_hooks do
|
50
|
+
after 'deploy:updated', 'shoryuken:stop'
|
51
|
+
after 'deploy:reverted', 'shoryuken:stop'
|
52
|
+
after 'deploy:published', 'shoryuken:start'
|
53
|
+
end
|
54
|
+
|
55
|
+
desc 'Stop the shoryuken process, gracefully'
|
56
|
+
task :stop do
|
57
|
+
on roles fetch(:shoryuken_role) do
|
58
|
+
within release_path do
|
59
|
+
pid_file = fetch(:shoryuken_pid)
|
60
|
+
if pid_file_exists?(pid_file)
|
61
|
+
pid_file_signal pid_file, 'USR1', quiet: true
|
62
|
+
|
63
|
+
print 'Waiting for shoryuken to shutdown...'
|
64
|
+
sleep 1 while pid_process_exists?(pid_file)
|
65
|
+
execute :rm, '-f', pid_file
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
desc 'Shutdown the shoryuken process, immediately'
|
72
|
+
task :shutdown do
|
73
|
+
on roles fetch(:shoryuken_role) do
|
74
|
+
within release_path do
|
75
|
+
pid_file = fetch(:shoryuken_pid)
|
76
|
+
pid_file_signal pid_file if pid_file_exists?(pid_file)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
desc 'Start the shoryuken process'
|
82
|
+
task :start do
|
83
|
+
on roles fetch(:shoryuken_role) do
|
84
|
+
within release_path do
|
85
|
+
pid_file = fetch(:shoryuken_pid)
|
86
|
+
unless pid_process_exists?(pid_file)
|
87
|
+
args = ['--daemon']
|
88
|
+
args.push "--pidfile '#{pid_file}'"
|
89
|
+
logfile = fetch(:shoryuken_log) and args.push "--logfile '#{logfile}'"
|
90
|
+
config = fetch(:shoryuken_config) and args.push "--config '#{config}'"
|
91
|
+
queues = Array(fetch(:shoryuken_queues)) and queues.each{|queue| args.push "--queue #{queue}" }
|
92
|
+
options = fetch(:shoryuken_options) and args.push Array(options).join(' ')
|
93
|
+
|
94
|
+
with rails_env: fetch(:shoryuken_env) do
|
95
|
+
execute :bundle, :exec, :shoryuken, args.compact.join(' ')
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
desc 'Restart shoryuken'
|
103
|
+
task :restart do
|
104
|
+
invoke 'shoryuken:stop'
|
105
|
+
invoke 'shoryuken:start'
|
106
|
+
end
|
107
|
+
|
108
|
+
desc 'Make the shoryuken process log detailed status information'
|
109
|
+
task :log_status do
|
110
|
+
on roles fetch(:shoryuken_role) do
|
111
|
+
pid_file = fetch(:shoryuken_pid)
|
112
|
+
pid_file_signal pid_file, 'TTIN' if pid_file_exists?(pid_file)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
desc 'Tail the shoryuken log forever'
|
117
|
+
task :tail_log do
|
118
|
+
on roles fetch(:shoryuken_role) do
|
119
|
+
log_file = fetch(:shoryuken_log)
|
120
|
+
execute :tail, '-f', log_file if test('[', '-f', log_file, ']')
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
desc 'Tail ENV[number] lines of the shoryuken log'
|
125
|
+
task :tail_log_lines do
|
126
|
+
on roles fetch(:shoryuken_role) do
|
127
|
+
log_file = fetch(:shoryuken_log)
|
128
|
+
execute :tail, '-n', ENV.fetch('number',20).to_s, log_file if test('[', '-f', log_file, ']')
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-shoryuken
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe Khoobyar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|