livebook-dev / livebook

Automate code & data workflows with interactive Elixir notebooks
https://livebook.dev
Apache License 2.0
4.99k stars 427 forks source link

Livebook Desktop, Fly.io runtime, and `flyctl` #2717

Closed wojtekmach closed 3 months ago

wojtekmach commented 3 months ago

On Livebook Desktop main I tried using Fly.io runtime. I got this error:

image

I have flyctl installed using their recommended way, via homebrew:

~% which flyctl
/opt/homebrew/bin/flyctl

The reason Livebook Desktop does not see it is because it's launched with a very minimal PATH:

image

An easy way to solve it is to adjust PATH in ~/.livebookdesktop.sh. If so, I think we should document it in this error message. That being said I think the best solution is to bite the bullet and add homebrew bin dir (if exists) to PATH in our rel/app/env.sh.eex. It is a bit slippery slope, on Windows flyctl is installed to ~/.fly/bin:

image

but I think we should still do this so it works out of the box.

Another option would be for Livebook to download its own flyctl.

Yet another option would be to not require flyctl ourselves and re-implement the APIs that we need as long as they are public.

jonatanklosko commented 3 months ago

Ah, I forgot that the path does not propagate in this case.

Another option would be for Livebook to download its own flyctl.

We considered that, but postponed, because the feeling is that people who want to use Fly, most likely have the CLI, since it's necessary to do basically anything after sign up. Probably the main reason not to do it, is that we may need to deal with updates or it would never update.

Yet another option would be to not require flyctl ourselves and re-implement the APIs that we need as long as they are public.

That's definitely recommended, we do use the API whenever possible, but flyctl proxy specifically is far more complexity. The proxy is basically the only blessed case of using flyctl in an application.

Adding the corresponding paths to PATH sound good to me. @josevalim?