dlss-capistrano 3.10.1 → 4.0.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 931006fc1c1c2b1bd0edad5c66284a68646ded0b1eb86977a9f456f5967d0aa1
|
4
|
+
data.tar.gz: 7d9be758e297514f2783c09ead222dd3a5ff56cdb7832a98c2582c4774583660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8455409ed588234cb13623dd80231a6dfb8976f1d17a2de2c46086f7327d5616920fd4b3724d7d928dc4bdf0dbe0ffc3ec88668177c94c85f886ee047dc69a16
|
7
|
+
data.tar.gz: 1a7e14b5f5e83dba8b59f85f22074e76b4298a8e43756dc4b6fe57e9de9639c89d60c7f9a4bf15a6ae17043bf6690640b1d4be3d9bea87754433b284276dce33
|
data/README.md
CHANGED
@@ -6,20 +6,21 @@ This gem provides Capistrano deployment tasks used by Stanford Libraries' Digita
|
|
6
6
|
|
7
7
|
## Included Tasks
|
8
8
|
|
9
|
-
###
|
9
|
+
### Remote Execution
|
10
10
|
|
11
|
-
|
11
|
+
Sometimes you want to execute a command on all boxes in a given environment, and dlss-capistrano's got your back:
|
12
12
|
|
13
|
-
```
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
```shell
|
14
|
+
$ cap qa remote_execute["ps -ef | grep rolling | grep -v grep"]
|
15
|
+
00:00 remote_execute
|
16
|
+
ps -ef | grep rolling | grep -v grep
|
17
|
+
ps -ef | grep rolling | grep -v grep
|
18
|
+
dor-indexing-app-qa-a.stanford.edu:
|
19
|
+
dor_ind+ 9159 1 20 Feb18 ? 14:15:03 rolling index
|
20
|
+
dor-indexing-app-qa-b.stanford.edu:
|
21
|
+
dor_ind+ 29689 1 20 Feb18 ? 14:24:53 rolling index
|
19
22
|
```
|
20
23
|
|
21
|
-
Note that only `bundler2_config_use_hook` **must** be set in order to use this functionality.
|
22
|
-
|
23
24
|
### Sidekiq symlink
|
24
25
|
|
25
26
|
Every time the version of Sidekiq or Ruby changes, a corresponding Puppet PR must be made in order to update the XSendFilePath that allows Apache to access the bundled Sidekiq gem's assets. dlss-capistrano provides a hook to create a symlink to the bundled Sidekiq to avoid having to do this:
|
@@ -70,6 +71,11 @@ after 'deploy:publishing', 'resque:pool:hot_swap'
|
|
70
71
|
|
71
72
|
These tasks are intended to replace those provided by `capistrano-sidekiq` gem, which has assumptions about systemd that do not apply to our deployed environments.
|
72
73
|
|
74
|
+
### Sneakers via systemd
|
75
|
+
|
76
|
+
`cap ENV sneakers_systemd:{stop,start,restart}`: stops, starts, restarts Sneakers via systemd.
|
77
|
+
|
78
|
+
|
73
79
|
#### Capistrano role
|
74
80
|
|
75
81
|
The sidekiq_systemd tasks assume a Capistrano role of `:app`. If your application uses a different Capistrano role for hosts that run Sidekiq workers, you can configure this in `config/deploy.rb`, *e.g.*:
|
@@ -105,7 +111,6 @@ dlss-capistrano makes the following assumptions about your Ruby project
|
|
105
111
|
- You do not have an .rvmrc checked into git (should be in your .gitignore)
|
106
112
|
- You will not use rvm gemsets on the server you deploy to
|
107
113
|
- Bundler will install specified gems into {your_project_home}/shared/bundle directory
|
108
|
-
- Will deploy from the master branch, unless you set :branch to another branch or tag
|
109
114
|
|
110
115
|
## Copyright
|
111
116
|
|
data/dlss-capistrano.gemspec
CHANGED
@@ -0,0 +1,9 @@
|
|
1
|
+
desc "execute command on all servers"
|
2
|
+
task :remote_execute, :command do |_task, args|
|
3
|
+
raise ArgumentError, 'remote_execute task requires an argument' unless args[:command]
|
4
|
+
|
5
|
+
on roles(:all) do |host|
|
6
|
+
info args[:command] if fetch(:log_level) == :debug
|
7
|
+
info "#{host}:\n#{capture(args[:command])}"
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Capistrano plugin hook to set default values
|
2
|
+
namespace :load do
|
3
|
+
task :defaults do
|
4
|
+
set :sneakers_systemd_role, fetch(:sneakers_systemd_role, :app)
|
5
|
+
set :sneakers_systemd_use_hooks, fetch(:sneakers_systemd_use_hooks, false)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# Integrate sneakers hooks into Capistrano
|
10
|
+
namespace :deploy do
|
11
|
+
before :starting, :add_sneakers_systemd_hooks do
|
12
|
+
invoke 'sneakers_systemd:add_hooks' if fetch(:sneakers_systemd_use_hooks)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
namespace :sneakers_systemd do
|
17
|
+
# NOTE: no `desc` here to avoid publishing this task in the `cap -T` list
|
18
|
+
task :add_hooks do
|
19
|
+
after 'deploy:failed', 'sneakers_systemd:restart'
|
20
|
+
after 'deploy:published', 'sneakers_systemd:start'
|
21
|
+
after 'deploy:starting', 'sneakers_systemd:stop'
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Stop running workers gracefully'
|
25
|
+
task :stop do
|
26
|
+
on roles fetch(:sneakers_systemd_role) do
|
27
|
+
sudo :systemctl, 'stop', 'sneakers'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Start workers'
|
32
|
+
task :start do
|
33
|
+
on roles fetch(:sneakers_systemd_role) do
|
34
|
+
sudo :systemctl, 'start', 'sneakers'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Restart workers'
|
39
|
+
task :restart do
|
40
|
+
on roles fetch(:sneakers_systemd_role) do
|
41
|
+
sudo :systemctl, 'restart', 'sneakers', raise_on_non_zero_exit: false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
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:
|
4
|
+
version: 4.0.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:
|
12
|
+
date: 2022-02-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: capistrano
|
@@ -87,10 +87,11 @@ files:
|
|
87
87
|
- lib/dlss/capistrano.rb
|
88
88
|
- lib/dlss/capistrano/resque_pool.rb
|
89
89
|
- lib/dlss/capistrano/resque_pool/tasks/resque_pool.rake
|
90
|
-
- lib/dlss/capistrano/tasks/bundle_config.rake
|
91
90
|
- lib/dlss/capistrano/tasks/bundled_sidekiq.rake
|
92
91
|
- lib/dlss/capistrano/tasks/deployed_branch.rake
|
92
|
+
- lib/dlss/capistrano/tasks/remote_execute.rake
|
93
93
|
- lib/dlss/capistrano/tasks/sidekiq_systemd.rake
|
94
|
+
- lib/dlss/capistrano/tasks/sneakers_systemd.rake
|
94
95
|
- lib/dlss/capistrano/tasks/ssh.rake
|
95
96
|
- lib/dlss/capistrano/tasks/ssh_check.rake
|
96
97
|
- lib/lyberteam-capistrano-devel.rb
|
@@ -113,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
114
|
- !ruby/object:Gem::Version
|
114
115
|
version: 1.3.6
|
115
116
|
requirements: []
|
116
|
-
rubygems_version: 3.1.
|
117
|
+
rubygems_version: 3.1.4
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Capistrano recipes for use in SUL/DLSS projects
|
@@ -1,53 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# These tasks exist because capistrano-bundler does not yet have a built-in
|
4
|
-
# mechanism for configuring bundler 2 without deprecation warnings. We can dump
|
5
|
-
# this if/when https://github.com/capistrano/bundler/issues/115 is resolved.
|
6
|
-
|
7
|
-
def default_bundle_path
|
8
|
-
Pathname.new("#{shared_path}/bundle")
|
9
|
-
end
|
10
|
-
|
11
|
-
namespace :load do
|
12
|
-
task :defaults do
|
13
|
-
# This provides opt-in behavior. Do nothing if not requested.
|
14
|
-
set :bundler2_config_use_hook, fetch(:bundler2_config_use_hook, false)
|
15
|
-
set :bundler2_config_roles, fetch(:bundler2_config_roles, [:app])
|
16
|
-
set :bundler2_config_deployment, fetch(:bundler2_config_deployment, true)
|
17
|
-
set :bundler2_config_without, fetch(:bundler2_config_without, 'development:test')
|
18
|
-
# NOTE: `shared_path` is not defined at this point, so we can't set the default value to `default_bundle_path`
|
19
|
-
set :bundler2_config_path, fetch(:bundler2_config_path, nil)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
# Integrate bundle config hook into Capistrano
|
24
|
-
namespace :deploy do
|
25
|
-
before :starting, :add_bundler2_config_hook do
|
26
|
-
invoke 'bundler2:add_hook' if fetch(:bundler2_config_use_hook)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
namespace :bundler2 do
|
31
|
-
# NOTE: no `desc` here to avoid publishing this task in the `cap -T` list
|
32
|
-
task :add_hook do
|
33
|
-
# Override capistrano-bundler settings
|
34
|
-
# HT: https://github.com/capistrano/bundler/issues/115#issuecomment-616570236
|
35
|
-
set :bundle_flags, '--quiet' # this unsets --deployment, see details in config_bundler task details
|
36
|
-
set :bundle_path, nil
|
37
|
-
set :bundle_without, nil
|
38
|
-
|
39
|
-
before 'bundler:install', 'bundler2:config'
|
40
|
-
end
|
41
|
-
|
42
|
-
# NOTE: This task lacks a `desc` to avoid publishing it, since we do not
|
43
|
-
# foresee needing to run this task manually. It should run via hook.
|
44
|
-
#
|
45
|
-
# Configure bundler 2 without using deprecated arguments (overrides capistrano-bundler
|
46
|
-
task :config do
|
47
|
-
on roles fetch(:bundler2_config_roles) do
|
48
|
-
execute "bundle config --local deployment #{fetch(:bundler2_config_deployment)}"
|
49
|
-
execute "bundle config --local without '#{fetch(:bundler2_config_without)}'"
|
50
|
-
execute "bundle config --local path #{fetch(:bundler2_config_path) || default_bundle_path}"
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|