Skip to content

feat: Enable users to download the Coder CLI from the SSH button #5738

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

normana10
Copy link
Contributor

(Copied my use-case from: #5722)

I work with Coder in an offline environment, so when I noticed that the Coder agent downloads the CLI binary from https://<CODER_ACCESS_URL>/bin/coder-linux-amd64 I was ecstatic because I didn't need to import that to my offline environment separately or jump through hoops to extract the binary out of the Docker image and then host it somewhere for new devs to download

Though my first thought was why this was never displayed anywhere in the UI?

I know there's a "Install Coder CLI" line when you click on "SSH" in a workspace, which directs you off to the internet (which I don't have offline)

In this PR I change the "Download Coder CLI" link on the "SSH" button to just link to the locally hosted binaries

Currently looks like (before changes, for context):
image

With these changes the SSH button now looks like:
Now

Clicking on the "Download Coder CLI" link expands it to look like:
NowExpanded

I was originally going to try and do some browser OS/Arch detection and just download the correct binary, but after a bit of reading I couldn't find a good solution to reliably detect OS/Arch so I thought I may as well display all the binaries 🤷‍♂️

Closes #5722

@normana10 normana10 requested a review from a team as a code owner January 17, 2023 05:16
@normana10 normana10 requested review from jsjoeio and removed request for a team January 17, 2023 05:16
@normana10 normana10 changed the title Enable users to download the Coder CLI form the SSH button Enable users to download the Coder CLI from the SSH button Jan 17, 2023
@normana10 normana10 changed the title Enable users to download the Coder CLI from the SSH button feat: Enable users to download the Coder CLI from the SSH button Jan 17, 2023
@kylecarbs
Copy link
Member

It's a bit odd because these binaries are different than what you get from our releases.

These binaries don't embed the site (which isn't a biggie), but more importantly, aren't signed. This is particularly terrible for macOS users, who will get a warning that pops up essentially claiming this is a virus.

@mafredri
Copy link
Member

@kylecarbs @deansheather I recall there being a limitation with regard to signing the slim binaries in the build process. Was this a rcodesign limitation and can we work around it?

So I have an idea but perhaps this can't work for some reason I'm not aware of:

  1. Build slim binary for darwin (like normal)
  2. Sign the binary
  3. Use Go(!) to create a zip (archive/zip) of the darwin binary
  4. Sign and notarize the zip file (+ store xattrs generated on the zip?)
  5. Delete the zip
  6. Zstd compress slim binaries (like normal)
  7. Allow requesting /bin/coder-darwin-arm64.zip which transparently compresses the binary (again, using Go for reproducible bitstream), if needed attach xattrs

Perhaps xattrs aren't needed, in which case that part can be ignored.

@deansheather
Copy link
Member

That sounds pretty complicated. We should just link to the GitHub release page instead and hide this link if it's a dev build.

Users shouldn't be using the binaries we include in the server as they are not fully featured.

@deansheather
Copy link
Member

I've read your linked issue and agree that this is a good usecase for this, but I don't think this should be merged without changes to slim binaries to differentiate them from full server binaries. I will open a PR today to:

  • hide the server command on slim binaries
  • mention slim binary in the version command output
  • replace the server command with a command that prints an error

@deansheather
Copy link
Member

Ideally though we should just separate the CLI binary from the server binary like I suggested in #3188

@jsjoeio
Copy link
Contributor

jsjoeio commented Jan 17, 2023

Deferring my review to either @kylecarbs @deansheather or @mafredri

@deansheather deansheather self-requested a review January 17, 2023 16:46
@deansheather
Copy link
Member

I'll review this after I merge #5747

