Commit Graph

108 Commits

Author SHA1 Message Date
Ammar Bandukwala 2bd6d2908e
feat: convert entire CLI to clibase (#6491)
I'm sorry.
2023-03-23 17:42:20 -05:00
Josh Vawdrey 97f77c4507
feat: allow DERP headers to be set (#6572)
* feat: allow DERP headers to be set

* chore: remove custom flag

* Clone DERP header on client create

* Adjust to use interface to cast headers

---------

Co-authored-by: Kyle Carberry <kyle@carberry.com>
2023-03-21 18:43:20 +00:00
Ammar Bandukwala 3b73321a6c
feat: refactor deployment config (#6347) 2023-03-07 15:10:01 -06:00
Mathias Fredriksson 5876dc1f97
test(cli): Improve speedtest debugging (#6341) 2023-02-24 20:09:16 +02:00
Ammar Bandukwala f05609b4da
chore: format Go more aggressively 2023-02-18 18:32:09 -06:00
Colin Adler a54de6093b
feat: add `coder ping` (#6161) 2023-02-13 10:38:00 -06:00
Kyle Carberry 7ad87505c8
chore: move agent functions from `codersdk` into `agentsdk` (#5903)
* chore: rename `AgentConn` to `WorkspaceAgentConn`

The codersdk was becoming bloated with consts for the workspace
agent that made no sense to a reader. `Tailnet*` is an example
of these consts.

* chore: remove `Get` prefix from *Client functions

* chore: remove `BypassRatelimits` option in `codersdk.Client`

It feels wrong to have this as a direct option because it's so infrequently
needed by API callers. It's better to directly modify headers in the two
places that we actually use it.

* Merge `appearance.go` and `buildinfo.go` into `deployment.go`

* Merge `experiments.go` and `features.go` into `deployment.go`

* Fix `make gen` referencing old type names

* Merge `error.go` into `client.go`

`codersdk.Response` lived in `error.go`, which is wrong.

* chore: refactor workspace agent functions into agentsdk

It was odd conflating the codersdk that clients should use
with functions that only the agent should use. This separates
them into two SDKs that are closely coupled, but separate.

* Merge `insights.go` into `deployment.go`

* Merge `organizationmember.go` into `organizations.go`

* Merge `quota.go` into `workspaces.go`

* Rename `sse.go` to `serversentevents.go`

* Rename `codersdk.WorkspaceAppHostResponse` to `codersdk.AppHostResponse`

* Format `.vscode/settings.json`

* Fix outdated naming in `api.ts`

* Fix app host response

* Fix unsupported type

* Fix imported type
2023-01-29 15:47:24 -06:00
Mathias Fredriksson 320cd3f3bc
feat(cli): Add `restart` subcommand (#5799)
Fixes #2464
2023-01-19 23:56:41 +02:00
Dean Sheather 7f5dcc3d6c
feat: remove server subcommand from slim binaries (#5747) 2023-01-17 16:58:00 +00:00
Dean Sheather e72a2ad907
feat: add SIGQUIT/SIGTRAP handler for the CLI (#5665) 2023-01-11 16:22:20 +00:00
Kyle Carberry 9f6edab53b
feat: replace vscodeipc with vscodessh (#5645)
The VS Code extension has been refactored to use VS Code
Remote SSH instead of using the private API.

This changes the structure to continue using SSH, but
output network information periodically to a file.
2023-01-10 04:23:17 +00:00
Colin Adler 888766c10d
fix: respect global `--url` flag in `coder login` (#5613) 2023-01-06 20:57:25 -06:00
Kyle Carberry e61234f260
feat: Add `vscodeipc` subcommand for VS Code Extension (#5326)
* Add extio

* feat: Add `vscodeipc` subcommand for VS Code Extension

This enables the VS Code extension to communicate with a Coder client.
The extension will download the slim binary from `/bin/*` for the
respective client architecture and OS, then execute `coder vscodeipc`
for the connecting workspace.

* Add authentication header, improve comments, and add tests for the CLI

* Update cli/vscodeipc_test.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update cli/vscodeipc_test.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update cli/vscodeipc/vscodeipc_test.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Fix requested changes

* Fix IPC tests

* Fix shell execution

* Fix nix flake

* Silence usage

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2022-12-18 17:50:06 -06:00
Dean Sheather 6b6eac2518
feat: remove loadtest cmd, add new scaletest cmd (#5310) 2022-12-15 15:04:24 +00:00
Kyle Carberry 8e702d89bb
fix: improve the warning mismatch to display the release assets on windows (#5418)
* fix: improve the warning mismatch to display the release assets on windows

Fixes #4226.

* Update cli/root.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

* Update cli/root.go

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2022-12-14 16:36:28 +00:00
Ammar Bandukwala 91973e1e88
cli: remove redundant client creation requests (#5264) 2022-12-02 15:40:23 -06:00
Mathias Fredriksson 26ab0d37c1
fix: Protect codersdk.Client SessionToken so it can be updated (#4965)
This feature is used by the coder agent to exchange a new token. By
protecting the SessionToken via mutex we ensure there are no data races
when accessing it.
2022-11-09 15:31:24 +02:00
Garrett Delfosse 2789fb7cac
fix: move experimental flag to server (#4959) 2022-11-08 16:59:39 +00:00
Marcin Tojek 641aacf793
feat: show banner when workspace is outdated (#4926)
* feat: show banner when workspace is outdated

* Address PR comments

* Fix: writer
2022-11-07 19:12:39 +01:00
Dean Sheather e7dd3f9378
feat: add load testing harness, coder loadtest command (#4853) 2022-11-02 18:30:00 +00:00
Jon Ayers 90f77a3415
feat: add groups support to the CLI (#4755) 2022-10-27 16:49:35 -05:00
Kyle Carberry eec406b739
feat: Add Git auth for GitHub, GitLab, Azure DevOps, and BitBucket (#4670)
* Add scaffolding

* Move migration

* Add endpoints for gitauth

* Add configuration files and tests!

* Update typesgen

* Convert configuration format for git auth

* Fix unclosed database conn

* Add overriding VS Code configuration

* Fix Git screen

* Write VS Code special configuration if providers exist

* Enable automatic cloning from VS Code

* Add tests for gitaskpass

* Fix feature visibiliy

* Add banner for too many configurations

* Fix update loop for oauth token

* Jon comments

* Add deployment config page
2022-10-24 19:46:24 -05:00
John 0783ca3793
cli: version to the $ coder header in CLI (#4709) 2022-10-24 11:17:48 -05:00
Kyle Carberry 7bc5b89f7a
feat: Support config files with viper (#4696) 2022-10-21 17:08:23 -05:00
Garrett Delfosse e8537067ef
Revert "Revert "Revert "feat: Support config files with viper"" (#4693)" (#4695)
This reverts commit 372fb1f345.
2022-10-21 16:07:38 -05:00
Garrett Delfosse 372fb1f345
Revert "Revert "feat: Support config files with viper"" (#4693) 2022-10-21 20:55:20 +00:00
Garrett Delfosse a2fb444911
Revert "feat: Support config files with viper (#4558)" (#4692)
This reverts commit c8e299c8f1.
2022-10-21 20:04:27 +00:00
Garrett Delfosse c8e299c8f1
feat: Support config files with viper (#4558) 2022-10-21 19:26:39 +00:00
Kyle Carberry c5afaffa7e
fix: Tidy up closes for nicer output (#4605)
* fix: Tidy up closes for nicer output

There was a context canceled message that would appear
because of traces, and this was using the wrong close.

I don't think it was causing any specific problems, but
it could make a replica warning appear on restart.

* Fix migration and experimental
2022-10-17 18:36:23 -05:00
Kyle Carberry 2ba4a62a0d
feat: Add high availability for multiple replicas (#4555)
* feat: HA tailnet coordinator

* fixup! feat: HA tailnet coordinator

* fixup! feat: HA tailnet coordinator

* remove printlns

* close all connections on coordinator

* impelement high availability feature

* fixup! impelement high availability feature

* fixup! impelement high availability feature

* fixup! impelement high availability feature

* fixup! impelement high availability feature

* Add replicas

* Add DERP meshing to arbitrary addresses

* Move packages to highavailability folder

* Move coordinator to high availability package

* Add flags for HA

* Rename to replicasync

* Denest packages for replicas

* Add test for multiple replicas

* Fix coordination test

* Add HA to the helm chart

* Rename function pointer

* Add warnings for HA

* Add the ability to block endpoints

* Add flag to disable P2P connections

* Wow, I made the tests pass

* Add replicas endpoint

* Ensure close kills replica

* Update sql

* Add database latency to high availability

* Pipe TLS to DERP mesh

* Fix DERP mesh with TLS

* Add tests for TLS

* Fix replica sync TLS

* Fix RootCA for replica meshing

* Remove ID from replicasync

* Fix getting certificates for meshing

* Remove excessive locking

* Fix linting

* Store mesh key in the database

* Fix replica key for tests

* Fix types gen

* Fix unlocking unlocked

* Fix race in tests

* Update enterprise/derpmesh/derpmesh.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

* Rename to syncReplicas

* Reuse http client

* Delete old replicas on a CRON

* Fix race condition in connection tests

* Fix linting

* Fix nil type

* Move pubsub to in-memory for twenty test

* Add comment for configuration tweaking

* Fix leak with transport

* Fix close leak in derpmesh

* Fix race when creating server

* Remove handler update

* Skip test on Windows

* Fix DERP mesh test

* Wrap HTTP handler replacement in mutex

* Fix error message for relay

* Fix API handler for normal tests

* Fix speedtest

* Fix replica resend

* Fix derpmesh send

* Ping async

* Increase wait time of template version jobd

* Fix race when closing replica sync

* Add name to client

* Log the derpmap being used

* Don't connect if DERP is empty

* Improve agent coordinator logging

* Fix lock in coordinator

* Fix relay addr

* Fix race when updating durations

* Fix client publish race

* Run pubsub loop in a queue

* Store agent nodes in order

* Fix coordinator locking

* Check for closed pipe

Co-authored-by: Colin Adler <colin1adler@gmail.com>
2022-10-17 13:43:30 +00:00
Garrett Delfosse 3cb2d52a08
fix: issue with token auth (#4483) 2022-10-11 15:58:28 +00:00
Garrett Delfosse a70278e0e1
feat: make flags in one place (#4452) 2022-10-11 15:16:19 +00:00
Garrett Delfosse b1faaef482
feat: deployment flags (#4426) 2022-10-10 15:04:15 -04:00
Garrett Delfosse f5df54831a
feat: tokens (#4380) 2022-10-06 19:02:27 +00:00
Garrett Delfosse ffbaa93722
feat: add experimental flag (#4364) 2022-10-04 19:45:00 +00:00
Mathias Fredriksson 2ca7214259
fix: Produce unknown subcommand errors for bad command names (#4089)
Fixes #1616
2022-09-20 15:31:38 +03:00
Kyle Carberry db0ba8588e
chore: Refactor Enterprise code to layer on top of AGPL (#4034)
* chore: Refactor Enterprise code to layer on top of AGPL

This is an experiment to invert the import order of the Enterprise
code to layer on top of AGPL.

* Fix Garrett's comments

* Add pointer.Handle to atomically obtain references

This uses a context to ensure the same value persists through
multiple executions to `Load()`.

* Remove entitlements API from AGPL coderd

* Remove AGPL Coder entitlements endpoint test

* Fix warnings output

* Add command-line flag to toggle audit logging

* Fix hasLicense being set

* Remove features interface

* Fix audit logging default

* Add bash as a dependency

* Add comment

* Add tests for resync and pubsub, and add back previous exp backoff retry

* Separate authz code again

* Add pointer loading example from comment

* Fix duplicate test, remove pointer.Handle

* Fix expired license

* Add entitlements struct

* Fix context passing
2022-09-19 23:11:01 -05:00
Kyle Carberry 6f82ad09c8
fix: Improve consistency on CLI help (#4112)
This makes the english consistent on flags, and improves
the contrast for the placeholder color on dark themes.
2022-09-19 11:36:18 -05:00
Geoffrey Huntley d499416024
housekeeping(branding): be consistent (#4075) 2022-09-19 09:57:18 +10:00
Kyle Carberry a2098254cd
feat: Support `--header` for CLI commands to support proxies (#4008)
Fixes #3527.
2022-09-12 16:22:05 -05:00
Dean Sheather bb4a681833
fix: don't check buildinfo or entitlements in agent (#3956) 2022-09-08 23:59:28 +10:00
Kyle Carberry 1254e7a902
feat: Add speedtest command for tailnet (#3874) 2022-09-05 17:15:49 -05:00
Kyle Carberry 9bd83e5ec7
feat: Add Tailscale networking (#3505)
* fix: Add coder user to docker group on installation

This makes for a simpler setup, and reduces the likelihood
a user runs into a strange issue.

* Add wgnet

* Add ping

* Add listening

* Finish refactor to make this work

* Add interface for swapping

* Fix conncache with interface

* chore: update gvisor

* fix tailscale types

* linting

* more linting

* Add coordinator

* Add coordinator tests

* Fix coordination

* It compiles!

* Move all connection negotiation in-memory

* Migrate coordinator to use net.conn

* Add closed func

* Fix close listener func

* Make reconnecting PTY work

* Fix reconnecting PTY

* Update CI to Go 1.19

* Add CLI flags for DERP mapping

* Fix Tailnet test

* Rename ConnCoordinator to TailnetCoordinator

* Remove print statement from workspace agent test

* Refactor wsconncache to use tailnet

* Remove STUN from unit tests

* Add migrate back to dump

* chore: Upgrade to Go 1.19

This is required as part of #3505.

* Fix reconnecting PTY tests

* fix: update wireguard-go to fix devtunnel

* fix migration numbers

* linting

* Return early for status if endpoints are empty

* Update cli/server.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

* Update cli/server.go

Co-authored-by: Colin Adler <colin1adler@gmail.com>

* Fix frontend entites

* Fix agent bicopy

* Fix race condition for the last node

* Fix down migration

* Fix connection RBAC

* Fix migration numbers

* Fix forwarding TCP to a local port

* Implement ping for tailnet

* Rename to ForceHTTP

* Add external derpmapping

* Expose DERP region names to the API

* Add global option to enable Tailscale networking for web

* Mark DERP flags hidden while testing

* Update DERP map on reconnect

* Add close func to workspace agents

* Fix race condition in upstream dependency

* Fix feature columns race condition

Co-authored-by: Colin Adler <colin1adler@gmail.com>
2022-08-31 20:09:44 -05:00
Spike Curtis 779c446a6e
cli prints license warnings (#3716)
* cli prints license warnings

Signed-off-by: Spike Curtis <spike@coder.com>

* Satisfy the linter

Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
2022-08-29 11:30:06 -07:00
Mathias Fredriksson c8f8c95f6a
feat: Add support for renaming workspaces (#3409)
* feat: Implement workspace renaming

* feat: Add hidden rename command (and data loss warning)

* feat: Implement database.IsUniqueViolation
2022-08-26 12:28:38 +03:00
Spike Curtis 184f0625e1
coder licenses add CLI command (#3632)
* coder licenses add CLI command

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix up lint

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix t.parallel call

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review improvements

Signed-off-by: Spike Curtis <spike@coder.com>

* Lint

Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
2022-08-23 13:55:39 -07:00
Spike Curtis b101a6f3f4
POST license API endpoint (#3570)
* POST license API

Signed-off-by: Spike Curtis <spike@coder.com>

* Support interface{} types in generated Typescript

Signed-off-by: Spike Curtis <spike@coder.com>

* Disable linting on empty interface any

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review updates

Signed-off-by: Spike Curtis <spike@coder.com>

* Enforce unique licenses

Signed-off-by: Spike Curtis <spike@coder.com>

* Renames from code review

Signed-off-by: Spike Curtis <spike@coder.com>

* Code review renames and comments

Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
2022-08-22 15:02:50 -07:00
Spike Curtis acd0cd66f6
coder features list CLI command (#3533)
* AGPL Entitlements API

Signed-off-by: Spike Curtis <spike@coder.com>

* Generate typesGenerated.ts

Signed-off-by: Spike Curtis <spike@coder.com>

* AllFeatures -> FeatureNames

Signed-off-by: Spike Curtis <spike@coder.com>

* Features CLI command

Signed-off-by: Spike Curtis <spike@coder.com>

* Validate columns

Signed-off-by: Spike Curtis <spike@coder.com>

* Tests for features list CLI command

Signed-off-by: Spike Curtis <spike@coder.com>

* Drop empty EntitlementsRequest

Signed-off-by: Spike Curtis <spike@coder.com>

* Fix dump.sql generation

Signed-off-by: Spike Curtis <spike@coder.com>

Signed-off-by: Spike Curtis <spike@coder.com>
2022-08-17 11:26:16 -07:00
Ammar Bandukwala 19fcf60864
ci: add typo detection (#3327)
And fix them.
2022-08-01 09:29:52 -04:00
Dean Sheather df20dd7374
feat: improve coder users show output, add json format (#3176) 2022-07-26 15:47:12 -05:00