GithubHelp home page GithubHelp logo

coder-v1-cli's Introduction

Coder v1 CLI

GitHub Release Documentation

This is the command line utility for Coder v1. If you are using Coder v2 / Coder OSS, use these instructions to install the CLI.

The Coder v1 CLI is now closed-source. You may download binary releases from this repo.

Coder v2 is open-source and the recommended version for new Coder users.

coder-v1-cli's People

Contributors

alrs avatar ammario avatar anthonyshull avatar arminaaki avatar bpmct avatar cmoog avatar coadler avatar code-asher avatar creack avatar deansheather avatar dependabot[bot] avatar emyrk avatar f0ssel avatar fuskovic avatar ghuntley avatar goodspark avatar greyscaled avatar jawnsy avatar jmcampanini avatar johnstcn avatar kevinedry avatar kvnlnt avatar kylecarbs avatar lilshoff avatar nhooyr avatar scsmithr avatar spikecurtis avatar sreya avatar stephenwithav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coder-v1-cli's Issues

Clean up secrets create UX

$ coder secrets create new2 --from-prompt
value: ********

Should just be $ coder secrets create new2 no flag needed. Also it's OK to not star out the value as long it's not shown in terminal history. It would be nice to let the user know again what key they are assigning to walk them through it and confirm that it was successful or not.

e.g.

Enter your secret value for KEY:
...
Key KEY created successfully, access this key in any environment using $ coder get new2

Coder sh freezes

I just had this happen for the first time ever, ~20 minutes after updating to the wsep version. After returning to my terminal after a bit of idling, it's completely unresponsive. No inputs are registered, ctrl+c / ctrl+d won't escape, I had to close the terminal and reconnect.

The old wush implementation would just kick me back out to my local session periodically, so I assume the disconnect that is happening isn't being gracefully treated with the wsep implementation.

Mouse inputs treated improperly in coder sh

Screen Shot 2020-05-26 at 4 19 17 PM

Happens if I click on my terminal. Doesn't seem to happen in tmux, and mouse mode works fine with it, so not sure if there's anything too problematic here. Just feels a little jank.

Give better error when rsync doesn't exist on remote

right now it looks like

coder sync ~/Code/go/src/go.coder.com/enterprise/. fossel-2:~/enterprise
2020-04-20 14:17:02 INFO	doing initial sync (/Users/garrett/Code/go/src/go.coder.com/enterprise/. -> ~/enterprise)
protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)
rsync error: protocol incompatibility (code 2) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-54/rsync/compat.c(61) [sender=2.6.9]
2020-04-20 14:17:05 FATAL	sync: rsync: exit status 2

Add create and del subcommands to manage devurls

Proposal to add new subcommands,

  • create <env_name> <port> <access>
  • del <env_name> <port>

... allowing management of devurls and a full CRUD capability via coder-cli.

  • Requires prior login as a user with access to admin <env_name>
  • Subject to same site-install/org devurl access policies as doing this through the web frontend
  • The create subcommand should be an idempotent operation. Calling create on an existing <env_name> <port> will update the devurl's <access> if a new value is specified, otherwise the command will do nothing and return success.

These commands would be useful both for end users and for integration testing with cemanager, enabling scripted devurl testing to ensure the API endpoints haven't broken by changes either in coder-cli or enterprise.

The create and del subcommands may require work on cdr/enterprise as well but the existing endpoints used by the web FE can/should be usable. should be able to use existing endpoints available for the web frontend.

TBD: subcommand names. create and del may be too generic if coder-cli eventually manages other resources. Will implement as these for now, but suggest addurl and delurl instead?

Add environment status in list

It would be nice to know which envs are running or not in the env list. There is a column for "updating" but not for "running".

stdin / stdout behaves really weirdly at random

Came back to a terminal session after a while and got this behavior:

2020-04-30_17-48-03 (1)

It wasn't showing my input, and line breaks didn't seem to be working. My input was roughly

  • echo wtf
  • ls -la
  • enter a bunch of times
  • ls -la

Not sure what caused this, but it happened in two separate instances.

login: Malformed login URL arg breaks login, sh and sync

As a naive user I tried

coder login localhost:8080
coder login master.cdr.dev

The browser auto-launch of the login URL is malformed in the above cases (and the text on terminal if autolaunch fails)

If I specify the full URL eg.
coder login http://localhost:8080

the URL generated is correct, and subsequent coder sh and coder sync ops work.

Recommend adding logic to prepend http:// if not specified by the user.

Running 'coder urls' without any arguments errors

> coder urls
2020-07-30 10:30:44 INFO	found ["work" "nathan" "hello" "commit-judge" "mydev" "nix"]
2020-07-30 10:30:44 FATAL	environment "" not found

We should instead check that the environment name isn't empty. If it is, we should print usage.

Clear screen after disconnect

If you're in a "full screen" command like vim, nano, tmux etc. and you get disconnected, the whole screen keeps the characters from the full screen command. This can be really confusing. I'm pretty sure that ssh's default behavior on a disconnect is to clear the screen, but this might require a little testing about what most people would expect.