@deansheather deansheather requested review from a team and BrunoQuaresma and removed request for a team January 17, 2023 20:01
Comment on lines +97 to +99
<ExpandMoreIcon className={styles.linkIcon} />
) : (
<ChevronRightIcon className={styles.linkIcon} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, but I think maybe it should open a popup or something instead with some more details as to how to install the CLI. We should recommend GitHub releases by default, and only recommend this for airgapped users.

We also have other ways of installing Coder like the install script, etc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +110 to +130
<HelpTooltipLink href="/bin/coder-windows-amd64.exe">
For Windows (AMD64)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-windows-arm64.exe">
For Windows (ARM)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-darwin-amd64">
For Mac OS (Intel)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-darwin-arm64">
For Mac OS (ARM)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-linux-amd64">
For Linux (AMD64)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-linux-arm64">
For Linux (ARM64)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-linux-arm64">
For Linux (ARMv7)
</HelpTooltipLink>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should come from some typed constant array like:

interface CoderSlimBin {
  os: "windows" | "linux" | "darwin"
  arch: "amd64" | "arm64" | "armv7"
}

const SlimBins: CoderSlimBin[] = [
  ...
]

Then use a function to generate the filename and the text.

For Mac OS (Intel)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-darwin-arm64">
For Mac OS (ARM)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For Mac OS (ARM)
For Mac OS (ARM64)

For Windows (AMD64)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-windows-arm64.exe">
For Windows (ARM)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For Windows (ARM)
For Windows (ARM64)

<HelpTooltipLink href="/bin/coder-linux-arm64">
For Linux (ARM64)
</HelpTooltipLink>
<HelpTooltipLink href="/bin/coder-linux-arm64">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<HelpTooltipLink href="/bin/coder-linux-arm64">
<HelpTooltipLink href="/bin/coder-linux-armv7">

@BrunoQuaresma
Copy link
Collaborator

I liked the idea, but maybe, we could simplify it by adding a "Download" menu item in the User Dropdown Menu at the topbar and the download menu item redirect the user to the GitHub releases page. Thoughts?

@normana10
Copy link
Contributor Author

@BrunoQuaresma

A link in the user dropdown menu makes sense to me

Any preferences in how I determine whether we're in an airgapped environment?

(With the goal of linking to the current page that "Install Coder CLI" does if not airgapped and linking to the binaries directly if airgapped?)

@BrunoQuaresma
Copy link
Collaborator

@normana10 I think we don't have a way for that rn, so I think you can just ignore the air-gapped network use case for now since other parts of the app rely on the user having network access like the documentation links. But I appreciate your concern.

@normana10
Copy link
Contributor Author

Awkward because my use-case is the air-gapped use-case

I can throw a flag/environment variable into the backend if we think that is a decent solution?

(As a side note, GitLab having offline/air-gapped docs hosted locally is sometimes a lifesaver in an air-gapped environment. Just an interesting thought)

@BrunoQuaresma
Copy link
Collaborator

@normana10 that is good to know. We have an open issue to offline docs #5466. I think we can use an option as we do for the other deployment settings.

@mafredri
Copy link
Member

@BrunoQuaresma how about when you click download, a modal is opened (or you're redirected to a page) where we describe:

We recommend downloading the fully-featured vX.X.X [1] release for your platform from GitHub:
[Click here to download from GitHub]

Alternatively, you can download a version of coder without the server functionality from this instance:

  • [coder-darwin-arm64]
  • ...
  • [1] Specifying version here because we should link to the same release the server is running.

(I spent literally 0 time trying to write good text, if this is implemented, do a better job than me. 😄)

@BrunoQuaresma
Copy link
Collaborator

@mafredri this looks good!

@normana10
Copy link
Contributor Author

Though hats off to the Coder team, Coder has been a breeze to setup in my air-gapped env and the Offline Deployment Docs are chef's kiss

And I say that having set up a bunch of other software that didn't like to play ball offline

(Back on topic)

I also think so long as it's very obvious like the button saying "Download Coder CLI" I (as a user) wouldn't have any expectation that the binary I download would be able to run a Coder server

My main goal is just easing new devs into getting port forwarding setup so they can VNC using a client like TigerVNC (NoVNC doesn't serve the use-case well enough due to the cumbersome copy/pasting)

Do we think something like this:
image

Where "Download Coder Server" links to the GitHub release for the corresponding version and "Coder CLI" opens something like this (where we allow you to download the bundled binary):
image

(Assuming I apply Dean's changes and revert the SSHButton.tsx back to the way it was)

Thoughts?

@BrunoQuaresma
Copy link
Collaborator

@normana10 it is looking good! I would make a few changes to make it look a tiny better like using a single button with a Download icon and opening a dialog/modal as @mafredri suggested here #5738 (comment). I think with the dialog we can explain better why to use from an instance or from Git Hub. As a user, I would question why downloading the server doesn't show the OS list as the download CLI does.

@mafredri
Copy link
Member

Thanks for thinking about this @normana10 and coming up with new ideas. One issue with having a "download server" and "download CLI" is that we're currently not promoting the use of the non-GitHub release binary and we don't have a game-plan for how we wish to do it. Internally we're calling it slim (non-GitHub) and fat (GitHub) binary, but it's more like slim and normal. We'd prefer for the GitHub release to be used and calling it "server" is kind of misleading and directs people towards using slim binary instead (because of "oh I don't want the server").

@BrunoQuaresma
Copy link
Collaborator

@normana10 please, let us know if you need any help/assistance from our side!

@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Jan 31, 2023
@mafredri mafredri removed the stale This issue is like stale bread. label Feb 1, 2023
@github-actions
Copy link

github-actions bot commented Feb 9, 2023

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Feb 9, 2023
@BrunoQuaresma BrunoQuaresma removed their request for review February 10, 2023 15:37
@github-actions github-actions bot removed the stale This issue is like stale bread. label Feb 11, 2023
@github-actions
Copy link

This Pull Request is becoming stale. In order to minimize WIP, prevent merge conflicts and keep the tracker readable, I'm going close to this PR in 3 days if there isn't more activity.

@github-actions github-actions bot added the stale This issue is like stale bread. label Feb 18, 2023
@github-actions github-actions bot closed this Feb 21, 2023
@github-actions github-actions bot deleted the ssh-button-coder-cli-download branch May 17, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale This issue is like stale bread.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Download Coder CLI" option
6 participants