capistrano-opscomplete 1.0.2 → 1.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39158f12f3935cff8bc3d2c39b6d252c7ac594de47bad9c35fa83463d8dbec03
4
- data.tar.gz: aefdd1684fa67a31f19a1e9520edc82139ded5f5569b324cafaa5afa9c8a1e9e
3
+ metadata.gz: a20eef8ec0a80982b18b4ce9f01d0b1596b56ae46f49ef1c8fcaf90d0172e7f0
4
+ data.tar.gz: b01fc372be74a269ff2d31e8e5f004624b45f1e42b247a8b1435c7c2ab17ec18
5
5
  SHA512:
6
- metadata.gz: 9639dc1c7d2a77fee4088ac466e428c5e60691ae82e802a7c32dc990008d6b7ef568daac73e0bfec16e489bc2038e91431f0bdd1600919ec3d30e57e8b6d354d
7
- data.tar.gz: df97a9b57171097b35ce78222d0d073ecfcab37c42f3d362c52e96d5ae68cae23a610b33cfc80017828723ab479567881f0dd23c8183424211681387432a9f6f
6
+ metadata.gz: 23d4853424d027318d5054fde4e024a849b2575b75a07ee754177a7eb43a14262bee6bcb8cb956236bccf9ea7d625d4bb42b23ec20b895499346f8c2b50b8bb7
7
+ data.tar.gz: 07ef3b9da3ec41136d4a2698e649b3413ebe035d294cb59546411a0111f571a45b9c2b64b8e542c299b7db1c033a47d1681dfcee9326db89b70389d773aa7e8b
@@ -0,0 +1,28 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [master, workflow]
6
+ pull_request:
7
+ branches: [master]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-20.04
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ ruby-version: ['2.6.6', '3.1.2']
16
+ # steps:
17
+ # - name: Rubocop checks
18
+ # uses: gimenete/rubocop-action@1.0
19
+
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby-version }}
26
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
27
+ - name: Run tests
28
+ run: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [1.3.0] - 2025-02-18
2
+ ### Added
3
+ - Add new capistrano task (`opscomplete:supervisor:disable`) which disables supervisor on non-procfile servers
4
+
5
+ ## [1.2.0] - 2024-08-23
6
+ ### Changed
7
+ - Added a feature to restart Puma
8
+
9
+ ## [1.1.0] - 2024-08-23
10
+ ### Changed
11
+ - Added a feature to reload the puma systemd user service.
12
+
1
13
  ## [1.0.2] - 2022-07-29
2
14
  ### Changed
3
15
  - Improve error message for missing Node.js version
data/Gemfile.lock CHANGED
@@ -1,35 +1,38 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- capistrano-opscomplete (1.0.2)
4
+ capistrano-opscomplete (1.3.1)
5
5
  capistrano (>= 3.0, < 4.0.0)
6
6
  rake
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- airbrussh (1.4.1)
11
+ airbrussh (1.5.2)
12
12
  sshkit (>= 1.6.1, != 1.7.0)
13
13
  ast (2.4.2)
14
- capistrano (3.17.0)
14
+ base64 (0.2.0)
15
+ capistrano (3.19.1)
15
16
  airbrussh (>= 1.0.0)
16
17
  i18n
17
18
  rake (>= 10.0.0)
18
19
  sshkit (>= 1.9.0)
19
- concurrent-ruby (1.1.10)
20
- i18n (1.12.0)
20
+ concurrent-ruby (1.3.4)
21
+ i18n (1.14.5)
21
22
  concurrent-ruby (~> 1.0)
22
23
  jaro_winkler (1.5.4)
23
24
  makandra-rubocop (4.4.0)
24
25
  rubocop (~> 0.76.0)
25
26
  rubocop-rails (~> 2.3.2)
26
- net-scp (1.2.1)
27
- net-ssh (>= 2.6.5)
28
- net-ssh (7.0.1)
27
+ net-scp (4.0.0)
28
+ net-ssh (>= 2.6.5, < 8.0.0)
29
+ net-sftp (4.0.0)
30
+ net-ssh (>= 5.0.0, < 8.0.0)
31
+ net-ssh (7.2.3)
29
32
  parallel (1.20.1)
30
33
  parser (3.0.1.1)
31
34
  ast (~> 2.4.1)
32
- rack (2.2.3)
35
+ rack (3.0.12)
33
36
  rainbow (3.0.0)
34
37
  rake (13.0.6)
35
38
  rubocop (0.76.0)
@@ -43,8 +46,10 @@ GEM
43
46
  rack (>= 1.1)
44
47
  rubocop (>= 0.72.0)
45
48
  ruby-progressbar (1.11.0)
