New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Capistrano "doctor" troubleshooting tasks #1642

Merged
merged 1 commit into from Apr 25, 2016

Conversation

Projects
None yet
2 participants
@mattbrictson
Member

mattbrictson commented Apr 6, 2016

This adds various "doctor" tasks that can be used for troubleshooting. To see all the doctor output, run e.g. cap production doctor. This will print a report like this:

Environment

    Ruby     ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
    Rubygems 2.6.2
    Bundler  1.11.2
    Command  cap production doctor

Gems

    capistrano         3.4.0
    airbrussh          1.0.1
    rake               10.5.0 (update available)
    sshkit             1.9.0
    capistrano-bundler 1.1.4
    capistrano-rails   1.1.6

Variables

    :application                         "myapp"
    :assets_prefix                       "assets"
    :assets_roles                        [:web]
    :branch                              "master"

... etc.

To obtain the variables information in particular, code has been added to audit the setting and fetching of variables. Variables set by Capistrano itself and its plugins are whitelisted, but others are "untrusted". If a variable is untrusted and it seems like it is never used, then doctor:variables will print a warning (include source location) for that variable name, like this:

:copy_strategy is not a recognized Capistrano setting (config/deploy.rb:14)

Finally, the RubyGems API is used to check the remote gem repository to see if any newer versions of Capistrano gems are available (this is gracefully skipped if there is no network connection). Any outdated gems will be indicated in the doctor:gems output.

Implements #1626, #1627.

TODO:

  • Tests
  • Changelog
  • When a deploy fails, print a message to make users aware of this feature? For now, just reference it in the GitHub docs.

@mattbrictson mattbrictson added this to the 3.6.0 milestone Apr 6, 2016

Add doctor:variables, :environment, and :gems
This adds various "doctor" tasks that can be used for troubleshooting. To see
all the doctor output, run e.g. `cap production doctor`. This will print a
report like this:

```
Environment

    Ruby     ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]
    Rubygems 2.6.2
    Bundler  1.11.2
    Command  cap production doctor

Gems

    capistrano         3.4.0
    airbrussh          1.0.1
    rake               10.5.0 (update available)
    sshkit             1.9.0
    capistrano-bundler 1.1.4
    capistrano-rails   1.1.6

Variables

    :application                         "myapp"
    :assets_prefix                       "assets"
    :assets_roles                        [:web]
    :branch                              "master"

... etc.
```

To obtain the variables information in particular, code has been added to audit
the setting and fetching of variables. Variables set by Capistrano itself and
its plugins are whitelisted, but others are "untrusted". If a variable is
untrusted and it seems like it is never used, then `doctor:variables` will print
a warning (include source location) for that variable name, like this:

```
:copy_strategy is not a recognized Capistrano setting (config/deploy.rb:14)
```

Finally, the RubyGems API is used to check the remote gem repository to see if
any newer versions of Capistrano gems are available (this is gracefully skipped
if there is no network connection). Any outdated gems will be indicated in the
`doctor:gems` output.
@mattbrictson

This comment has been minimized.

Show comment
Hide comment
@mattbrictson

mattbrictson Apr 15, 2016

Member

@leehambley @will-in-wi This is ready to review! I've added documentation, specs, and a Cucumber feature.

@leehambley Maybe we can squeeze this into 3.5.0?

Member

mattbrictson commented Apr 15, 2016

@leehambley @will-in-wi This is ready to review! I've added documentation, specs, and a Cucumber feature.

@leehambley Maybe we can squeeze this into 3.5.0?

@mattbrictson mattbrictson modified the milestones: 3.5.0, 3.6.0 Apr 15, 2016

@leehambley

This comment has been minimized.

Show comment
Hide comment
@leehambley

leehambley Apr 22, 2016

Member

@leehambley Maybe we can squeeze this into 3.5.0?

I think we can. I'm planning to do the release of 3.5.0 on 2016-04-25 assuming that I get my testing finished, and the Harrow integration and have time to do a small introduction on what Capistrano doctor is and how to use it (video, I'd like) over the weekend.

I'm broadly planning to ship the gem after 12:00 CET on Monday, but if you'd prefer for me to wait until you're awake and functional we can do that too. I don't expect any major headaches.

Member

leehambley commented Apr 22, 2016

@leehambley Maybe we can squeeze this into 3.5.0?

I think we can. I'm planning to do the release of 3.5.0 on 2016-04-25 assuming that I get my testing finished, and the Harrow integration and have time to do a small introduction on what Capistrano doctor is and how to use it (video, I'd like) over the weekend.

I'm broadly planning to ship the gem after 12:00 CET on Monday, but if you'd prefer for me to wait until you're awake and functional we can do that too. I don't expect any major headaches.

@mattbrictson

This comment has been minimized.

Show comment
Hide comment
@mattbrictson

mattbrictson Apr 22, 2016

Member

I'm broadly planning to ship the gem after 12:00 CET on Monday

👍

Member

mattbrictson commented Apr 22, 2016

I'm broadly planning to ship the gem after 12:00 CET on Monday

👍

@leehambley leehambley merged commit 96d2aa9 into capistrano:master Apr 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment