Skip to content

Separate the CLI from the server #3188

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
deansheather opened this issue Jul 25, 2022 · 14 comments
Closed

Separate the CLI from the server #3188

deansheather opened this issue Jul 25, 2022 · 14 comments
Labels
needs decision Needs a higher-level decision to be unblocked.

Comments

@deansheather
Copy link
Member

Currently the Coder CLI and the server are shipped in the same binary which results in it being quite large. We have made a lot of improvements to the CLI filesize over the last couple of months, especially thanks to @mafredri's work, but it is still almost twice as large compressed and 3 times as large uncompressed compared to a "slim" binary.

Pros

  • Users need to only download one binary if they want to test coder locally
  • No distinction is necessary

Cons

  • The coder binary is large as it contains the compiled frontend and binaries for all architectures for workspace agents
    • These are not needed if the CLI is only going to be used as a CLI
  • We have to ship a slim binary type which is the same as a regular binary but doesn't contain the frontend or other binaries

Proposal:

Add a new binary that we release called coderd which only contains the server components, including the compiled frontend and regular CLI binaries. The CLI will have the server components removed including the embedded frontend and slim binaries (perhaps after a short deprecation window if we desire).

Pros

  • Smaller filesize for users that only need to download the CLI and don't care about the server components
  • No problems during development where devs accidentally use slim binaries instead of full binaries that contain the frontend et. al. (we have run into this a few times)

Cons

  • If users want to run a coder server locally for evaluation they will need to download two binaries
    • This may not be the case in the future when users can accomplish everything from the web UI that they need the CLI for (e.g. creating first user, uploading templates etc.)
    • We can ease this pain by adding a flag to the install.sh script that will download and install both for you i.e. bash install.sh --with-server)
  • Distinction between the binary will be necessary in our docs

cc: @coadler @f0ssel @kylecarbs @spikecurtis @misskniss @tjcran

@deansheather deansheather added needs decision Needs a higher-level decision to be unblocked. api Area: HTTP API labels Jul 25, 2022
@kylecarbs
Copy link
Member

kylecarbs commented Jul 25, 2022

There are some additional sneaky but important benefits to a single CLI:

  • No client<->server version mismatch on initial installation.
  • The server existing in the client machine allows devs to tinker with Coder in their own machine, without requiring any complex setup.
  • Single package installation reduces overhead when downloading from the releases page (aka all Windows users).

I think it'd be wise to collect data from users before we emphasize binary size as being a large issue. I don't like that the binary is big, but I'm sure there are things we could do to reduce it apart from separating the installation.

@kylecarbs
Copy link
Member

@deansheather where are the slim binaries stored in this model? If they are still in coderd, could the second con still occur?

@deansheather
Copy link
Member Author

Regarding con 2, I'd expect we'd change the build process so the server cannot be built without the frontend/binaries. There's no need for slim binaries so we'd change our makefile to suit

@kylecarbs
Copy link
Member

I guess I'm confused, because where would the agent script curl the agent from? If the binary isn't embedded, where would it be?

@deansheather
Copy link
Member Author

No client<->server version mismatch on initial installation.
The server existing in the client machine allows devs to tinker with Coder in their own machine, without requiring any complex setup.

I'd expect these two points to be solved by the install.sh script installing both binaries as needed.

@deansheather
Copy link
Member Author

Single package installation reduces overhead when downloading from the releases page (aka all Windows users).

My proposal is that we have two release binaries, so you could still download one or the other from GitHub releases. Windows users shouldn't be impacted unless they want to run a server manually on Windows.

@kylecarbs
Copy link
Member

I guess what I'm saying is you need slim binaries to run a server. Otherwise, how would a Linux agent pull a Coder binary that can run the server with the agent? Unless it pulled from GitHub (which would break all air-gapped usage), this wouldn't work.

@sharkymark
Copy link
Contributor

@kylecarbs You and I discussed this a few weeks ago. I raised it with one large customer who said their device policies prevent any agents from being executed, as they must use virtual desktops, which I'd bet is common in some locations.

@spikecurtis
Copy link
Contributor

Compressed releases appear to be <100 MB, which doesn’t seem burdensome to me.

I’d change my mind if we heard significant pushback from community or customers, but until then I think what we have is working fine.

@deansheather
Copy link
Member Author

I guess what I'm saying is you need slim binaries to run a server. Otherwise, how would a Linux agent pull a Coder binary that can run the server with the agent? Unless it pulled from GitHub (which would break all air-gapped usage), this wouldn't work.

The coderd binary would just include the coder CLI binaries. There is no concept of slim

@kylecarbs kylecarbs changed the title Proposal: separate the CLI from the server Separate the CLI from the server Aug 24, 2022
@kylecarbs kylecarbs removed the api Area: HTTP API label Aug 24, 2022
@kylecarbs
Copy link
Member

Closing for now because this isn't a task that could be done without significant breakage.

@kylecarbs kylecarbs closed this as not planned Won't fix, can't repro, duplicate, stale Oct 21, 2022
@deansheather deansheather reopened this Jan 17, 2023
@deansheather
Copy link
Member Author

Another usecase is to let users download from the /bin dir on a coder server without them having to think about it not being a server binary. Users will be confused if they try to run a server from a slim binary that they downloaded from the server.

@bpmct
Copy link
Member

bpmct commented Feb 6, 2023

@deansheather Can we consider this closed, or do we want to take this a step further?

$ coder server
You are using a 'slim' build of Coder, which does not support the  server  subcommand.

Please use a build of Coder from GitHub releases:
  https://github.com/coder/coder/releases

@bpmct
Copy link
Member

bpmct commented Feb 15, 2023

Gonna close, feel free to reopen if I misunderstood.

@bpmct bpmct closed this as completed Feb 15, 2023
@bpmct bpmct closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2023
@bpmct bpmct closed this as completed Feb 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs decision Needs a higher-level decision to be unblocked.
Projects
None yet
Development

No branches or pull requests

5 participants