46
- sshkit (1.21.2)
49
+ sshkit (1.23.0)
50
+ base64
47
51
  net-scp (>= 1.1.2)
52
+ net-sftp (>= 2.1.2)
48
53
  net-ssh (>= 2.8.0)
49
54
  unicode-display_width (1.6.1)
50
55
 
@@ -55,6 +60,7 @@ DEPENDENCIES
55
60
  bundler (~> 2)
56
61
  capistrano-opscomplete!
57
62
  makandra-rubocop (~> 4)
63
+ rake (~> 13)
58
64
 
59
65
  BUNDLED WITH
60
- 2.3.10
66
+ 2.4.22
data/README.md CHANGED
@@ -7,7 +7,7 @@ This gem provides capistrano tasks for convenient deployment to a makandra [OpsC
7
7
  Include the gem in your applications Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'capistrano-opscomplete'
10
+ gem 'capistrano-opscomplete', require: false
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -52,8 +52,11 @@ And in case you enabled [`Procfile support`](https://makandracards.com/opscomple
52
52
  e.g. like this:
53
53
 
54
54
  ```ruby
55
- # Update and Restart supervisor config
55
+ # Update supervisor config
56
56
  after 'deploy:updating', 'opscomplete:supervisor:gen_config'
57
+ # Stop processes and remove config on non :procfile_role servers
58
+ after 'deploy:published', 'opscomplete:supervisor:disable'
59
+ # Restart supervisor processes
57
60
  after 'deploy:published', 'opscomplete:supervisor:restart_procs'
58
61
  ```
59
62
 
@@ -159,7 +162,7 @@ after 'deploy:updating', 'opscomplete:ruby:ensure'
159
162
 
160
163
  ## Managing your nodejs version with `capistrano-opscomplete`
161
164
 
162
- You can manage NodeJS also with `capistrano-opscomplete`. It will check the `.nvmrc`, `.node-version` and `.tool-versions` in the release direcotry (in this order) or you can configure it with `:opscomplete_nodejs_version` in your capistrano configuration.
165
+ You can manage NodeJS also with `capistrano-opscomplete`. It will check the `.nvmrc`, `.node-version` and `.tool-versions` in the release directory (in this order) or you can configure it with `:opscomplete_nodejs_version` in your capistrano configuration.
163
166
 
164
167
  Include the gem in your applications Gemfile:
165
168
 
@@ -173,8 +176,12 @@ An example configuration could look like this:
173
176
  ```ruby
174
177
  # After unpacking your release, before bundling, compiling assets, ...
175
178
  after 'deploy:updating', 'opscomplete:nodejs:ensure'
179
+ # reload puma
180
+ after 'deploy:published', 'opscomplete:puma:reload'
176
181
  ```
177
182
 
183
+ The version for the NodeJS installation has to be a specific version and not a floating version like, e.g. lts/gallium.
184
+
178
185
  ## Contributing
179
186
 
180
187
  Bug reports and pull requests are welcome. Don't hesitate to [open a new issue](https://github.com/makandra/capistrano-opscomplete/issues/new).
data/Rakefile CHANGED
@@ -1,2 +1,10 @@
1
+ require 'rubocop/rake_task'
1
2
  require 'bundler/gem_tasks'
2
- task default: :spec
3
+
4
+ RuboCop::RakeTask.new(:rubocop) do |task|
5
+ # task.requires << 'rubocop-rake'
6
+ task.patterns = ['lib/**/*.rb']
7
+ # task.formatters = ['files']
8
+ end
9
+
10
+ task default: [:rubocop]
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.required_rubygems_version = '>=2.0.1'
38
38
 
39
+ spec.add_development_dependency 'rake', '~> 13'
39
40
  spec.add_development_dependency 'makandra-rubocop', '~> 4'
40
41
  spec.add_development_dependency 'bundler', '~> 2'
41
42
 
@@ -89,32 +89,48 @@ module Capistrano
89
89
  # 1) Get version from capistrano configuration (highest precedence, 'override')
90
90
  if fetch(:opscomplete_nodejs_version)
91
91
  debug("Using version from :opscomplete_nodejs_version setting: #{fetch(:opscomplete_nodejs_version)}.")
92
- fetch(:opscomplete_nodejs_version)
92
+ app_version = fetch(:opscomplete_nodejs_version)
93
93
 
94
94
  # 2) Get version from version file in release dir (after deploy:updating, before deploy:updated)
95
95
  elsif capture(:nodejs_get_version, release_path)
96
96
  debug("Using version from server's release_dir/.nvmrc, .node-version or .tool-versions file: #{capture(:nodejs_get_version, release_path)}")
97
- capture(:nodejs_get_version, release_path)
97
+ app_version = capture(:nodejs_get_version, release_path)
98
98
 
99
99
  else
100
100
  raise Capistrano::ValidationError, 'Could not find application\'s Node.js version. Consider setting opscomplete_ruby_version.'
101
101
  end
102
+
103
+ normalize_nodejs_version(app_version)
102
104
  end
103
105
 
104
106
  def nodejs_installable_versions
105
107
  nodejs_installable_versions = capture(:nodejs_installable_versions).split("\n")
106
- nodejs_installable_versions.map!(&:strip)
107
- nodejs_installable_versions
108
+ nodejs_installable_versions.map { |version| normalize_nodejs_version(version) }
108
109
  end
109
110
 
110
111
  def nodejs_installed_versions
111
112
  nodejs_installed_versions = capture(:nodejs_installed_versions).split("\n")
112
- nodejs_installed_versions.map!(&:strip)
113
+ nodejs_installed_versions.map { |version| normalize_nodejs_version(version) }
113
114
  end
114
115
 
115
116
  def validation_error!(message)
116
117
  raise Capistrano::ValidationError, message unless dry_run?
117
118
  end
119
+
120
+ private
121
+
122
+ def normalize_nodejs_version(version)
123
+ version = version.strip
124
+ # Make sure the versions returned by our Node version manager have the same format
125
+ # as the one in our .nvmrc or .tools-versions:
126
+ #
127
+ # - In .nvmrc, we often document node versions as "1.2.3". But some people use "v1.2.3".
128
+ # - When asking NVM for Node versions, it gives us "v1.2.3".
129
+ # - When asking asdf for Node versions, it gives us "1.2.3" (without the leading "v").
130
+ version = version.sub(/\A[vV]/, '') # remove leading "v" or "V"
131
+ version
132
+ end
133
+
118
134
  end
119
135
  end
120
136
  end
@@ -0,0 +1,20 @@
1
+ # vim: filetype=ruby
2
+ namespace :opscomplete do
3
+ namespace :puma do
4
+
5
+ desc 'Reload puma'
6
+ task :reload do
7
+ on roles fetch(:puma_roles, :all) do # by default only the puma role, but if not available on all systems
8
+ execute :puma_reload
9
+ end
10
+ end
11
+
12
+ desc 'Restart puma'
13
+ task :restart do
14
+ on roles fetch(:puma_roles, :all) do # by default only the puma role, but if not available on all systems
15
+ execute :puma_restart
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -10,6 +10,15 @@ namespace :opscomplete do
10
10
  end
11
11
  end
12
12
 
13
+ desc 'Remove supervisor configuration and stop all Procfile processes on non :procfile_role servers.'
14
+ task :disable do
15
+ on roles(:all) - roles(fetch(:procfile_role, :app)) do
16
+ within release_path do
17
+ execute :supervisor_disable
18
+ end
19
+ end
20
+ end
21
+
13
22
  desc 'Reread the supervisor configuration and (re)start all Procfile processes'
14
23
  task :restart_procs do
15
24
  on roles fetch(:procfile_role, :app) do
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Opscomplete
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.3.1'.freeze
4
4
  end
5
5
  end
@@ -6,4 +6,5 @@ require 'rake'
6
6
  load File.expand_path('opscomplete/ruby.rake', __dir__)
7
7
  load File.expand_path('opscomplete/nodejs.rake', __dir__)
8
8
  load File.expand_path('opscomplete/supervisor.rake', __dir__)
9
+ load File.expand_path('opscomplete/puma.rake', __dir__)
9
10
  load File.expand_path('opscomplete/hooks.rb', __dir__)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-opscomplete
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Makandra Operations
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2025-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: makandra-rubocop
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -79,6 +93,7 @@ executables: []
79
93
  extensions: []
80
94
  extra_rdoc_files: []
81
95
  files:
96
+ - ".github/workflows/tests.yml"
82
97
  - ".ruby-version"
83
98
  - CHANGELOG.md
84
99
  - Gemfile
@@ -95,6 +110,7 @@ files:
95
110
  - lib/capistrano/opscomplete.rb
96
111
  - lib/capistrano/opscomplete/hooks.rb
97
112
  - lib/capistrano/opscomplete/nodejs.rake
113
+ - lib/capistrano/opscomplete/puma.rake
98
114
  - lib/capistrano/opscomplete/ruby.rake
99
115
  - lib/capistrano/opscomplete/supervisor.rake
100
116
  - lib/capistrano/opscomplete/version.rb
@@ -121,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
137
  - !ruby/object:Gem::Version
122
138
  version: 2.0.1
123
139
  requirements: []
124
- rubygems_version: 3.0.3
140
+ rubygems_version: 3.2.3
125
141
  signing_key:
126
142
  specification_version: 4
127
143
  summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.