dlss-capistrano 3.9.0 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -0
- data/dlss-capistrano.gemspec +1 -1
- data/lib/dlss/capistrano/resque_pool.rb +1 -0
- data/lib/dlss/capistrano/resque_pool/tasks/resque_pool.rake +60 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e70dce4334fb19dd733691feeb6767a15ad60ec0b23cdd798db3b95eac0cbb3c
|
4
|
+
data.tar.gz: 2ec578117cf92d26845b752285b7f4f469978873584d8f2abfbc18dd66c49aaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aaf6ce12fd37b5586d8302116e2db5d94fb83076c8860ca203573ae93b414fc304892e45a4e5b2368bf68be260dc5c01b61d02319b63c7127c313cdb07821e6
|
7
|
+
data.tar.gz: c5f48c6365a083f290814c3063d3c65cd7ae49a48d3b303c4615758cd7df69dd7a6acc858ba6e47922f7a3caf8d81d046e2a6be7ecd09dfcff97b2eb97fa44a2
|
data/README.md
CHANGED
@@ -43,6 +43,21 @@ Set this in `config/deploy.rb` to automate the symlink creation, and then use `X
|
|
43
43
|
|
44
44
|
`cap ENV deployed_branch` displays the currently deployed revision (commit ID) and any branches containing the revision for each server in `ENV`.
|
45
45
|
|
46
|
+
### Resque-Pool hot swap (OPTIONAL)
|
47
|
+
|
48
|
+
The `dlss-capistrano` gem provides a set of tasks for managing `resque-pool` workers when deployed in `hot_swap` mode. (If you are using `resque-pool` without `hot_swap`, we recommend continuing to use the `capistrano-resque-pool` gem instead of what `dlss-capistrano` provides.) The tasks are:
|
49
|
+
|
50
|
+
```shell
|
51
|
+
$ cap ENV resque:pool:hot_swap # this gracefully replaces the current pool with a new pool
|
52
|
+
$ cap ENV resque:pool:stop # this gracefully stops the current pool
|
53
|
+
```
|
54
|
+
|
55
|
+
By default, these tasks are not provided; instead, they must be explicitly enabled via adding a new `require` statement to the application's `Capfile`:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
require 'dlss/capistrano/resque_pool'
|
59
|
+
```
|
60
|
+
|
46
61
|
### Sidekiq via systemd
|
47
62
|
|
48
63
|
`cap ENV sidekiq_systemd:{quiet,stop,start,restart}`: quiets, stops, starts, restarts Sidekiq via systemd.
|
data/dlss-capistrano.gemspec
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
import "#{__dir__}/resque_pool/tasks/resque_pool.rake"
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# These tasks are a drop-in replacement for capistrano-resque-pool when using
|
4
|
+
# hot-swappable pools. We replace these tasks because the upstream ones assume a
|
5
|
+
# pidfile is present, which is not the case with hot-swappable pools.
|
6
|
+
|
7
|
+
namespace :load do
|
8
|
+
task :defaults do
|
9
|
+
# Same capistrano variable used by capistrano-resque-pool for compatibility
|
10
|
+
set :resque_server_roles, fetch(:resque_server_roles, [:app])
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Integrate hook into Capistrano
|
15
|
+
namespace :deploy do
|
16
|
+
before :starting, :add_resque_pool_hotswap_hook do
|
17
|
+
invoke 'resque:pool:add_hook'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
namespace :resque do
|
22
|
+
namespace :pool do
|
23
|
+
# Lifted from capistrano-resque-pool
|
24
|
+
def rails_env
|
25
|
+
fetch(:resque_rails_env) ||
|
26
|
+
fetch(:rails_env) || # capistrano-rails doesn't automatically set this (yet),
|
27
|
+
fetch(:stage) # so we need to fall back to the stage.
|
28
|
+
end
|
29
|
+
|
30
|
+
# NOTE: no `desc` here to avoid publishing this task in the `cap -T` list
|
31
|
+
task :add_hook do
|
32
|
+
after 'deploy:restart', 'resque:pool:hot_swap'
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Swap in a new pool, then shut down the old pool'
|
36
|
+
task :hot_swap do
|
37
|
+
on roles(fetch(:resque_server_roles)) do
|
38
|
+
within current_path do
|
39
|
+
execute :bundle, :exec, 'resque-pool', "--daemon --hot-swap --environment #{rails_env}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
desc 'Gracefully shut down current pool'
|
45
|
+
task :stop do
|
46
|
+
on roles(fetch(:resque_server_roles)) do
|
47
|
+
# This will usually return a single pid, but if you do multiple quick
|
48
|
+
# deployments, you may pick up multiple pids here, in which case we only
|
49
|
+
# kill the oldest one
|
50
|
+
pid = capture(:pgrep, '-f resque-pool-master').split.first
|
51
|
+
|
52
|
+
if test "kill -0 #{pid} > /dev/null 2>&1"
|
53
|
+
execute :kill, "-s QUIT #{pid}"
|
54
|
+
else
|
55
|
+
warn "Process #{pid} is not running"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dlss-capistrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -85,6 +85,8 @@ files:
|
|
85
85
|
- dlss-capistrano.gemspec
|
86
86
|
- lib/dlss.rb
|
87
87
|
- lib/dlss/capistrano.rb
|
88
|
+
- lib/dlss/capistrano/resque_pool.rb
|
89
|
+
- lib/dlss/capistrano/resque_pool/tasks/resque_pool.rake
|
88
90
|
- lib/dlss/capistrano/tasks/bundle_config.rake
|
89
91
|
- lib/dlss/capistrano/tasks/bundled_sidekiq.rake
|
90
92
|
- lib/dlss/capistrano/tasks/deployed_branch.rake
|
@@ -111,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
113
|
- !ruby/object:Gem::Version
|
112
114
|
version: 1.3.6
|
113
115
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
116
|
+
rubygems_version: 3.1.2
|
115
117
|
signing_key:
|
116
118
|
specification_version: 4
|
117
119
|
summary: Capistrano recipes for use in SUL/DLSS projects
|