spin icon indicating copy to clipboard operation
spin copied to clipboard

Deploy: is it possible to wait for application ready?

Open itowlson opened this issue 1 year ago • 2 comments

At the moment, spin deploy returns as soon as Hippo accepts the deployment request. If the user is excited and quickly clicks on the link (or already has a previous version open, and refreshes), they may get a 502 gateway error or 404, as Traefik is provisioning and the Spin server job is starting up. This dims their excitement, and can even be misleading, as the user (me. It was me) thinks there is a problem with their application - particularly if, for example, they are already in the middle of a fault investigation (YES OKAY YES IT WAS ME).

Could we detect when the application is actually ready to serve, and print the URLs only at that point?

cc @bacongobbler as I don't know if Hippo is best placed to assess the status of Nomad/Traefik, or the Spin client should do this by poking an application health endpoint

itowlson avatar Jul 08 '22 03:07 itowlson

Hippo may be best served to handle this. I think this is actually a bug after we switched to the nomad openapi: nomad job run waited for the job to show health before returning. Right now, we're just waiting for the POST /jobs API to return a response.

bacongobbler avatar Jul 08 '22 04:07 bacongobbler

If anyone wants to tackle this, here's the StartJob endpoint in Hippo: https://github.com/deislabs/hippo/blob/811a044f23a20ca59ba30f29266e2946788b7385/src/Infrastructure/Services/NomadJobService.cs#L36

bacongobbler avatar Jul 08 '22 04:07 bacongobbler