capistrano-opscomplete 0.3.0 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +36 -0
- data/Gemfile.lock +60 -0
- data/README.md +42 -3
- data/capistrano-opscomplete.gemspec +10 -5
- data/lib/capistrano/dsl/opscomplete.rb +30 -8
- data/lib/capistrano/opscomplete.rb +5 -1
- data/lib/capistrano/opscomplete/{tasks.rake → ruby.rake} +18 -12
- data/lib/capistrano/opscomplete/supervisor.rake +59 -0
- data/lib/capistrano/opscomplete/version.rb +1 -1
- metadata +19 -15
- data/lib/capistrano/opscomplete/deploy.rake +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8aabbac9cbd5d4ce1c8b7201690802466c79f380b5d98535e9c8a3201773a5e8
|
4
|
+
data.tar.gz: bed5187c564efca3b4e50f8976cc1c097dda9e3015dd0bbf91d6e8a445cf5074
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 680364a17d2971034fdcd6e998060433fa23db9572fc9718f364b73d24620619bec3b6c3d004e73f9e0b4b7d335e5c244a84f1dc592057ec7ce2079d7e1ad9dd
|
7
|
+
data.tar.gz: 7ecf151b6799902e90850d95102fed634221e53efa2b39a882e61fc648690b784941868618f00de6619d6dd9c08bdd8e5e2949c2fee7294da0af56ca324bd2fd
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,36 @@
|
|
1
|
+
## [0.6.2] - 2020-07-23
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
- rbenv-build changed behaviour of `--list` ([#20](https://github.com/makandra/capistrano-opscomplete/issues/20))
|
5
|
+
|
6
|
+
### Changed
|
7
|
+
- Bumped rack dependency from 2.1.1 to 2.2.3
|
8
|
+
|
9
|
+
## [0.6.1] - 2020-04-16
|
10
|
+
### Added
|
11
|
+
- Use Ruby 2.6 for development
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
- Add rake as a runtime dependency
|
15
|
+
|
16
|
+
## [0.6.0] - 2020-01-13
|
17
|
+
### Added
|
18
|
+
|
19
|
+
- Support for Procfiles/supervisord. See [this makandra card](https://makandracards.com/opscomplete/67829-procfile-support) for more information.
|
20
|
+
|
21
|
+
## [0.5.0] - 2019-12-09
|
22
|
+
### Changed
|
23
|
+
- Install the bundler version that was used to create the `Gemfile.lock` (`BUNDLED WITH`) if it is present. Can be overwritten by `set :bundler_version`.
|
24
|
+
- Reword some info output
|
25
|
+
|
26
|
+
## [0.4.0] - 2019-09-23
|
27
|
+
### Added
|
28
|
+
- ruby-build now honors the :tmp_dir setting
|
29
|
+
|
30
|
+
### Changed
|
31
|
+
- Allow using --force when installing a gem e.g. overwrite binaries
|
32
|
+
- Quote some shell arguments
|
33
|
+
|
1
34
|
## [0.3.0] - 2019-04-05
|
2
35
|
### Added
|
3
36
|
- You can now specify the rubygems and bundler version to be installed. (#4)
|
@@ -26,5 +59,8 @@
|
|
26
59
|
### Added
|
27
60
|
- Initial release.
|
28
61
|
|
62
|
+
[0.6.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.5.0...v0.6.0
|
63
|
+
[0.5.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.4.0...v0.5.0
|
64
|
+
[0.4.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.3.0...v0.4.0
|
29
65
|
[0.3.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.2.0...v0.3.0
|
30
66
|
[0.2.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.1.0...v0.2.0
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-opscomplete (0.6.2)
|
5
|
+
capistrano (>= 3.0, < 4.0.0)
|
6
|
+
rake
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
airbrussh (1.4.0)
|
12
|
+
sshkit (>= 1.6.1, != 1.7.0)
|
13
|
+
ast (2.4.0)
|
14
|
+
capistrano (3.11.2)
|
15
|
+
airbrussh (>= 1.0.0)
|
16
|
+
i18n
|
17
|
+
rake (>= 10.0.0)
|
18
|
+
sshkit (>= 1.9.0)
|
19
|
+
concurrent-ruby (1.1.6)
|
20
|
+
i18n (1.8.4)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
jaro_winkler (1.5.4)
|
23
|
+
makandra-rubocop (4.2.0)
|
24
|
+
rubocop (~> 0.76.0)
|
25
|
+
rubocop-rails (~> 2.3.2)
|
26
|
+
net-scp (2.0.0)
|
27
|
+
net-ssh (>= 2.6.5, < 6.0.0)
|
28
|
+
net-ssh (5.2.0)
|
29
|
+
parallel (1.19.1)
|
30
|
+
parser (2.7.0.2)
|
31
|
+
ast (~> 2.4.0)
|
32
|
+
rack (2.2.3)
|
33
|
+
rainbow (3.0.0)
|
34
|
+
rake (13.0.1)
|
35
|
+
rubocop (0.76.0)
|
36
|
+
jaro_winkler (~> 1.5.1)
|
37
|
+
parallel (~> 1.10)
|
38
|
+
parser (>= 2.6)
|
39
|
+
rainbow (>= 2.2.2, < 4.0)
|
40
|
+
ruby-progressbar (~> 1.7)
|
41
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
42
|
+
rubocop-rails (2.3.2)
|
43
|
+
rack (>= 1.1)
|
44
|
+
rubocop (>= 0.72.0)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
sshkit (1.20.0)
|
47
|
+
net-scp (>= 1.1.2)
|
48
|
+
net-ssh (>= 2.8.0)
|
49
|
+
unicode-display_width (1.6.0)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
ruby
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
bundler (~> 2)
|
56
|
+
capistrano-opscomplete!
|
57
|
+
makandra-rubocop (~> 4)
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
2.1.4
|
data/README.md
CHANGED
@@ -28,13 +28,45 @@ Verify the gem was installed and tasks are available:
|
|
28
28
|
|
29
29
|
$ bundle exec cap -T opscomplete
|
30
30
|
|
31
|
-
Now, add some [hooks](#using-capistrano-hooks) in your capistrano configuration.
|
31
|
+
Now, add some [hooks](#using-capistrano-hooks) in your capistrano configuration (e.g. `deploy.rb`).
|
32
|
+
An example configuration could look like this:
|
32
33
|
|
33
34
|
```ruby
|
34
35
|
# After unpacking your release, before bundling, compiling assets, ...
|
35
36
|
after 'deploy:updating', 'opscomplete:ruby:ensure'
|
36
37
|
```
|
37
38
|
|
39
|
+
and in case you enabled [`Procfile support`](https://makandracards.com/opscomplete/67829-procfile-support) you can use the following tasks:
|
40
|
+
|
41
|
+
opscomplete:supervisor:gen_config
|
42
|
+
opscomplete:supervisor:restart_procs
|
43
|
+
opscomplete:supervisor:stop_procs
|
44
|
+
opscomplete:supervisor:signal_procs
|
45
|
+
|
46
|
+
e.g. like this:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# Update and Restart supervisor config
|
50
|
+
after 'deploy:updating', 'opscomplete:supervisor:gen_config'
|
51
|
+
after 'deploy:published', 'opscomplete:supervisor:restart_procs'
|
52
|
+
```
|
53
|
+
|
54
|
+
Using the default configuration, these tasks will run on all Servers where role is `:app` using the Procfile called `Procfile`.
|
55
|
+
To change the role where these tasks will get executed, set `:procfile_role` in e.g. your `config/deploy.rb` like:
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
# Use supervisor tasks only for sidekiq role
|
59
|
+
set :procfile_role, :sidekiq
|
60
|
+
```
|
61
|
+
|
62
|
+
If you want to run different Procfiles on different servers, you can set the `:procfile` property in your `config/deploy/${env}.rb`:
|
63
|
+
|
64
|
+
```
|
65
|
+
# In this example, `Procfile` will get used for supervisor on srv2.example.com and `Procfile.sidekiq` for supervisor on srv1.example.com.
|
66
|
+
server "srv1.example.com", user: "deploy-example_s", roles: %w{app web}, procfile: "Procfile.sidekiq"
|
67
|
+
server "srv2.example.com", user: "deploy-example_s", roles: %w{app web}
|
68
|
+
```
|
69
|
+
|
38
70
|
## Usage
|
39
71
|
|
40
72
|
If you encounter any errors, please make sure you have the newest version of the capistrano-opscomplete gem installed. Don't hesitate to contact the OpsComplete for Ruby team for further support.
|
@@ -75,7 +107,8 @@ More specifically this task will:
|
|
75
107
|
3) A file in the current working directory of your local checkout (e.g. `/home/user/code/myapp/.ruby-version`)
|
76
108
|
- If the desired version is not installed, it checks if it can be installed using `ruby-build` and installs it.
|
77
109
|
- Check if `rbenv global` version is set according to application's `.ruby-version` file. Change it if required.
|
78
|
-
- Install the `
|
110
|
+
- Install `bundler`. It is tried to determine the version that was used to create the `Gemfile.lock` (`BUNDLED WITH`) if it is present.
|
111
|
+
- Install `geordi` gem if required.
|
79
112
|
- Run `rbenv rehash` if required.
|
80
113
|
|
81
114
|
**Note:** If, for any reason, no `.ruby-version` file can be found in your release or current working directory, you may set the following option in `deploy.rb`:
|
@@ -92,12 +125,18 @@ set :rbenv_roles, :web
|
|
92
125
|
set :rbenv_roles, [:web, :worker]
|
93
126
|
```
|
94
127
|
|
95
|
-
**Optional:**
|
128
|
+
**Optional:** If you want a specific bundler version other than the one that is set in `Gemfile.lock` available for your release, set it in your `deploy.rb`:
|
96
129
|
|
97
130
|
```ruby
|
98
131
|
set :bundler_version, '<VERSION>'
|
99
132
|
```
|
100
133
|
|
134
|
+
e.g. if you need bundler version 2.x:
|
135
|
+
|
136
|
+
```ruby
|
137
|
+
set :bundler_version, '~>2'
|
138
|
+
```
|
139
|
+
|
101
140
|
**Optional:** By default, the rubygems version defined by the ruby-build manifest will be installed. If you want a specific rubygems version available for your release, set it in your `deploy.rb`:
|
102
141
|
|
103
142
|
```ruby
|
@@ -8,13 +8,18 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Makandra Operations']
|
9
9
|
spec.email = ['ops@makandra.de']
|
10
10
|
|
11
|
-
spec.summary =
|
11
|
+
spec.summary = 'Capistrano tasks for easy deployment to a makandra opscomplete environment.'
|
12
12
|
spec.homepage = 'https://opscomplete.com/ruby'
|
13
13
|
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
if spec.respond_to?(:metadata)
|
17
|
-
spec.metadata
|
17
|
+
spec.metadata = {
|
18
|
+
'allowed_push_host' => 'https://rubygems.org',
|
19
|
+
'bug_tracker_uri' => 'https://github.com/makandra/capistrano-opscomplete/issues',
|
20
|
+
'changelog_uri' => 'https://github.com/makandra/capistrano-opscomplete/blob/master/CHANGELOG.md',
|
21
|
+
'source_code_uri' => 'https://github.com/makandra/capistrano-opscomplete',
|
22
|
+
}
|
18
23
|
else
|
19
24
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
20
25
|
'public gem pushes.'
|
@@ -31,9 +36,9 @@ Gem::Specification.new do |spec|
|
|
31
36
|
|
32
37
|
spec.required_rubygems_version = '>=2.0.1'
|
33
38
|
|
34
|
-
spec.add_development_dependency 'makandra-rubocop', '~>
|
35
|
-
spec.add_development_dependency 'bundler', '~>
|
36
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
39
|
+
spec.add_development_dependency 'makandra-rubocop', '~> 4'
|
40
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
37
41
|
|
42
|
+
spec.add_dependency 'rake'
|
38
43
|
spec.add_dependency 'capistrano', '>=3.0', '<4.0.0'
|
39
44
|
end
|
@@ -24,17 +24,17 @@ module Capistrano
|
|
24
24
|
# 1) Get version from capistrano configuration (highest precedence, 'override')
|
25
25
|
if fetch(:opscomplete_ruby_version)
|
26
26
|
debug("Using version from :opscomplete_ruby_version setting: #{fetch(:opscomplete_ruby_version)}.")
|
27
|
-
|
27
|
+
fetch(:opscomplete_ruby_version)
|
28
28
|
|
29
29
|
# 2) Get version from .ruby-version in release dir (after deploy:updating, before deploy:updated)
|
30
30
|
elsif test("[ -f #{release_ruby_version_file_path} ]")
|
31
31
|
debug("Using version from server's release_dir/.ruby-version file: #{capture(:cat, release_ruby_version_file_path)}")
|
32
|
-
|
32
|
+
capture(:cat, release_ruby_version_file_path)
|
33
33
|
|
34
34
|
# 3) Get version from local checkout/cwd
|
35
35
|
elsif File.readable?('.ruby-version')
|
36
36
|
debug("Using version from local (cwd) .ruby-version file: #{File.read('.ruby-version').strip}")
|
37
|
-
|
37
|
+
File.read('.ruby-version').strip
|
38
38
|
|
39
39
|
# FAIL: We have no idea which version to use
|
40
40
|
else
|
@@ -42,8 +42,30 @@ module Capistrano
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
def app_gemfile_bundled_with_version
|
46
|
+
release_gemfile_lock_file_path = release_path.join('Gemfile.lock').to_s
|
47
|
+
|
48
|
+
if test("[ -f #{release_gemfile_lock_file_path} ]")
|
49
|
+
debug('found release_dir/Gemfile.lock')
|
50
|
+
|
51
|
+
grep_command = [:grep, '-A', '1', '"BUNDLED WITH"', release_gemfile_lock_file_path]
|
52
|
+
|
53
|
+
if test(*grep_command)
|
54
|
+
bundled_with_lines = capture(*grep_command)
|
55
|
+
version = bundled_with_lines.split.last
|
56
|
+
debug("Using version #{version.inspect} from server's release_dir/Gemfile.lock file.")
|
57
|
+
version
|
58
|
+
else
|
59
|
+
# old bundler versions did not write "BUNDLED WITH"
|
60
|
+
debug('Gemfile.lock was found but did not contain "BUNDLED WITH"-section')
|
61
|
+
end
|
62
|
+
else
|
63
|
+
debug('There was no Gemfile.lock to parse the bundler version')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
45
67
|
def rbenv_installable_rubies
|
46
|
-
rbenv_installable_rubies = capture(:rbenv, :install, '--list').split("\n")
|
68
|
+
rbenv_installable_rubies = capture(:rbenv, :install, '--list-all').split("\n")
|
47
69
|
rbenv_installable_rubies.map!(&:strip)
|
48
70
|
rbenv_installable_rubies.delete('Available version:')
|
49
71
|
rbenv_installable_rubies
|
@@ -69,22 +91,22 @@ module Capistrano
|
|
69
91
|
|
70
92
|
def gem_installed?(name, version = nil)
|
71
93
|
if version
|
72
|
-
test(:rbenv, :exec, "gem query --quiet --installed --version #{version} --name-matches ^#{name}$")
|
94
|
+
test(:rbenv, :exec, "gem query --quiet --installed --version '#{version}' --name-matches '^#{name}$'")
|
73
95
|
else
|
74
96
|
test(:rbenv, :exec, :gem, :query, "--quiet --installed --name-matches ^#{name}$")
|
75
97
|
end
|
76
98
|
end
|
77
99
|
|
78
|
-
def gem_install(name, version = nil)
|
100
|
+
def gem_install(name, version = nil, force = false)
|
79
101
|
if version
|
80
|
-
rbenv_exec('gem install', name, '--no-document', '--version', version)
|
102
|
+
rbenv_exec('gem install', name, '--no-document', '--version', "'#{version}'", force ? '--force' : '')
|
81
103
|
else
|
82
104
|
rbenv_exec('gem install', name, '--no-document')
|
83
105
|
end
|
84
106
|
end
|
85
107
|
|
86
108
|
def rubygems_install(version)
|
87
|
-
rbenv_exec(
|
109
|
+
rbenv_exec("gem update --no-document --system '#{version}'")
|
88
110
|
end
|
89
111
|
end
|
90
112
|
end
|
@@ -1,4 +1,8 @@
|
|
1
1
|
require 'capistrano/opscomplete/version'
|
2
2
|
|
3
|
-
|
3
|
+
# Need to require rake before we can use the Rake DSL (task do ..., namespace do, ...)
|
4
|
+
require 'rake'
|
5
|
+
|
6
|
+
load File.expand_path('opscomplete/ruby.rake', __dir__)
|
7
|
+
load File.expand_path('opscomplete/supervisor.rake', __dir__)
|
4
8
|
load File.expand_path('opscomplete/deploy.rake', __dir__)
|
@@ -16,15 +16,15 @@ namespace :opscomplete do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
desc 'Check if rbenv global
|
19
|
+
desc 'Check if rbenv global Ruby version is set according to application\'s .ruby-version.'
|
20
20
|
task :check do
|
21
21
|
on roles fetch(:rbenv_roles, :all) do |host|
|
22
|
-
warn("#{host}: Managed
|
22
|
+
warn("#{host}: Managed Ruby environment! Won't do any changes to ruby version.") if managed_ruby?
|
23
23
|
unless capture(:rbenv, :global) == app_ruby_version
|
24
24
|
raise Capistrano::ValidationError,
|
25
25
|
"#{host}: Ruby version is not set according to application\'s .ruby-version file. Use cap opscomplete:ruby:ensure."
|
26
26
|
end
|
27
|
-
info("#{host}:
|
27
|
+
info("#{host}: Ruby #{app_ruby_version} is installed.")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -52,8 +52,12 @@ namespace :opscomplete do
|
|
52
52
|
# desc 'Install bundler gem'
|
53
53
|
task :install_bundler do
|
54
54
|
on roles fetch(:rbenv_roles, :all) do
|
55
|
-
|
56
|
-
|
55
|
+
# manually specified version will take precedence
|
56
|
+
specific_bundler_version = fetch(:bundler_version, app_gemfile_bundled_with_version)
|
57
|
+
|
58
|
+
if specific_bundler_version
|
59
|
+
# We have to set force = true to overwrite the binary
|
60
|
+
gem_install('bundler', specific_bundler_version, true) unless gem_installed?('bundler', specific_bundler_version)
|
57
61
|
else
|
58
62
|
gem_install('bundler') unless gem_installed?('bundler')
|
59
63
|
end
|
@@ -77,7 +81,7 @@ namespace :opscomplete do
|
|
77
81
|
info("Ensuring requested RubyGems version #{fetch(:rubygems_version)}")
|
78
82
|
next if current_rubygems_version == fetch(:rubygems_version)
|
79
83
|
info("Previously installed RubyGems version was #{current_rubygems_version}")
|
80
|
-
rbenv_exec(:gem, :update, '--no-document', '--system', fetch(:rubygems_version))
|
84
|
+
rbenv_exec(:gem, :update, '--no-document', '--system', "'#{fetch(:rubygems_version)}'")
|
81
85
|
set :rbenv_needs_rehash, true
|
82
86
|
end
|
83
87
|
end
|
@@ -88,19 +92,21 @@ namespace :opscomplete do
|
|
88
92
|
invoke('opscomplete:ruby:update_ruby_build')
|
89
93
|
on roles fetch(:rbenv_roles, :all) do |host|
|
90
94
|
if managed_ruby?
|
91
|
-
raise Capistrano::ValidationError, "#{host}: Managed
|
95
|
+
raise Capistrano::ValidationError, "#{host}: Managed Ruby environment! Won't do any changes to Ruby version."
|
92
96
|
end
|
93
97
|
if rbenv_installed_rubies.include?(app_ruby_version)
|
94
|
-
info("#{host}:
|
98
|
+
info("#{host}: Ruby #{app_ruby_version} is installed.")
|
95
99
|
elsif rbenv_installable_rubies.include?(app_ruby_version)
|
96
|
-
info("#{host}:
|
97
|
-
|
100
|
+
info("#{host}: Configured Ruby version is not installed, but available for installation.")
|
101
|
+
with tmpdir: fetch(:tmp_dir) do
|
102
|
+
execute(:rbenv, :install, "'#{app_ruby_version}'")
|
103
|
+
end
|
98
104
|
set :rbenv_needs_rehash, true
|
99
105
|
else
|
100
106
|
raise Capistrano::ValidationError,
|
101
|
-
"#{host}: Ruby version
|
107
|
+
"#{host}: Configured Ruby version is neither installed nor installable using ruby-install."
|
102
108
|
end
|
103
|
-
execute(:rbenv, :global, app_ruby_version) unless capture(:rbenv, :global) == app_ruby_version
|
109
|
+
execute(:rbenv, :global, "'#{app_ruby_version}'") unless capture(:rbenv, :global) == app_ruby_version
|
104
110
|
end
|
105
111
|
invoke('opscomplete:ruby:install_rubygems')
|
106
112
|
invoke('opscomplete:ruby:install_bundler')
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# vim: filetype=ruby
|
2
|
+
namespace :opscomplete do
|
3
|
+
namespace :supervisor do
|
4
|
+
desc '(Re-)Generate the supervisor configuration (e.g. for supervisord).'
|
5
|
+
task :gen_config do
|
6
|
+
on roles fetch(:procfile_role, :app) do |host|
|
7
|
+
within release_path do
|
8
|
+
execute :supervisor_gen_config, host.properties.procfile
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Reread the supervisor configuration and (re)start all Procfile processes'
|
14
|
+
task :restart_procs do
|
15
|
+
on roles fetch(:procfile_role, :app) do
|
16
|
+
within release_path do
|
17
|
+
execute :supervisor_restart_procs
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Stop all Procfile processes in case you want to them to be stopped while your deployment runs'
|
23
|
+
task :stop_procs do
|
24
|
+
on roles fetch(:procfile_role, :app) do
|
25
|
+
within release_path do
|
26
|
+
execute :supervisor_stop_procs
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Can be used for example to quiet sidekiq with a task like this:
|
32
|
+
#
|
33
|
+
# namespace :sidekiq do
|
34
|
+
# desc 'quiet all sidekiq processes so they stop accepting new jobs.'
|
35
|
+
# task :quiet do
|
36
|
+
# on roles :cron do
|
37
|
+
# # The TSTP signal tells sidekiq to quiet all workers.
|
38
|
+
# # see: https://github.com/mperham/sidekiq/wiki/Signals#tstp
|
39
|
+
# invoke('supervisor:signal_procs', 'TSTP', 'sidekiq')
|
40
|
+
# end
|
41
|
+
# end
|
42
|
+
# end
|
43
|
+
desc 'Sends the signal (e.g. USR1 or TSTP) to all programs or if specified to program_name.'
|
44
|
+
task :signal_procs, :signal, :program_name do |_task_name, args|
|
45
|
+
signal = args.fetch(:signal)
|
46
|
+
program_name = args.fetch(:program_name, nil)
|
47
|
+
|
48
|
+
on roles fetch(:procfile_role, :app) do
|
49
|
+
within release_path do
|
50
|
+
if program_name
|
51
|
+
execute :supervisor_signal_procs, signal, program_name
|
52
|
+
else
|
53
|
+
execute :supervisor_signal_procs, signal
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-opscomplete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Makandra Operations
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: makandra-rubocop
|
@@ -16,42 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: capistrano
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,8 +79,10 @@ executables: []
|
|
79
79
|
extensions: []
|
80
80
|
extra_rdoc_files: []
|
81
81
|
files:
|
82
|
+
- ".ruby-version"
|
82
83
|
- CHANGELOG.md
|
83
84
|
- Gemfile
|
85
|
+
- Gemfile.lock
|
84
86
|
- LICENSE
|
85
87
|
- README.md
|
86
88
|
- Rakefile
|
@@ -89,14 +91,17 @@ files:
|
|
89
91
|
- capistrano-opscomplete.gemspec
|
90
92
|
- lib/capistrano/dsl/opscomplete.rb
|
91
93
|
- lib/capistrano/opscomplete.rb
|
92
|
-
- lib/capistrano/opscomplete/
|
93
|
-
- lib/capistrano/opscomplete/
|
94
|
+
- lib/capistrano/opscomplete/ruby.rake
|
95
|
+
- lib/capistrano/opscomplete/supervisor.rake
|
94
96
|
- lib/capistrano/opscomplete/version.rb
|
95
97
|
homepage: https://opscomplete.com/ruby
|
96
98
|
licenses:
|
97
99
|
- MIT
|
98
100
|
metadata:
|
99
101
|
allowed_push_host: https://rubygems.org
|
102
|
+
bug_tracker_uri: https://github.com/makandra/capistrano-opscomplete/issues
|
103
|
+
changelog_uri: https://github.com/makandra/capistrano-opscomplete/blob/master/CHANGELOG.md
|
104
|
+
source_code_uri: https://github.com/makandra/capistrano-opscomplete
|
100
105
|
post_install_message:
|
101
106
|
rdoc_options: []
|
102
107
|
require_paths:
|
@@ -112,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
117
|
- !ruby/object:Gem::Version
|
113
118
|
version: 2.0.1
|
114
119
|
requirements: []
|
115
|
-
|
116
|
-
rubygems_version: 2.7.6
|
120
|
+
rubygems_version: 3.0.3
|
117
121
|
signing_key:
|
118
122
|
specification_version: 4
|
119
123
|
summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.
|