Meshery: [Meshery] Ask user confirmation before starting docker in the PreReqCheck

Created on 28 Oct 2020  Â·  4Comments  Â·  Source: layer5io/meshery

Description
mesheryctl system XXXX commands try to start docker daemon, if its not running already.
However User should be prompted before docker daemon is started.

Expected Behavior
Introduce an user prompt before starting docker daemon

Screenshots
This sample code was added in PreReqCheck() code in helpers.go,
however it was not giving desired result, need to rework on it:

var resp string 
fmt.Printf("Do you want to start docker daemon?(y/n): ")
_, err := fmt.Scan(&resp)
fmt.Printf("Response read:%s, err: %v\n", resp, err)
if err != nil {
   log.Info("Run `masheryctl system start` once docker is started.")
   return nil
}
resp = strings.TrimSpace(resp)
resp = strings.ToLower(resp)
if resp == "n" || resp == "no" {
    log.Info("Run `masheryctl system start` once docker is started.")
    return nil
}

Environment:

  • Host OS: Unix, MacOS
  • Meshery Version:
  • Kubernetes Version:
  • Browser:

[Optional] To Reproduce

  1. Stop docker daemon
  2. Run "mesheryctl system start" command

[Optional] Additional Context
Check PR: #1685 #1697

kinbug

Most helpful comment

We are doing this to reduce time to value. Same reason that we are opening up their browser. Same reason that we are changing information on CLI binary and moving it to a different folder.

All 4 comments

@leecalcote @hexxdump Why are we even starting docker daemon on user's behalf? Docker is a pre-req for meshery which is clearly stated in the docs, I don't think we need to start daemon on users' behalf rather we should just improve the error handling, imo this is not a good ux that cli is starting the tools itself which should be done by user.

We are doing this to reduce time to value. Same reason that we are opening up their browser. Same reason that we are changing information on CLI binary and moving it to a different folder.

@hexxdump, the new version of system start does spin up Docker Desktop on my machine when Docker Desktop is turned off. Pretty neat. 🙂 The command seems to timeout, though, while waiting for Docker to be ready:

➜  ~ mesheryctl system update
Docker daemon is not running
Attempting to start Docker daemon
Error: failed to start Docker daemon. Run `mesheryctl system update` once docker is started.: please start Docker then run the command `mesheryctl system update`: exit status 1

I don't know that a longer timeout is necessarily ideal. We may want to open up an issue on this as an enhancement to the logic.

@kushthedude @NupurThakur27 can you take a look at the above changes?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aisuko picture Aisuko  Â·  3Comments

anirudhjain75 picture anirudhjain75  Â·  4Comments

navendu-pottekkat picture navendu-pottekkat  Â·  4Comments

MukulMaheshwari picture MukulMaheshwari  Â·  4Comments

leecalcote picture leecalcote  Â·  4Comments