Add pid, namespace, age, health, restarts to services ls by elliotthilaire-ca · Pull Request #2782 · jetify-com/devbox

Summary

This PR adds additional output to the devbox services ls command to see specifically to see the status of the readiness checks.

Without the HEALTH information in the output it's impossible to tell if a service is still booting up or if it is fully up and running based on the readiness check.

Before:

NAME                   STATUS           EXIT CODE
failed-server          Completed        -1
good-server            Launching        0
starting-server        Launching        0

After:

Services running in process-compose:
PID          NAME                   NAMESPACE        STATUS           AGE        HEALTH           RESTARTS        EXIT CODE
19996        good-server            default          Launching        5s         Ready            0               0
19995        starting-server        default          Launching        5s         Not Ready        0               0
19997        failed-server          default          Completed        2s         -                0               -1

Additional consideration

This PR brings the output of devbox services ls closer to that of process-compose list -o wide.

The output of process-compose list -o wide for comparison:

PID     NAME              NAMESPACE   STATUS      AGE   HEALTH      RESTARTS   EXITCODE
11518   failed-server     default     Completed   2s    -           0          -1
11520   good-server       default     Launching   3s    Ready       0          0
11519   starting-server   default     Launching   3s    Not Ready   0          0

(The only differences I see is the spacing between columns and no space in the title EXITCODE)

How was it tested?

With a sample process-compose.yaml file and running:

devbox run build
dist/devbox shell
devbox services start
devbox services ls 

The sample process-compose.yaml file used for testing.

processes:
 
  good-server:
    command: python -m http.server 8081
    is_daemon: true
    readiness_probe:
      exec:
        command: curl -f http://localhost:8081
      initial_delay_seconds: 1
      period_seconds: 1

  starting-server:
    command: python -m http.server 8082
    is_daemon: true
    readiness_probe:
      exec:
        command: curl -f http://localhost:8082/wait
      initial_delay_seconds: 1
      period_seconds: 100

  failed-server:
    command: python -m http.server 8083
    is_daemon: true
    readiness_probe:
      exec:
        command: curl -f http://localhost:8083/not_there
      initial_delay_seconds: 1
      period_seconds: 1    

Community Contribution License

All community contributions in this pull request are licensed to the project
maintainers under the terms of the
Apache 2 License.

By creating this pull request, I represent that I have the right to license the
contributions to the project maintainers under the Apache 2 License as stated in
the
Community Contribution License.