capistrano-opscomplete 0.5.0 → 0.6.4
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 +4 -4
- data/.ruby-version +1 -0
- data/CHANGELOG.md +34 -2
- data/Gemfile.lock +60 -0
- data/README.md +57 -1
- data/capistrano-opscomplete.gemspec +8 -3
- data/lib/capistrano/dsl/opscomplete.rb +36 -4
- data/lib/capistrano/opscomplete.rb +7 -2
- data/lib/capistrano/opscomplete/hooks.rb +1 -0
- data/lib/capistrano/opscomplete/nodejs.rake +53 -0
- data/lib/capistrano/opscomplete/{tasks.rake → ruby.rake} +41 -1
- data/lib/capistrano/opscomplete/supervisor.rake +59 -0
- data/lib/capistrano/opscomplete/version.rb +1 -1
- metadata +19 -12
- 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: e0b8b15686f2822308863e7af85b079aa35e1473fbd23c3ed8a31251686d02b4
|
4
|
+
data.tar.gz: 2907023f2972eba8710484f9d2a995b028021e8db4a7b21677672c489f42454f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0288303aa496066cc38cba7ee7136647c8da697841831efd16dcd2203794225260e7d2564e99d0b1c6a8b5c874e2f67b31bfd90fb9c95c59b65ea4472f37f824'
|
7
|
+
data.tar.gz: 35d0304e8b112ee6939bd0c20f93b73c1ec39dcaf753673aa0441f91dd3f46ffb244752c2a3c2098c3d035c7648575e24ec0c3292767aeb602534fae6cdb0f84
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.6.6
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,36 @@
|
|
1
|
-
##
|
1
|
+
## [0.6.4] - 2020-11-19
|
2
|
+
|
3
|
+
### Added
|
4
|
+
- You can now manage the Node.js version which needs to be installed
|
5
|
+
- Add two new capistrano tasks (`opscomplete:ruby:broken_gems_warning`, `opscomplete:ruby:reset`) which help to mitigate problems when a deployment fails (described in: [#19](https://github.com/makandra/capistrano-opscomplete/issues/19))
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
- Added missing namespace for code example
|
9
|
+
|
10
|
+
## [0.6.3] - 2020-07-23
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
- regression after ([#18](https://github.com/makandra/capistrano-opscomplete/issues/18)) was merged
|
14
|
+
|
15
|
+
## [0.6.2] - 2020-07-23
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- rbenv-build changed behaviour of `--list` ([#20](https://github.com/makandra/capistrano-opscomplete/issues/20))
|
19
|
+
|
20
|
+
### Changed
|
21
|
+
- Bumped rack dependency from 2.1.1 to 2.2.3
|
22
|
+
|
23
|
+
## [0.6.1] - 2020-04-16
|
24
|
+
### Added
|
25
|
+
- Use Ruby 2.6 for development
|
26
|
+
|
27
|
+
### Changed
|
28
|
+
- Add rake as a runtime dependency
|
29
|
+
|
30
|
+
## [0.6.0] - 2020-01-13
|
31
|
+
### Added
|
32
|
+
|
33
|
+
- Support for Procfiles/supervisord. See [this makandra card](https://makandracards.com/opscomplete/67829-procfile-support) for more information.
|
2
34
|
|
3
35
|
## [0.5.0] - 2019-12-09
|
4
36
|
### Changed
|
@@ -13,7 +45,6 @@
|
|
13
45
|
- Allow using --force when installing a gem e.g. overwrite binaries
|
14
46
|
- Quote some shell arguments
|
15
47
|
|
16
|
-
|
17
48
|
## [0.3.0] - 2019-04-05
|
18
49
|
### Added
|
19
50
|
- You can now specify the rubygems and bundler version to be installed. (#4)
|
@@ -42,6 +73,7 @@
|
|
42
73
|
### Added
|
43
74
|
- Initial release.
|
44
75
|
|
76
|
+
[0.6.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.5.0...v0.6.0
|
45
77
|
[0.5.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.4.0...v0.5.0
|
46
78
|
[0.4.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.3.0...v0.4.0
|
47
79
|
[0.3.0]: https://github.com/makandra/capistrano-opscomplete/compare/v0.2.0...v0.3.0
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
capistrano-opscomplete (0.6.4)
|
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,51 @@ 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
|
+
If you want to handle the ruby version for rollbacks too, you should add:
|
40
|
+
|
41
|
+
```ruby
|
42
|
+
after 'deploy:reverting', 'opscomplete:ruby:ensure'
|
43
|
+
```
|
44
|
+
|
45
|
+
And in case you enabled [`Procfile support`](https://makandracards.com/opscomplete/67829-procfile-support) you can use the following tasks:
|
46
|
+
|
47
|
+
opscomplete:supervisor:gen_config
|
48
|
+
opscomplete:supervisor:restart_procs
|
49
|
+
opscomplete:supervisor:stop_procs
|
50
|
+
opscomplete:supervisor:signal_procs
|
51
|
+
|
52
|
+
e.g. like this:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
# Update and Restart supervisor config
|
56
|
+
after 'deploy:updating', 'opscomplete:supervisor:gen_config'
|
57
|
+
after 'deploy:published', 'opscomplete:supervisor:restart_procs'
|
58
|
+
```
|
59
|
+
|
60
|
+
Using the default configuration, these tasks will run on all Servers where role is `:app` using the Procfile called `Procfile`.
|
61
|
+
To change the role where these tasks will get executed, set `:procfile_role` in e.g. your `config/deploy.rb` like:
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
# Use supervisor tasks only for sidekiq role
|
65
|
+
set :procfile_role, :sidekiq
|
66
|
+
```
|
67
|
+
|
68
|
+
If you want to run different Procfiles on different servers, you can set the `:procfile` property in your `config/deploy/${env}.rb`:
|
69
|
+
|
70
|
+
```
|
71
|
+
# In this example, `Procfile` will get used for supervisor on srv2.example.com and `Procfile.sidekiq` for supervisor on srv1.example.com.
|
72
|
+
server "srv1.example.com", user: "deploy-example_s", roles: %w{app web}, procfile: "Procfile.sidekiq"
|
73
|
+
server "srv2.example.com", user: "deploy-example_s", roles: %w{app web}
|
74
|
+
```
|
75
|
+
|
38
76
|
## Usage
|
39
77
|
|
40
78
|
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.
|
@@ -119,6 +157,24 @@ There are many hooks available in the [default deploy flow](https://capistranorb
|
|
119
157
|
after 'deploy:updating', 'opscomplete:ruby:ensure'
|
120
158
|
```
|
121
159
|
|
160
|
+
## Managing your nodejs version with `capistrano-opscomplete`
|
161
|
+
|
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.
|
163
|
+
|
164
|
+
Include the gem in your applications Gemfile:
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
gem 'capistrano-opscomplete'
|
168
|
+
```
|
169
|
+
|
170
|
+
Now, add some [hooks](#using-capistrano-hooks) in your capistrano configuration (e.g. `deploy.rb`).
|
171
|
+
An example configuration could look like this:
|
172
|
+
|
173
|
+
```ruby
|
174
|
+
# After unpacking your release, before bundling, compiling assets, ...
|
175
|
+
after 'deploy:updating', 'opscomplete:nodejs:ensure'
|
176
|
+
```
|
177
|
+
|
122
178
|
## Contributing
|
123
179
|
|
124
180
|
Bug reports and pull requests are welcome. Don't hesitate to [open a new issue](https://github.com/makandra/capistrano-opscomplete/issues/new).
|
@@ -14,7 +14,12 @@ Gem::Specification.new do |spec|
|
|
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.'
|
@@ -32,8 +37,8 @@ Gem::Specification.new do |spec|
|
|
32
37
|
spec.required_rubygems_version = '>=2.0.1'
|
33
38
|
|
34
39
|
spec.add_development_dependency 'makandra-rubocop', '~> 4'
|
35
|
-
spec.add_development_dependency 'bundler', '~>
|
36
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
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
|
@@ -65,7 +65,7 @@ module Capistrano
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def rbenv_installable_rubies
|
68
|
-
rbenv_installable_rubies = capture(:rbenv, :install, '--list').split("\n")
|
68
|
+
rbenv_installable_rubies = capture(:rbenv, :install, '--list-all').split("\n")
|
69
69
|
rbenv_installable_rubies.map!(&:strip)
|
70
70
|
rbenv_installable_rubies.delete('Available version:')
|
71
71
|
rbenv_installable_rubies
|
@@ -108,6 +108,38 @@ module Capistrano
|
|
108
108
|
def rubygems_install(version)
|
109
109
|
rbenv_exec("gem update --no-document --system '#{version}'")
|
110
110
|
end
|
111
|
+
|
112
|
+
def managed_nodejs?
|
113
|
+
test("[ -f ${HOME}/.nodejs_managed_by_makandra ]")
|
114
|
+
end
|
115
|
+
|
116
|
+
def app_nodejs_version
|
117
|
+
|
118
|
+
# 1) Get version from capistrano configuration (highest precedence, 'override')
|
119
|
+
if fetch(:opscomplete_nodejs_version)
|
120
|
+
debug("Using version from :opscomplete_nodejs_version setting: #{fetch(:opscomplete_nodejs_version)}.")
|
121
|
+
fetch(:opscomplete_nodejs_version)
|
122
|
+
|
123
|
+
# 2) Get version from version file in release dir (after deploy:updating, before deploy:updated)
|
124
|
+
elsif capture(:nodejs_get_version, release_path)
|
125
|
+
debug("Using version from server's release_dir/.nvmrc, .node-version or .tool-versions file: #{capture(:nodejs_get_version, release_path)}")
|
126
|
+
capture(:nodejs_get_version, release_path)
|
127
|
+
|
128
|
+
else
|
129
|
+
raise Capistrano::ValidationError, 'Could not find application\'s Node.js version. Consider setting opscomplete_ruby_version.'
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
def nodejs_installable_versions
|
134
|
+
nodejs_installable_versions = capture(:nodejs_installable_versions).split("\n")
|
135
|
+
nodejs_installable_versions.map!(&:strip)
|
136
|
+
nodejs_installable_versions
|
137
|
+
end
|
138
|
+
|
139
|
+
def nodejs_installed_versions
|
140
|
+
nodejs_installed_versions = capture(:nodejs_installed_versions).split("\n")
|
141
|
+
nodejs_installed_versions.map!(&:strip)
|
142
|
+
end
|
111
143
|
end
|
112
144
|
end
|
113
145
|
end
|
@@ -1,4 +1,9 @@
|
|
1
1
|
require 'capistrano/opscomplete/version'
|
2
2
|
|
3
|
-
|
4
|
-
|
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/nodejs.rake', __dir__)
|
8
|
+
load File.expand_path('opscomplete/supervisor.rake', __dir__)
|
9
|
+
load File.expand_path('../opscomplete/hooks.rb', __FILE__)
|
@@ -0,0 +1 @@
|
|
1
|
+
after 'deploy:failed', 'opscomplete:ruby:broken_gems_warning'
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# vim: filetype=ruby
|
2
|
+
require 'capistrano/dsl/opscomplete'
|
3
|
+
|
4
|
+
namespace :opscomplete do
|
5
|
+
include Capistrano::DSL::Opscomplete
|
6
|
+
# desc 'Validate opscomplete specific configuration'
|
7
|
+
task :validate do
|
8
|
+
invoke('opscomplete:nodejs:check')
|
9
|
+
end
|
10
|
+
|
11
|
+
namespace :nodejs do
|
12
|
+
desc 'Check if nodejs version is set according to application\'s .node-version or .nvmrc (in this order).'
|
13
|
+
task :check do
|
14
|
+
on roles fetch(:nodejs_roles, :all) do |host|
|
15
|
+
warn("#{host}: Managed Node.js environment! Won't do any changes to nodejs version.") if managed_nodejs?
|
16
|
+
unless capture(:nodejs_current_version) == app_nodejs_version
|
17
|
+
raise Capistrano::ValidationError,
|
18
|
+
"#{host}: Node.js version is not set according to application\'s .node-version or .nvmrc file. Use cap opscomplete:nodejs:ensure."
|
19
|
+
end
|
20
|
+
info("#{host}: Node.js #{app_nodejs_version} is installed.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Update Node.js version management tool'
|
25
|
+
task :update_nodejs_build do
|
26
|
+
on roles fetch(:nodejs_roles, :all) do
|
27
|
+
execute :nodejs_update_management_tool
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'Install and configure NodeJS according to applications .nvmrc, .node-version or .tool-versions.'
|
32
|
+
task :ensure do
|
33
|
+
invoke('opscomplete:nodejs:update_nodejs_build')
|
34
|
+
on roles fetch(:nodejs_roles, :all) do |host|
|
35
|
+
if managed_nodejs?
|
36
|
+
raise Capistrano::ValidationError, "#{host}: Managed Node.js environment! Won't do any changes to Node.js version."
|
37
|
+
end
|
38
|
+
if nodejs_installed_versions.include?(app_nodejs_version)
|
39
|
+
info("#{host}: Node.js #{app_nodejs_version} is installed.")
|
40
|
+
elsif nodejs_installable_versions.include?(app_nodejs_version)
|
41
|
+
info("#{host}: Configured Node.js version is not installed, but available for installation.")
|
42
|
+
with tmpdir: fetch(:tmp_dir) do
|
43
|
+
execute(:nodejs_install_version, "'#{app_nodejs_version}'")
|
44
|
+
end
|
45
|
+
else
|
46
|
+
raise Capistrano::ValidationError,
|
47
|
+
"#{host}: Configured Node.js version is neither installed nor installable."
|
48
|
+
end
|
49
|
+
execute(:nodejs_set_version, "'#{app_nodejs_version}'")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -106,12 +106,52 @@ namespace :opscomplete do
|
|
106
106
|
raise Capistrano::ValidationError,
|
107
107
|
"#{host}: Configured Ruby version is neither installed nor installable using ruby-install."
|
108
108
|
end
|
109
|
-
|
109
|
+
unless capture(:rbenv, :global) == app_ruby_version
|
110
|
+
set :ruby_modified, true
|
111
|
+
execute(:rbenv, :global, "'#{app_ruby_version}'")
|
112
|
+
end
|
110
113
|
end
|
111
114
|
invoke('opscomplete:ruby:install_rubygems')
|
112
115
|
invoke('opscomplete:ruby:install_bundler')
|
113
116
|
invoke('opscomplete:ruby:install_geordi')
|
114
117
|
invoke('opscomplete:ruby:rehash') if fetch(:rbenv_needs_rehash, false)
|
115
118
|
end
|
119
|
+
|
120
|
+
desc 'resets the global ruby version and gems to Gemfile and .ruby-version in current_path.'
|
121
|
+
task :reset do
|
122
|
+
on roles fetch(:rbenv_roles, :all) do |host|
|
123
|
+
within current_path do
|
124
|
+
current_ruby_version_file_path = current_path.join('.ruby-version').to_s
|
125
|
+
if test("[ -f #{current_ruby_version_file_path} ]")
|
126
|
+
execute(:rbenv, :global, capture(:cat, current_ruby_version_file_path))
|
127
|
+
else
|
128
|
+
raise Capistrano::ValidationError,
|
129
|
+
"#{host}: Missing .ruby-version in #{current_path}. Won't set a new global version."
|
130
|
+
end
|
131
|
+
if test("[ -f '#{current_path}/.bundle/config' ]")
|
132
|
+
debug("#{host}: Found #{current_path}/.bundle/config, running bundle pristine.")
|
133
|
+
set :bundle_gemfile, -> { current_path.join('Gemfile') }
|
134
|
+
execute(:bundle, :pristine)
|
135
|
+
else
|
136
|
+
raise Capistrano::ValidationError,
|
137
|
+
"Unable to find #{current_path}/.bundle/config, won't run bundle pristine."
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
desc 'Set the old ruby version before the change and invoke bundle pristine.'
|
144
|
+
task :broken_gems_warning do
|
145
|
+
on roles fetch(:rbenv_roles, :all) do |host|
|
146
|
+
if fetch(:ruby_modified, false)
|
147
|
+
warn("Deploy failed and the ruby version has been modified in this deploy.")
|
148
|
+
warn("If this was a minor ruby version upgrade your running application may run into issues with native gem extensions.")
|
149
|
+
warn("If your deploy failed deploy:symlink:release you may run bundle exec `cap #{fetch(:stage)} opscomplete:ruby:reset`.")
|
150
|
+
warn("Please refer https://makandracards.com/makandra/477884-bundler-in-deploy-mode-shares-gems-between-patch-level-ruby-versions")
|
151
|
+
else
|
152
|
+
debug("#{host}: Ruby not modified in current deploy.")
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
116
156
|
end
|
117
157
|
end
|
@@ -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('opscomplete: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.4
|
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-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: makandra-rubocop
|
@@ -30,28 +30,28 @@ dependencies:
|
|
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,19 @@ 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/hooks.rb
|
95
|
+
- lib/capistrano/opscomplete/nodejs.rake
|
96
|
+
- lib/capistrano/opscomplete/ruby.rake
|
97
|
+
- lib/capistrano/opscomplete/supervisor.rake
|
94
98
|
- lib/capistrano/opscomplete/version.rb
|
95
99
|
homepage: https://opscomplete.com/ruby
|
96
100
|
licenses:
|
97
101
|
- MIT
|
98
102
|
metadata:
|
99
103
|
allowed_push_host: https://rubygems.org
|
104
|
+
bug_tracker_uri: https://github.com/makandra/capistrano-opscomplete/issues
|
105
|
+
changelog_uri: https://github.com/makandra/capistrano-opscomplete/blob/master/CHANGELOG.md
|
106
|
+
source_code_uri: https://github.com/makandra/capistrano-opscomplete
|
100
107
|
post_install_message:
|
101
108
|
rdoc_options: []
|
102
109
|
require_paths:
|
@@ -112,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
119
|
- !ruby/object:Gem::Version
|
113
120
|
version: 2.0.1
|
114
121
|
requirements: []
|
115
|
-
rubygems_version: 3.0.
|
122
|
+
rubygems_version: 3.0.3
|
116
123
|
signing_key:
|
117
124
|
specification_version: 4
|
118
125
|
summary: Capistrano tasks for easy deployment to a makandra opscomplete environment.
|