coder login message is busted

[coder@coder ~/enterprise/customer/site (devurl-ui *)]$ coder login https://master.cdr.dev
2020-05-22 17:34:13 INFO        visit {https   master.cdr.dev /internal-auth/  %!s(bool=false) local_service=http://127.0.0.1:45701 } to login

tunnel command

I'm thinking a coder tunnel <env> <env_port>:<local_port> command could be a nice UX even though it would basically just call ssh -L <port>:localhost:<port> coder:<env>.

Does anyone have a strong opinion?

Add input while waiting for oauth callback to allow ssh

Right now, the cli login expects a HTTP callback, so when working over ssh, need to manually copy/paste the link into a different terminal and curl it. Having a text input to do the copy/paste directly on the cli would help a lot. (That's how concourse handles it for instance).
To be clear, that would be in addition of what we have, not instead.

Default to only environment & configurable default environment

If you only have one environment, and you run a command that has an environment target (e.g. coder sh or coder sync) and you omit the target, we should just run the command against your only environment. Likewise, when you have multiple, you should be able to configure a default environment.

gcloud and kubectl both have default namespace / projects, so it would be similar to that.

Suggestion originally comes from @creack.

coder url command fails

$ coder login
...
$ coder url russ-env1 3000
2020-06-23 14:49:34 FATAL	json: cannot unmarshal number into Go value of type main.DevURL
$ git log --oneline -1
c69c791 (HEAD -> master, tag: v1.8.0, origin/master, origin/HEAD) Merge pull request #54 from cdr/53-detect-missing-protocol

macOS / Darwin release not signed

The binary release for the Darwin CLI isn't signed, and causes Gatekeeper to throw warnings when run. This is an issue in our environment as we require all installed binaries to be signed for security.

Sign macOS release

Screen Shot 2020-06-12 at 4 25 53 PM

This usually means we're not doing any kind of signing, we should sign the release even if we're not certified by Apple since it makes it more clear to the user that they can ignore the warning. This one requires you to know that you can go to security settings to override it.

Integration tests for coder-cli

As coder-cli runs against the backend (cdr/enterprise) and depends on its APIs, it would make sense to do some tests of the coder-cli tool itself as part of the main integration checks.

Major features could be tested to ensure they still function, eg:

  • sync
  • sh
  • devurls
    • add
    • update
    • list
    • delete

Attempt to reconnect when coder sh disconnects randomly

This is by far my biggest annoyance with coder sh, I get disconnected quite frequently. Could we attempt to reconnect for a second or two before dumping the user back to their terminal?

The issue is made even more annoying by #51 since it still looks like you're in your terminal if you're running tmux or some such.

coder sh prints usage when environment is offline

[willo@mbp ~]$ coder sh dev
2020-08-03 08:30:58 FATAL	run command: read pid message: failed to get reader: received close frame: status = StatusInternalError and reason = ""

We should have a better error message for common cases such as an off environment, a rebuilding environment etc.

Use polling based login flow

The existing localhost redirect solutions breaks when the browser is running on a different network than the command line (like in Coder Enterprise).

Instead, the CLI should publish a token to CE and link the browser to authenticate that token, then store that token locally. This is more secure too since the local token is different than the browser token.

A minimal RFC in the enterprise product should lay out the API in more detail first.

'coder sh' is laggy

The feedback is noticeable enough to be frustrating. It's useable but I wouldn't call it a good UX. It's possible this is due to the implementation of wush lite

Re-run project sync if anything changes during

Right now a bug exists where

  1. Project sync starts
  2. File system changes are made
  3. Project sync ends
  4. FS Watch starts

And the filesystem changes are never considered. Instead, we should keep an FS watch all the time, and run the project sync concurrently to it.

Migrate to urfave/cli

Although https://github.com/cdr/cli offers a minimal wrapper, it's becoming clear that it lacks sufficient features for the growing scope of coder-cli. I propose we migrate to https://github.com/spf13/cobra https://github.com/urfave/cli. Consider a few advantages that we'll gain "out of the box".

  • Suggestions when "unknown command" happens
  • bash, zsh, fish, and powershell completion generation
  • well designed and standard command validation abstractions
  • better persistent flag abstractions
  • no more interface upgrading nonsense
  • the model of a separate type per command is flawed and, given the lack of generics, is very difficult to abstract

Any thoughts / objections? cc @scsmithr @nhooyr @ammario

coder sync fails if all dirs leading to sync remoteDir don't already exist

With a new environment, I tried

$ coder sync ~/dev/x11wasm russ-dev1:/home/coder/dev/x11wasm
 2020-06-16 11:01:54 INFO doing initial sync (/home/russtopia/dev/x11wasm -> /home/coder/dev/x11wasm)
 2020-06-16 11:01:58 FATAL sync: rsync: exit status 11

For coder sync to succeed, I had to first do

coder sh russ-dev1
$ mkdir dev
$ exit

Might be nice if the coder sync command was able to essentially do a mkdir -p to ensure the rsync can operate on a brand new tree.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.