Skip to content

Feature add a warden doctor command #858

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

hardyjohnson
Copy link
Contributor

Check List

  • Matching PR in the documentation repo (replace text with link when it exists)
  • Entry in CHANGELOG.md

Is your feature request related to a problem? Please describe.

New command: warden doctor similar to the Homebrew project's brew doctor command.

This command is intended to help debug the local environment, taking into account the different ways a warden environment can be setup and configured, especially to help in identifying bugs as part of the warden project.

This was previously discussed here: https://github.com/orgs/wardenenv/discussions/851#discussion-8106360

Command outputs the following information:

  1. Host OS and version
  2. Host processor architecture
  3. Brew information
  4. Container runtime and compose information
  5. Warden version
  6. Warden global .env
  7. Warden override detection for extension at the global level (~/.warden/docker-compose.yml and ~/.warden/warden-env.yml)
  8. Warden images, versions and architecture
  9. Warden environments and service configuration files
  10. Warden status
  11. Mutagen sync file list if Mutagen is enabled

Example

> warden doctor

Host information:
macOS
15.4

OS, version, architecture:
Darwin 24.4.0 arm64

Homebrew information:
HOMEBREW_VERSION: 4.4.27
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9b1efcd944408db0bd85f82fe4724ccae04a812f
Last commit: 14 hours ago
Branch: stable
Core tap JSON: 31 Mar 21:43 UTC
Core cask tap JSON: 31 Mar 21:43 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nano
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 3.3.7 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.7/bin/ruby
CPU: dodeca-core 64-bit arm_blizzard_avalanche
Clang: 16.0.0 build 1600
Git: 2.49.0 => /opt/homebrew/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.4-arm64
CLT: 16.2.0.0.1.1733547573
Xcode: 16.2
Rosetta 2: false

Container runtime and compose information:
Docker version 28.0.1, build 068a01e
Docker Compose version v2.33.1-desktop.1

Warden version:
in-dev

Warden global .env:
# Set to "1" to enable global Portainer service
WARDEN_PORTAINER_ENABLE=0
# SEt to "0" to disable DNSMasq
WARDEN_DNSMASQ_ENABLE=1

WARDEN_PHPMYADMIN_ENABLE=1

Warden service override via Docker compose file:
Warden services do not appear to be overridden via ~/.warden/docker-compose.yml file.

Warden service override via ~/.warden/warden-env.yml partial:
Warden services do not appear to be overridden via ~/.warden/warden-env.yml partial.

Warden image, tag and architecture:
wardenenv/php-fpm:7.4-xdebug3:arm64
wardenenv/php-fpm:7.4:arm64
wardenenv/varnish:7.6:arm64
wardenenv/nginx:1.16:arm64
wardenenv/opensearch:2.12:arm64
wardenenv/dnsmasq:latest:arm64
wardenenv/php-fpm:8.3-magento2-xdebug3:arm64
wardenenv/php-fpm:8.3-magento2:arm64
wardenenv/mariadb:10.6:arm64
wardenenv/redis:7.2:arm64
wardenenv/rabbitmq:3.13:arm64
wardenenv/mariadb:10.4:arm64

Warden environments and service configuration files :
"acdemo - running(8)"
[
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/networks.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/php-fpm.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/php-fpm.darwin.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/nginx.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/nginx.darwin.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/db.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/magento2/db.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/opensearch.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/varnish.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/rabbitmq.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/includes/redis.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/magento2/magento2.base.yml",
  "/Users/computeruser/code/opensource/wardenenv/warden/environments/magento2/magento2.mutagen_compose.yml",
  "/Users/computeruser/code/adobecommerce/.warden/warden-env.yml"
]
"wordpress - created(3), exited(2)"
[
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/networks.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/php-fpm.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/php-fpm.darwin.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/nginx.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/nginx.darwin.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/db.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/wordpress/db.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/includes/elastichq.base.yml",
  "/opt/homebrew/Cellar/warden/0.15.0/environments/wordpress/wordpress.base.yml"
]

Warden status:
Found the following running environments:
    acdemo a magento2 project
       Project Directory: /Users/computeruser/code/adobecommerce
       Project URL: https://app.acdemo.test

@hardyjohnson
Copy link
Contributor Author

OK, I have added tests for brew, jq, mutagen and whether docker is running. I also tried to clean some things up to be more consistent. @navarr @bap14 take a look and lmk if this looks like something helpful or if there are any other additions you would like to see.

@hardyjohnson
Copy link
Contributor Author

I added a few additional pieces that I think round out this feature.

  1. Addition of a warden doctor -v argument which will trigger output of .env files and a warning not to copy sensitive values into bug reports.
  2. Additional checks for other override locations (~/.warden/docker-compose.yml, ~/.warden/warden-env.yml, project .env).

@navarr navarr moved this to 🏗 In progress in Warden Apr 10, 2025
@navarr navarr added the enhancement New feature or request label Apr 10, 2025
@navarr navarr added this to the Warden 0.16 milestone Apr 10, 2025
@hardyjohnson
Copy link
Contributor Author

@navarr anything that needs to be done on my end to move this forward?

Not sure I actually know who does what at which step in the Kanban flow. It looks like:

No status -> New -> Backlog -> Ready -> In progress -> In review -> Done

So at this step where some review has taken place and changes have been submitted, does this now go back to review by maintainers or reviewers?

@navarr
Copy link
Member

navarr commented Apr 22, 2025

@hardyjohnson I need to re-review and test and then it'll be merged. It's basically waiting on me now. Thank you for your contribution!

You can see by the milestone that I'd like to put this in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

3 participants