dlss-capistrano 5.1.1 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f69b0b30f58f3313e59a5fc7cf0d510d5c95d99fe5e077a772588e6ffdccbbd9
4
- data.tar.gz: e0020c24765ddd757ee839371f962325900b147aa69a399c7ad97eb60b7babb8
3
+ metadata.gz: c20ce3abcea6996c7366473874dbd9b7106749c5e7b365d21e301195ead06830
4
+ data.tar.gz: 75a94eb0b169763cd62e7dd92bcb8b183d7621e5ea271613c06b7b4814835c7d
5
5
  SHA512:
6
- metadata.gz: 9e14e482febdd209f99802e0b4b0ac6323825da0312c6e50c21e97a51746fe651c8825691a9b0d86576b5239c7ba8328113c9df18565cc82a542d5cb158e0ba4
7
- data.tar.gz: ddbc21daf2f1e259764d1257a741a9fb8208e8731e693c40daf9d15c49dfb6747615ce1161ce98f34e7757ae7eacd7cce5c09c3ccfde4c9c81b8cb654f5ad837
6
+ metadata.gz: c18fc1a359d2bffa0f474b4e3eaa4d00010e01bddf6eb37dde993512c1f3076ed861b5ff79d955afa8a406d125c95feb5a9b91561a02d81561484c0e802a03b9
7
+ data.tar.gz: c03fd209a7440b754cad93ed9b671cd3554d86804c358bc7aa0b65fb2c46a99d6b518b3baab57719da1784fe42c85d03b55d5602f56a8810fbf13cb2e56a0f9b
data/README.md CHANGED
@@ -8,11 +8,9 @@ This gem provides Capistrano deployment tasks used by Stanford Libraries' Digita
8
8
 
