Commit Graph

196 Commits

Author SHA1 Message Date
159137dc10 fix: Use stdin/out defined in command (#3199) 2022-07-26 17:23:32 +03: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
fd4954b4e5 fix: Use membership endpoint to ensure user exists in team (#3129)
This was using the incorrect GitHub endpoint prior, which fetched a team
by slug. Any user in a GitHub organization can view all teams, so this
didn't block signups like intended.

I've verified this API returns an error when the calling user is not a
member  of the team requested.

Fixes #3105.
2022-07-22 13:54:08 -05:00
1033e02d79 feat: add coder server postgres-builtin-serve to run the built-in DB (#2997) 2022-07-14 21:51:44 +00:00
8b76e40629 fix: Fetch GitHub teams by name for performance (#2955)
In large organizations with thousands of teams, looping took >5s.
This fetches organizations by team name, which should be very fast!
2022-07-13 00:45:43 +00:00
5ee112bc00 fix: Fetch all GitHub teams on login (#2951)
This wasn't looping prior, so organizations with >100 teams
couldn't login. Contributes to #2848.
2022-07-12 23:06:27 +00:00
dff6e97f83 feat: Add allowlist of GitHub teams for OAuth (#2849)
Fixes #2848.
2022-07-08 21:37:18 -05:00
c6b1daabc5 feat: Download default terraform version when minor version mismatches (#1775) 2022-06-22 23:11:52 +00:00
e2785ada5e feat: Compress and extract slim binaries with zstd (#2533)
Fixes #2202

Co-authored-by: Dean Sheather <dean@deansheather.com>
2022-06-21 19:53:36 +03:00
7cce7a9c69 test: Write URL after signal listen to fix flake (#2456)
The URL could be read before the signal was listening, causing
this test to flake: https://github.com/coder/coder/runs/6936820170?check_suite_focus=true
2022-06-17 14:16:45 +00:00
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
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
024ab6df57 fix: Use in-memory filesystem for echo provisioner tests (#2408)
* fix: Use in-memory filesystem for echo provisioner tests

This should reduce IO in CI to shave some time off tests!

* test: Increase timeouts to reduce flakes

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 15:09:22 +00: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
6cf483bf37 fix: allow server startup without tunnel (#2380)
- Previously, specifying 'no' to the tunnel prompt just killed
  the process. It should be possible to start the server without
  a tunnel and not have the process killed.
2022-06-15 12:54:01 -05:00
f562b74fa1 feat: use custom wireguard reverse proxy for dev tunnel (#1975) 2022-06-10 13:38:11 -05:00
71fd19631a feat: Warn on coderd startup if access URL is localhost (#2248) 2022-06-10 13:35:51 -05:00
0260e39d11 fix: Accept CODER_CACHE_DIRECTORY with CACHE_DIRECTORY fallback (#2236)
Fixes #2199
2022-06-10 17:00:00 +03: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
7b40c692eb fix: coderd: dev mode should show verbose output by default (#1898)
* check buildinfo for devel prerelease tag and show verbose output if so
2022-06-01 11:00:42 +01:00
8a5277e291 fix: restore previous session on coder server --dev (#1821) 2022-05-27 17:02:02 +00:00
31b819e83f chore: Remove interface from coderd and lift API surface (#1772)
Abstracting coderd into an interface added misdirection because
the interface was never intended to be fulfilled outside of a single
implementation.

This lifts the abstraction, and attaches all handlers to a root struct
named `*coderd.API`.
2022-05-26 03:14:08 +00:00
0effb71f43 feat: add tracing for sql (#1610) 2022-05-20 10:51:06 -05:00
52230fab56 feat: make default autobuild poll intervals configurable (#1618)
* feat: make default poll intervals for autobuild and ssh ttl polling configurable
2022-05-20 10:57:02 +00:00
d1817310a1 fix build and lint (#1613)
Signed-off-by: Spike Curtis <spike@coder.com>
2022-05-19 23:28:29 +00:00
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
376c6819e0 feat: Move from datadog to generic otel (#1567) 2022-05-19 17:43:07 -05:00
6c1117094d chore: Force codersdk to not import anything from database (#1576)
* chore: Force codersdk to not import anything from database (linter rule)
* chore: Move all database types in codersdk out
2022-05-19 13:04:44 -05:00
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
f4da5d4f3a feat: add lifecycle.Executor to manage autostart and autostop (#1183)
This PR adds a package lifecycle and an Executor implementation that attempts to schedule a build of workspaces with autostart configured.

- lifecycle.Executor takes a chan time.Time in its constructor (e.g. time.Tick(time.Minute))
- Whenever a value is received from this channel, it executes one iteration of looping through the workspaces and triggering lifecycle operations.
- When the context passed to the executor is Done, it exits.
- Only workspaces that meet the following criteria will have a lifecycle operation applied to them:
  - Workspace has a valid and non-empty autostart or autostop schedule (either)
  - Workspace's last build was successful
- The following transitions will be applied depending on the current workspace state:
  - If the workspace is currently running, it will be stopped.
  - If the workspace is currently stopped, it will be started.
  - Otherwise, nothing will be done.
- Workspace builds will be created with the same parameters and template version as the last successful build (for example, template version)
2022-05-11 23:03:02 +01:00
e6f1ce1fb2 fix: Allow coderd to exit on error channel (#1355)
coderd would fail silently if this was called, because connections
would never drain. HashiCorp's hc-install package broke today,
and we couldn't notice because this was hanging!
2022-05-10 02:19:20 +00:00
ddb9631d7a fix: Group subcommands for cognitive ease (#1351) 2022-05-09 17:42:02 -05:00
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
9d2e788fea feat: allow verbose logging in coder server (#1280) 2022-05-03 16:13:30 -05:00
0f9e30e54f fix: use correct enable bool for pprof (#1279) 2022-05-03 19:54:10 +00:00
55ad97bbd7 feat: add pprof and prometheus metrics to coder server (#1266) 2022-05-03 12:48:02 +00:00
a79aa6418a fix: Use cliui.WorkspaceBuild to prevent cancel of builds jobs (#1255)
Build jobs cannot gracefully terminate because Terraform generally
cannot gracefully terminate.
2022-05-02 10:20:47 -05:00
9b37a0de31 fix: Disable ErrorLog in http.Server (#1244)
Vault does similarly: e2490059d0/command/server.go (L2714)

These messages have primarily been noise.
2022-05-01 20:31:12 -05:00
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
8661f92a10 feat: Output username and password for code server --dev (#1193)
Fixes #825
2022-04-27 17:59:37 +03:00
f9ce54a51e fix: Increase default provisioner daemons to 3 (#1180)
It's odd to only build one workspace at a time as a default.
2022-04-26 07:19:17 -05:00
877854a2f3 fix: Display proper access URL on server start (#1172)
Fixes #1170.
2022-04-25 23:30:22 +00:00
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
4417dd5951 feat: Add STUN servers to enable P2P (#1126)
This exposes a `--stun-server` option for listing
STUN servers. By default it uses the Google STUN
server, but this is not required.
2022-04-25 04:52:07 +00:00
7496c3da81 feat: Add GitHub OAuth (#1050)
* Initial oauth

* Add Github authentication

* Add AuthMethods endpoint

* Add frontend

* Rename basic authentication to password

* Add flags for configuring GitHub auth

* Remove name from API keys

* Fix authmethods in test

* Add stories and display auth methods error
2022-04-23 22:58:57 +00:00
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