Commit Graph

179 Commits

Author SHA1 Message Date
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
3cb2d52a08 fix: issue with token auth (#4483) 2022-10-11 15:58:28 +00:00
a70278e0e1 feat: make flags in one place (#4452) 2022-10-11 15:16:19 +00:00
b1faaef482 feat: deployment flags (#4426) 2022-10-10 15:04:15 -04:00
f5df54831a feat: tokens (#4380) 2022-10-06 19:02:27 +00:00
ffbaa93722 feat: add experimental flag (#4364) 2022-10-04 19:45:00 +00:00
2ca7214259 fix: Produce unknown subcommand errors for bad command names (#4089)
Fixes #1616
2022-09-20 15:31:38 +03:00
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
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
d499416024 housekeeping(branding): be consistent (#4075) 2022-09-19 09:57:18 +10:00
a2098254cd feat: Support --header for CLI commands to support proxies (#4008)
Fixes #3527.
2022-09-12 16:22:05 -05:00
bb4a681833 fix: don't check buildinfo or entitlements in agent (#3956) 2022-09-08 23:59:28 +10:00
1254e7a902 feat: Add speedtest command for tailnet (#3874) 2022-09-05 17:15:49 -05:00
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
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
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
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
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
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
19fcf60864 ci: add typo detection (#3327)
And fix them.
2022-08-01 09:29:52 -04:00
df20dd7374 feat: improve coder users show output, add json format (#3176) 2022-07-26 15:47:12 -05:00
d1d89210b8 fix: Disable telemetry by default in tests (#3200)
I also noticed we don't have `goleak` enabled for CLI tests, this commit
adds it, but commented out. The reason being that we're nowhere near
being able to enable it yet.

Co-authored-by: Cian Johnston <cian@coder.com>
2022-07-26 16:27:48 +03:00
e01905821f fix: avoid emitting version warning when connection error encountered (#3082) 2022-07-21 14:28:24 -05:00
62e685669f feat: add verbose error messaging (#3053) 2022-07-20 15:17:51 -05:00
59facdd8dc fix: Show schedule commands in help, improve template (#2923)
* fix: Show schedule commands in help, improve template

* chore: Remove schedule long help, fixed by listing missing commands

* chore: Clean up annotation usage with template function

* fix: Drive-by fix for trailing whitespace for flags

Introduced in c7681370b5.
2022-07-12 23:24:53 +03:00
749694b7de fix: Standardize and wrap example descriptions at 80 chars (#2894) 2022-07-11 19:08:09 +03:00
c7681370b5 fix: Wrap help flags at 100 chars (#2893)
Because the actual flags take quite a bit of space, wrapping at 80
characters creates a very cramped output for e.g. `coder server`, for
this reasons, flags are wrapped at 100 chars (vs. standard 80).

The `Consumes $ENV_FLAG` message was put on a newline for consistency,
this should allow users to learn where to look for the informations.

Side note: we should perhaps stop adding period (`.`) at the end of flag
descriptions to be consistent, for instance, command helps usually don't
have one.

This change fixes the biggest issue in #2363, but not all `--help`
output is guaranteed (yet) to wrap at 80-100 chars.

Fixes #2363
2022-07-11 17:07:25 +03:00
6ad0f31687 fix: don't check version on gitssh cmds (#2757) 2022-06-30 12:03:41 -05:00
7df5827767 feat: add version checking to CLI (#2725) 2022-06-29 17:49:40 -05:00
2b6dcb842d Revert "feat: add version checking to CLI" (#2712) 2022-06-29 02:42:23 +00:00
7ee7be3391 feat: add version checking to CLI (#2643)
* feat: add version checking to CLI
2022-06-28 20:55:34 -05:00
f41b50a253 feat: Updating workspace prompts new parameters (#2598) 2022-06-27 16:19:10 +00:00
d1c69866e8 fix: provide environment variable for CLI session token (#2648) 2022-06-24 18:50:35 -05:00
05b67ab1cf feat: peer wireguard (#2445) 2022-06-24 10:25:01 -05:00
c9691eafcb feat: cli: consolidate schedule-related commands (#2402)
* feat: cli: consolidate schedule-related commands

This commit makes the following changes:
- renames autostart -> schedule starat
- renames ttl -> schedule stop
- renames bump -> schedule override
- adds schedule show command
- moves some cli-related stuff to util.go
2022-06-16 18:24:10 +01:00
75205f5978 feat: Implement parameters list + more template list columns (#2359)
* feat: Implement parameters list

- Allow more columns on template list

* Hide param list by default for now
2022-06-15 18:21:01 -05:00
ccd061652b feat: Add built-in PostgreSQL for simple production setup (#2345)
* feat: Add built-in PostgreSQL for simple production setup

Fixes #2321.

* Use fork of embedded-postgres for cache path
2022-06-15 16:02:18 -05:00
6bee180bb3 fix: Sort workspace by name by created_at (#2214)
* fix: Sort workspace by name by created_at

Fix bug where deleting workspaces with the same name returns the
oldest deleted workspace
2022-06-10 09:58:42 -05:00
3bc122b7d5 feat: added include_deleted to getWorkspaceByOwnerAndName (#2164)
* feat: added include_deleted

relates to #1955

* Update coderd/workspaces.go

defining vars in the scope of conditional

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

* Update coderd/workspaces.go

avoid newline

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

* Update coderd/workspaces.go

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

* PR feedback

* wrote test, added type

* Update coderd/workspaces_test.go

shortening test name

Co-authored-by: Cian Johnston <cian@coder.com>

* taking out api.ts change for now

* casing

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
Co-authored-by: Cian Johnston <cian@coder.com>
2022-06-08 14:04:05 -04:00
b65259f95e feat: Refactor CLI config-ssh to improve UX (#1900)
- Magic block is replaced by Include statement
- Writes are only done on changes
- Inform user of changes via prompt
- Allow displaying changes via `--diff`
- Remove magic block if present
- Safer config writing via tmp-file + rename
- Parse previous `config-ssh` options, compare to new options and ask to use new (otherwise old ones are used)
- Tests the new functionality

Fixes #1326
2022-06-08 11:45:29 +03:00
e2b2580196 chore: version sub command remove --version and -v flag (#2090)
* test: Add unit test for version cmd
2022-06-06 17:38:51 -05:00
43f622a52d fix: Remove unused workspace routes in favor of list with filter (#2038)
* fix: Remove unused workspace routes in favor of list with filter

This consolidates the workspace routes into a single place.
It allows users to fetch a workspace by their username and
workspace name, which will be used by the frontend for routing.

* Fix RBAC

* Fix CLI usages
2022-06-03 14:36:08 -05:00
582d636e54 feat: support fully-qualified workspace names in CLI (#2036) 2022-06-03 12:47:56 -05:00
ff542afe87 feat: allow bumping workspace deadline (#1828)
* Adds a `bump` command to extend workspace build deadline
 * Reduces WARN-level logging spam from autobuild executor
 * Modifies `cli/ssh` notifications to read from workspace build deadline and to notify relative time instead (sidestepping the problem of figuring out a user's timezone across multiple OSes)
 * Shows workspace extension time in `coder list` output e.g.
    ```
    WORKSPACE        TEMPLATE  STATUS   LAST BUILT  OUTDATED  AUTOSTART        TTL        
    developer/test1  docker    Running  4m          false     0 9 * * MON-FRI  15m (+5m)  
    ```
2022-05-27 20:04:33 +01:00
35ccb88f60 feat: add dotfiles command (#1723) 2022-05-25 16:43:20 -05:00
7ba6449054 Improve CLI logout flow (#1692)
* Improve CLI logout flow

* Fix lint error

* Make notLoggedInMessage a const

* successful logout with a msg when cfg files are absent

* use require, os.remove, show only one message, add prompt
2022-05-24 13:11:01 -04:00
4a78bade6d bug: Cleaner error message for non logged-in users (#1670)
* add helper text to unauthorized error messages

* fix lint error, add unit tests

* fix test name

* fix test name

* fix lint errors in test

* add unauthorized test for templates create

* remove unnecessary variable

* remove Error struct, change error message

* change [url] to <url>
2022-05-23 14:51:49 -04:00
873ae90f39 feat: cli configs should not be space sensitive (#1668) 2022-05-23 12:19:33 -05:00
992b58389b fix: Use the cobra CommandPath for usage to avoid duplication (#1617) 2022-05-20 12:42:56 +03:00
077f16ce2c feat: add coder logout command (#1609) 2022-05-19 22:42:32 +00:00