9
9
  To start, we recommend an SSH configuration like the one described in the [DeveloperPlaybook](https://github.com/sul-dlss/DeveloperPlaybook/blob/main/best-practices/ssh_configuration.md), since it has sensible defaults for Kerberos authentication and multi-factor authentication (using `ProxyJump` and `ControlMaster`, etc.).
10
10
 
11
- To use controlmaster, you need to opt-in by setting the environment variable `USE_CAPISTRANO_CONTROLMASTER=true` (in e.g. your `~/.zshenv` file or similar for your particular shell).
11
+ To get `dlss-capistrano` tasks running via an existing SSH control master socket, you need to opt-in by setting the environment variable `USE_CAPISTRANO_CONTROLMASTER=true` (in e.g. your `~/.zshenv` file or similar for your particular shell).
12
12
 
13
- If you use values other than the defaults for `CONTROLMASTER_HOST` (`dlss-jump`) or `CONTROLMASTER_SOCKET` (`"~/.ssh/%r@%h:%p"`), you'll want to set these environment variables locally to the values you use (in e.g. your `~/.zshenv` file or similar for your particular shell). Otherwise, the gem will fail to connect to the appropriate host and/or won't be able to properly check the status of the control master process.
14
-
15
- The control master host is the value of the `ProxyJump` directive in your SSH config, and the control master socket is the value of the `ControlPath` directive in your SSH config.
13
+ If your SSH client configuration (`~/.ssh/config`) uses values other than the defaults for `CONTROLMASTER_HOST` (which maps to the `ProxyJump` directive, and defaults to `dlss-jump`) or `CONTROLMASTER_SOCKET` (which maps to the `ControlPath` directive, and defaults to `~/.ssh/%r@%h:%p`), you'll want to set these environment variables locally to the values you use (in e.g. your `~/.zshenv` file or similar for your particular shell). Otherwise, the gem will fail to connect to the appropriate jump host and/or won't be able to properly check the status of the control master process.
16
14
 
17
15
  ## Included Tasks
18
16
 
@@ -83,6 +81,10 @@ These tasks are intended to replace those provided by `capistrano-sidekiq` gem,
83
81
 
84
82
  `cap ENV sneakers_systemd:{stop,start,restart}`: stops, starts, restarts Sneakers via systemd.
85
83
 
84
+ ### SolidQueue via systemd
85
+
86
+ `cap ENV solid_queue_systemd:{stop,start,restart}`: stops, starts, restarts SolidQueue via systemd.
87
+
86
88
  ### Racecar via systemd
87
89
 
88
90
  `cap ENV racecar_systemd:{stop,start,restart}`: stops, starts, restarts Racecar via systemd.
@@ -4,7 +4,7 @@ $:.unshift lib unless $:.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "dlss-capistrano"
7
- s.version = '5.1.1'
7
+ s.version = '5.3.0'
8
8
 
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Chris Beer", 'Mike Giarlo']
@@ -10,13 +10,6 @@ namespace :load do
10
10
  end
11
11
  end
12
12
 
13
- # Integrate hook into Capistrano
14
- namespace :deploy do
15
- before :generate_otk, :setup_controlmaster do
16
- invoke 'controlmaster:setup'
17
- end
18
- end
19
-
20
13
  namespace :controlmaster do
21
14
  desc 'set up an SSH controlmaster process if missing'
22
15
  task :setup do
@@ -1,5 +1,5 @@
1
1
  desc 'display the deployed branch and commit'
2
- task deployed_branch: ['controlmaster:setup', 'otk:generate'] do
2
+ task :deployed_branch do
3
3
  # see https://github.com/mattbrictson/airbrussh/tree/v1.5.2?tab=readme-ov-file#capistrano-34x
4
4
  Airbrussh.configure do |config|
5
5
  config.truncate = false
@@ -10,7 +10,7 @@ namespace :load do
10
10
  end
11
11
 
12
12
  desc "execute command on all servers"
13
- task :remote_execute, [:command] => ['controlmaster:setup', 'otk:generate'] do |_task, args|
13
+ task :remote_execute, :command do |_task, args|
14
14
  raise ArgumentError, 'remote_execute task requires an argument' unless args[:command]
15
15
 
16
16
  # see https://github.com/mattbrictson/airbrussh/tree/v1.5.2?tab=readme-ov-file#capistrano-34x
@@ -0,0 +1,20 @@
1
+ # Setup controlmaster SSH session before generating one-time-key
2
+ before 'otk:generate', 'controlmaster:setup'
3
+
4
+ DOES_NOT_REQUIRE_OTK_LIST = [
5
+ 'bundler:map_bins',
6
+ 'controlmaster:setup',
7
+ 'controlmaster:start',
8
+ 'default',
9
+ 'deploy:generate_otk',
10
+ 'install',
11
+ 'load:defaults',
12
+ 'otk:generate',
13
+ *Rake.application.stages
14
+ ].freeze
15
+
16
+ Rake.application.tasks.each do |task|
17
+ next if DOES_NOT_REQUIRE_OTK_LIST.include?(task.name)
18
+
19
+ before task, 'deploy:generate_otk'
20
+ end
@@ -0,0 +1,44 @@
1
+ # Capistrano plugin hook to set default values
2
+ namespace :load do
3
+ task :defaults do
4
+ set :solid_queue_systemd_role, fetch(:solid_queue_systemd_role, :app)
5
+ set :solid_queue_systemd_use_hooks, fetch(:solid_queue_systemd_use_hooks, false)
6
+ end
7
+ end
8
+
9
+ # Integrate solid_queue hooks into Capistrano
10
+ namespace :deploy do
11
+ before :starting, :add_solid_queue_systemd_hooks do
12
+ invoke 'solid_queue_systemd:add_hooks' if fetch(:solid_queue_systemd_use_hooks)
13
+ end
14
+ end
15
+
16
+ namespace :solid_queue_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', 'solid_queue_systemd:restart'
20
+ after 'deploy:published', 'solid_queue_systemd:start'
21
+ after 'deploy:starting', 'solid_queue_systemd:stop'
22
+ end
23
+
24
+ desc 'Stop running workers gracefully'
25
+ task :stop do
26
+ on roles(fetch(:solid_queue_systemd_role)) do
27
+ sudo :systemctl, 'stop', 'solid_queue'
28
+ end
29
+ end
30
+
31
+ desc 'Start workers'
32
+ task :start do
33
+ on roles(fetch(:solid_queue_systemd_role)) do
34
+ sudo :systemctl, 'start', 'solid_queue'
35
+ end
36
+ end
37
+
38
+ desc 'Restart workers'
39
+ task :restart do
40
+ on roles(fetch(:solid_queue_systemd_role)) do
41
+ sudo :systemctl, 'restart', 'solid_queue', raise_on_non_zero_exit: false
42
+ end
43
+ end
44
+ end
@@ -1,5 +1,5 @@
1
1
  desc "check ssh connections to all app servers"
2
- task ssh_check: ['controlmaster:setup', 'otk:generate'] do
2
+ task :ssh_check do
3
3
  on roles(:app), in: :sequence do
4
4
  execute
5
5
  end
@@ -3,3 +3,4 @@ require 'capistrano/bundle_audit'
3
3
  require 'capistrano/shared_configs'
4
4
 
5
5
  Dir.glob("#{__dir__}/capistrano/tasks/*.rake").each { |r| import r }
6
+ Dir.glob("#{__dir__}/capistrano/tasks/setup/*.rake").each { |r| import r }
data/lib/dlss.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DLSS
2
2
  require 'dlss/capistrano'
3
- end
3
+ 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: 5.1.1
4
+ version: 5.3.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: 2024-06-18 00:00:00.000000000 Z
12
+ date: 2024-11-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
@@ -119,8 +119,10 @@ files:
119
119
  - lib/dlss/capistrano/tasks/deployed_branch.rake
120
120
  - lib/dlss/capistrano/tasks/racecar_systemd.rake
121
121
  - lib/dlss/capistrano/tasks/remote_execute.rake
122
+ - lib/dlss/capistrano/tasks/setup/setup.rake
122
123
  - lib/dlss/capistrano/tasks/sidekiq_systemd.rake
123
124
  - lib/dlss/capistrano/tasks/sneakers_systemd.rake
125
+ - lib/dlss/capistrano/tasks/solid_queue_systemd.rake
124
126
  - lib/dlss/capistrano/tasks/ssh.rake
125
127
  - lib/dlss/capistrano/tasks/ssh_check.rake
126
128
  - lib/dlss/capistrano/tasks/strscan.rake
@@ -144,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
146
  - !ruby/object:Gem::Version
145
147
  version: 1.3.6
146
148
  requirements: []
147
- rubygems_version: 3.5.11
149
+ rubygems_version: 3.5.16
148
150
  signing_key:
149
151
  specification_version: 4
150
152
  summary: Capistrano recipes for use in SUL/DLSS projects