Skip to content

feat: [#334] Improve run command output with service URLs#337

Merged
josecelano merged 4 commits intomainfrom
334-improve-run-command-output
Feb 11, 2026
Merged

feat: [#334] Improve run command output with service URLs#337
josecelano merged 4 commits intomainfrom
334-improve-run-command-output

Conversation

@josecelano
Copy link
Copy Markdown
Member

Description

Enhances the run command output to display service URLs immediately after services start, improving actionability by giving users direct access to their deployed services.

Closes #334

Changes

Phase 1: Shared View Components ✅

  • Created src/presentation/views/commands/shared/service_urls/ module
  • CompactServiceUrlsView - Renders service URLs in compact format (10 unit tests)
  • DnsHintView - Provides DNS configuration hints for HTTPS services (5 unit tests)
  • All 15 tests passing

Phase 2: Enhanced Run Command Output ✅

  • Modified RunCommandController::complete_workflow() to display service URLs
  • Added display_service_urls() method using shared views
  • Added load_environment() method reusing show command pattern
  • Added From<RepositoryError> conversion for proper error handling
  • All 2210 tests passing

Phase 3: Documentation ✅

Sample Output

Run Command (New Feature - HTTPS/TLS Environment)

$ cargo run -- run lxd-local-https-example
⏳ [1/2] Validating environment...
⏳   ✓ Environment name validated: lxd-local-https-example (took 0ms)
⏳ [2/2] Running application services...
⏳   ✓ Services started (took 24.0s)
✅ Run command completed for 'lxd-local-https-example'

Services are now accessible:
  Tracker (UDP):  udp://udp.tracker.local:6969/announce
  Tracker (HTTP): https://http.tracker.local/announce
  API:            https://api.tracker.local/api
  Health Check:   https://health.tracker.local/health_check
  Grafana:        https://grafana.tracker.local/


Note: HTTPS services require DNS configuration. See 'show' command for details.

Tip: Run 'torrust-tracker-deployer show lxd-local-https-example' for full details

Show Command (Comparison - Full Details)

$ cargo run -- show lxd-local-https-example
Environment: lxd-local-https-example
State: Running
Provider: LXD
Created: 2026-02-11 09:52:28 UTC

Infrastructure:
  Instance IP: 10.140.190.36
  SSH Port: 22
  SSH User: torrust
  SSH Key: /home/josecelano/Documents/git/committer/me/github/torrust/torrust-tracker-deployer-agent-01/fixtures/testing_rsa

Connection:
  ssh -i /home/josecelano/Documents/git/committer/me/github/torrust/torrust-tracker-deployer-agent-01/fixtures/testing_rsa torrust@10.140.190.36

Tracker Services:
  UDP Trackers:
    - udp://udp.tracker.local:6969/announce
  HTTP Trackers (HTTPS via Caddy):
    - https://http.tracker.local/announce
  API Endpoint (HTTPS via Caddy):
    - https://api.tracker.local/api
  Health Check (HTTPS via Caddy):
    - https://health.tracker.local/health_check

Prometheus:
  Internal only (localhost:9090) - not exposed externally

Grafana (HTTPS via Caddy):
  https://grafana.tracker.local/

Note: HTTPS services require domain-based access. For local domains (*.local),
add the following to your /etc/hosts file:

  10.140.190.36   http.tracker.local api.tracker.local grafana.tracker.local health.tracker.local

Internal ports (7070, 1212, 3000, 1313) are not directly accessible when TLS is enabled.

Services are running. Use 'test' to verify health.

Architecture

  • DDD Layer: Presentation
  • Module Path: src/presentation/views/commands/shared/service_urls/
  • Pattern: View composition with shared components
  • Design: Reuses shared views between run and show commands (no duplication)

Quality Assurance

  • All linters passing: markdown, yaml, toml, cspell, clippy, rustfmt, shellcheck
  • All 2210 unit tests passing
  • E2E tests passing (infrastructure lifecycle + deployment workflow)
  • Documentation builds successfully
  • Pre-commit checks passing
  • Manual E2E test verified with live deployment

Architecture Compliance

  • ✅ Follows DDD layer separation (Presentation layer)
  • ✅ Reuses shared view components (no duplication)
  • ✅ Uses UserOutput methods (no println!)
  • ✅ Output goes to stdout via ProgressReporter::result()
  • ✅ Follows module organization conventions
  • ✅ Error handling follows project conventions

Commits

  1. feat: [#334] add shared service URL views - Phase 1: Shared view components
  2. feat: [#334] display service URLs after run command completes - Phase 2: Enhanced output
  3. docs: [#334] update run command documentation with service URLs - Phase 3: Documentation (part 1)
  4. docs: [#334] mark implementation complete with all acceptance criteria - Phase 3: Documentation (part 2)

Testing

Verified with manual E2E test:

  1. Configured environment: configure lxd-local-https-example
  2. Released application: release lxd-local-https-example
  3. Started services: run lxd-local-https-example ✅ New output displayed
  4. Compared with: show lxd-local-https-example ✅ Full details shown

Rationale

  1. Actionable - Users immediately know where to access services
  2. Not overwhelming - Doesn't duplicate full show output (omits SSH details, internal ports)
  3. Educational - Teaches users about the show command
  4. Follows project principles - "Actionability: The system must always tell users how to continue"

The run command is the moment users want to use the services, so showing URLs immediately provides high value.

Phase 1: Extract Shared View Components
- Create shared view module for service URL rendering
- Add CompactServiceUrlsView for compact service URL display
- Add DnsHintView for TLS/HTTPS DNS configuration hints
- Filter out localhost-only services (show only public URLs)
- Include comprehensive unit tests for all views
- All tests passing (15 tests)
- Load environment state after services start in RunCommandController  - Display service URLs using CompactServiceUrlsView (only public services)
- Show DNS hint for HTTPS services using DnsHintView
- Add tip about using 'show' command for full details
- Add From<RepositoryError> conversion for proper error handling
- Reuse ServiceInfo extraction logic from show command pattern

Phase 2 Complete: Enhanced run command output with service URLs
- Add Command Output section to run.md showing service URL display
- Include examples for both HTTP and HTTPS/TLS environments
- Show DNS configuration hint for TLS deployments
- Update console-commands.md with new output format
- Add tip about using 'show' command for full details

All changes follow existing documentation structure and pass linters
- All phases complete: shared views, enhanced output, documentation
- 15 unit tests passing for shared view components
- All E2E tests pass and exercise new code paths
- Documentation updated with output examples
- All pre-commit checks passing
- Implementation follows all architectural requirements
@josecelano josecelano self-assigned this Feb 11, 2026
@josecelano josecelano merged commit 5eaa205 into main Feb 11, 2026
38 checks passed
josecelano added a commit that referenced this pull request Feb 11, 2026
- Updated roadmap to mark 10.2 'Improve run command output' as complete
- Added references to issue #334 and PR #337
- Removed issue spec docs/issues/334-improve-run-command-output-with-service-urls.md
- Task completed: Service URLs now displayed after run command
@josecelano josecelano mentioned this pull request Feb 11, 2026
41 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Run Command Output with Service URLs

1 participant