modules icon indicating copy to clipboard operation
modules copied to clipboard

JetBrains Fleet: Add a 1-click button for launching Fleet

Open matifali opened this issue 1 year ago • 15 comments
trafficstars

As per this Fleet issue, it will soon support launching remote environments via a URI scheme.

With Fleet 1.36 (the version after the upcoming version 1.35), Fleet URI handler will support connecting to SSH directly using URIs of this format:

fleet://fleet.ssh/<hostname>?<query_params>

with possible params being

  • username
  • port
  • pwd (the working directory to open)
  • forceNewHost (possible values are true and false, default is false - Setting to true will let Fleet ignore previous known hosts and always create a new connection)

username and port can also be specified alongside the hostname in common SSH URI syntax, i.e., <username>@<hostname>:<port>. To avoid ambiguities, pwd can only be specified explicitly.

Only the hostname is required. If some parameters are not specified, Fleet will try to use the closest known match in previous connections or fall back to default values. .ssh/config is considered as usual. Not specifying pwd will open an empty workspace on the host.

Examples:

fleet://fleet.ssh/example.org?username=foo&pwd=/home/foo/my_test_project

fleet://fleet.ssh/[email protected]?pwd=/home/foo/my_test_project

The current process to connect to a Coder workspace is documented here: https://coder.com/docs/ides/fleet

@kylecarbs @code-asher, what are your thoughts on how we can dynamically populate the URI? We have our plugins for VSCode Desktop and JetBrains gateway, which populates the .ssh/config.


Update: Fleet 1.36, which supports the SSH connection URI, has been released.

matifali avatar May 06 '24 14:05 matifali

Is it possible to have a Fleet extension?

kylecarbs avatar May 06 '24 15:05 kylecarbs

@kylecarbs not yet. But it's on their long-term roadmap. No developers docs ATM.

matifali avatar May 06 '24 15:05 matifali

Yeah without an extension the best we can do is document that coder config-ssh has to be ran manually and then use the coder.workspacename hostname in the URI, I think.

code-asher avatar May 07 '24 22:05 code-asher

This is insane, but I'm pretty sure Chrome handles ssh://.

In some magically insane world, we could add a small sniffer to the initial HTTPS packet for the SSH prefix (e.g. SSH-), and then authenticate using a secret username. Then we could one-click open anything, even without an extension!

ssh [email protected]

kylecarbs avatar May 08 '24 16:05 kylecarbs

Woaaaah that is actually dope.

code-asher avatar May 09 '24 01:05 code-asher

nice, what awesome about fleet is that it's free, for now.

michaelbrewer avatar May 23 '24 22:05 michaelbrewer

Maybe in preparation the fleet icon can be added to the coder server ;)

Also you do need have your ssh config updated ahead of time.

michaelbrewer avatar May 23 '24 22:05 michaelbrewer

Screenshot 2024-05-23 at 3 36 54 PM

For sure you can access the server via chrome: ssh://coder.platform-onbarding.main and with fleet it would be fleet://fleet.ssh/[email protected]?pwd=/workspace/platform-onboarding. The template would have to get the remote name ie: coder.platform-onbarding.main, for which i assume it coder.<workspace_id>.<agent_id> ?

michaelbrewer avatar May 23 '24 22:05 michaelbrewer

or which i assume it coder.<workspace_id>.<agent_id>

It should be coder.<workspace_id>.<agent_name> given that coder config-ssh is already run.

matifali avatar May 24 '24 09:05 matifali

i see that fleet 1.37 now out and this url schema works well :)

michaelbrewer avatar Jul 23 '24 14:07 michaelbrewer

@matifali i added the fleet icon to coder so long https://github.com/coder/coder/pull/14021

michaelbrewer avatar Jul 25 '24 22:07 michaelbrewer

or which i assume it coder.<workspace_id>.<agent_id>

It should be coder.<workspace_id>.<agent_name> given that coder config-ssh is already run.

And there is no way to know that the coder cli was installed locally or that coder config-ssh was run

michaelbrewer avatar Jul 25 '24 22:07 michaelbrewer

And there is no way to know that the coder cli was installed locally or that coder config-ssh was run

Sadly yes for now. It might change in future when Fleet support extensions or We find another way probably through Coder chrome extension.

matifali avatar Jul 26 '24 03:07 matifali

The same problem exists for people using JetBrains IDE (you need to pre-install Jetbrain Gateway).

michaelbrewer avatar Jul 26 '24 03:07 michaelbrewer

May be we can use https://www.jetbrains.com/help/fleet/install-on-a-remote-machine.html

matifali avatar Sep 24 '24 17:09 matifali