Commit Graph

37 Commits

Author SHA1 Message Date
Kyle Carberry 3cc77d96eb
feat: Add tunnel by default (#4399)
* feat: Add tunnel by default

If an access URL is not specified, we will always tunnel.

This is from community-member feedback who exclaimed that
it's confusing having the default for `coder server` display
a warning message, and I agree.

There is very little (maybe none) in running `coder server`
without tunnel and without an access URL, so this seems like
overall a much better UX.

* Update install.sh

Co-authored-by: Ben Potter <ben@coder.com>

* Update docs/install/packages.md

Co-authored-by: Ben Potter <ben@coder.com>

* Fix reset pass test

* Fix e2e test

Co-authored-by: Ben Potter <ben@coder.com>
2022-10-07 08:05:56 -05:00
Dean Sheather 6325a9ea91
feat: support multiple certificates in coder server and helm (#4150) 2022-10-04 21:45:21 +10:00
Colin Adler 5e2efb68f1
feat: add SCIM provisioning via Okta (#4132)
Co-authored-by: Ben Potter <ben@coder.com>
2022-09-20 15:16:26 -05:00
Colin Adler 8d7954b015
fix: ignore context canceled error on server (#4128) 2022-09-19 23:56:51 -05:00
Kyle Carberry e847e7386a
fix: Resolve flake in TestPortForward (#4069) 2022-09-14 20:21:53 -05:00
Kyle Carberry b0fe9bcdd1
chore: Upgrade to Go 1.19 (#3617)
This is required as part of #3505.
2022-08-21 22:32:53 +00:00
Mathias Fredriksson 95f26f74b6
fix: Close response body in `cli` server test (#3459) 2022-08-10 16:30:46 +00:00
Kyle Carberry f62e1ede77
feat: Add support for GitHub Enterprise authentication (#3422)
This was manually tested with GitHub Enterprise v3.6.0-rc1.
2022-08-08 20:49:51 -05:00
Kyle Carberry 7bdb8ff9cf
feat: Add workspace metrics export to Prometheus (#3421)
This adds workspace totals indexed by status. It could be any
codersdk.ProvisionerJobStatus.
2022-08-09 01:08:42 +00:00
Kyle Carberry 3279504cbe
feat: Add active users prometheus metric (#3406)
This  allows deployments using our Prometheus export t determine
the number of active users in the past hour.

The interval is an hour to align with API key last used refresh times.

SSH connections poll to check shutdown time, so this will be accurate
even on long-running connections without dashboard requests.
2022-08-08 10:09:46 -05:00
Mathias Fredriksson 4730c589fe
chore: Use standardized test timeouts and delays (#3291) 2022-08-01 15:45:05 +03:00
Jon Ayers 8b17bf98ea
fix: prepend scheme to access url (#3317)
- Problems can arise spawning workspaces if a schemeless URL is passed
  as the access URL.

  If an access url is detected to not have an "http" or "https" scheme
  then it is prepended with "https". If the hostname is detected
  to be a loopback device then "http" is preferred.
2022-07-31 17:49:25 -05:00
Mathias Fredriksson d27076cac7
fix: Improve `coder server` shutdown procedure (#3246)
* fix: Improve `coder server` shutdown procedure

This commit improves the `coder server` shutdown procedure so that all
triggers for shutdown do so in a graceful way without skipping any
steps.

We also improve cancellation and shutdown of services by ensuring
resources are cleaned up at the end.

Notable changes:
- We wrap `cmd.Context()` to allow us to control cancellation better
- We attempt graceful shutdown of the http server (`server.Shutdown`)
  because it's less abrupt (compared to `shutdownConns`)
- All exit paths share the same shutdown procedure (except for early
  exit)
- `provisionerd`s are now shutdown concurrently instead of one at a
  time, the also now get a new context for shutdown because
  `cmd.Context()` may be cancelled
- Resources created by `newProvisionerDaemon` are cleaned up
- Lifecycle `Executor` exits its goroutine on context cancellation

Fixes #3245
2022-07-27 18:21:21 +03:00
Mathias Fredriksson 1c04b20fde
fix: Set cache dir for coderd tests (#3160)
* fix: Set cache dir for coderd in codedtest

* fix: Ensure server cli tests have a cache path

To avoid sharing default path.
2022-07-25 19:24:32 +03:00
Mathias Fredriksson 6916d34458
fix: Fix cleanup in test helpers, prefer `defer` in tests (#3113)
* fix: Change uses of t.Cleanup -> defer in test bodies

Mixing t.Cleanup and defer can lead to unexpected order of execution.

* fix: Ensure t.Cleanup is not aborted by require

* chore: Add helper annotations
2022-07-25 19:22:02 +03:00
Mathias Fredriksson 51dd1fde3b
fix: Remove use of `require` in `require.Eventually` in tests (#3110)
* fix: Remove use of `require` in `require.Eventually` in tests

Because require uses `t.FailNow()` and `require.Eventually` runs the
function in a goroutine, which is not allowed.

* feat: Add ruleguard for require.Eventually

Co-authored-by: Cian Johnston <cian@coder.com>
2022-07-22 20:02:49 +03:00
Kyle Carberry 6429dfee1f
test: Use a template to prevent migrations from running for every test (#2462)
* test: Use a template to prevent migrations from running for every test

* Create a single makefile target

* Fix built-in race

* Extend timeout of built-in PostgreSQL fetch
2022-06-27 17:07:39 +00:00
Kyle Carberry dac6838fc3
fix: Await workspace build job before waiting for CLI output (#2670)
This was causing occasional flakes seen here:
https://github.com/coder/coder/runs/7063142245?check_suite_focus=true
2022-06-26 22:05:37 +00:00
Kyle Carberry 437066ce20
fix: Stop sending additional signals in Shutdown test (#2582)
Coder was exiting before the additional signals were handled,
which caused occasional CI failures.
2022-06-22 11:32:34 -05:00
Kyle Carberry fe81b0b859
fix: Wait for TestServer/Telemetry to close before exit (#2554)
This was causing occasional test failures due to leakage!
2022-06-21 19:50:29 +03:00
Kyle Carberry f09ab03baf
fix: Add flag to toggle telemetry (#2455)
* fix: Add flag to toggle telemetry

This allows users to entirely disable tracking from Coder!
Telemetry is enabled by default, so this is opt-out.

* Update cli/server.go

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

Co-authored-by: Mathias Fredriksson <mafredri@gmail.com>
2022-06-17 14:02:44 +00:00
Kyle Carberry 4cce969018
feat: Add anonymized telemetry to report product usage (#2273)
* feat: Add anonymized telemetry to report product usage

This adds a background service to report telemetry to a Coder
server for usage data. There will be realtime event data sent
in the future, but for now usage will report on a CRON.

* Fix flake and requested changes

* Add reporting options for setup

* Add reporting for workspaces

* Add resources as they are reported

* Track API key usage

* Ensure telemetry is tracked prior to exit
2022-06-17 00:26:40 -05:00
Kyle Carberry 5e673cc544
test: Increase timeouts to reduce flakes (#2406)
It's difficult to understand what's timing out due to a lock
vs. taking a long time. This should help resolve! 🕵️
2022-06-16 14:52:45 +00:00
Kyle Carberry 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
David Wahler 71fd19631a
feat: Warn on coderd startup if access URL is localhost (#2248) 2022-06-10 13:35:51 -05:00
Colin Adler 5833e37354
fix: macos flake (#1804)
https://github.com/coder/coder/runs/6614638495?check_suite_focus=true#step:9:104
2022-05-26 15:21:48 -05:00
Cian Johnston c2f74f3cc2
chore: avoid concurrent usage of t.FailNow (#1683)
* chore: golangci: add linter rule to report usage of t.FailNow inside goroutines
* chore: avoid t.FailNow in goroutines to appease the race detector
2022-05-24 08:58:39 +01:00
Mathias Fredriksson c8ed213347
fix: Guard against CLI cmd running after test exit (#1658)
* fix: Guard against CLI cmd running after test exit

* fix: cli: avoid calling t.FailNow in non-test-main goroutine

* fix: cli: server_test: avoid calling t.FailNow outside main goroutine

* fix: cli: clitest_test: avoid calling t.FailNow outside main goroutine

* fix: cli: list_test: avoid calling t.FailNow outside main goroutine

* fix: TestGitSSH use-of-t-after-exit

* fix: TestGitSSH "too many authentication failures"

Due to local SSH keys being given

* chore: clitest: fix TestCli

* chore: Simplify TestTemplateInit

Co-authored-by: Cian Johnston <cian@coder.com>
2022-05-23 20:09:58 +03:00
Spike Curtis 1871b09697
feat: in-process provisionerd connection (#1568)
* in-process provisionerd connection

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

* disable lint for server.go/newProvisionerDaemon

Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-19 17:47:45 -05:00
Garrett Delfosse 376c6819e0
feat: Move from datadog to generic otel (#1567) 2022-05-19 17:43:07 -05:00
Spike Curtis 9f402fa27f
Spike/222 workspace build order (#1534)
* chore: refactor before_id/after_id to build_number

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

* pagination of workspace_builds

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

* Disable parallel on postgres tests

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

* Fix lint

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

* Fix workspace build postgres query

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

* Fix JS tests

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

* Fix workspace builds postgres query

Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-18 16:33:33 +00:00
Kyle Carberry 7b5300d0cc
fix: Improve develop script to start tunnel by default (#1409)
This allows for running the development script to actually
build workspaces!
2022-05-12 12:37:51 -05:00
Spike Curtis ad8d9dd71a
feat: make it harder to skip graceful shutdown accidentally (#1327)
* feat: make it harder to skip graceful shutdown accidentally

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

* fixup: don't use unbuffered signal channel

Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-06 13:45:18 -07:00
Mathias Fredriksson afc43fe95f
feat: Generate random admin user password in dev mode (#1207)
* feat: Generate random admin user password in dev mode

* Add dev mode test with email/pass from env

* Set email/pass for playwright e2e test via cli flags
2022-04-28 19:13:44 +03:00
Mathias Fredriksson 8661f92a10
feat: Output username and password for `code server --dev` (#1193)
Fixes #825
2022-04-27 17:59:37 +03:00
Kyle Carberry 88669fd578
feat: Move workspaces under organizations (#1109)
This removes split ownership for workspaces. They are now
a resource of organizations and have a designated owner,
which is a user.

This enables simple administration for commands like:
- `coder stop ben/dev`
- `coder build logs colin/arch`

or if we decide to allow administrators to access workspaces,
they could even SSH using this syntax: `coder ssh colin/dev`.
2022-04-25 16:11:03 -05:00
Kyle Carberry 3976994781
chore: Rename "start" to "server" (#1110)
Workspace commands will be aliased at the top-level, so
"start" would easily be confused with starting a workspace.

Server seems like a more appropriate name too.
2022-04-23 12:19:20 -05:00
Renamed from cli/start_test.go (Browse further)