Commit Graph

520 Commits

Author SHA1 Message Date
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
Ammar Bandukwala dc3519e973 Support all transitions in build progress bar (#4575)
* Use null types instead of -1 for simplicity

* Fix pgcrypto bug in migration 59

* Add stories

* Fix visual stutter
2022-10-16 23:34:03 -05:00
Ammar Bandukwala e456799f1a Add template build time stats (#4557)
- Expose time in Template pages
- Show progress bar when building a workspace
2022-10-15 20:36:50 +00:00
Colin Adler 7ec88bf841 feat: audit git ssh key regeneration (#4544) 2022-10-14 16:25:46 -05:00
Kira Pilot dd8ebf10db fix: duplicate workspace update entries (#4513)
* fix: duplicate workspace update entries

* remove console log

* attempting to fix tests

* keep diffs with 0 changes

* cleaned up test
2022-10-14 14:39:20 -04:00
Dean Sheather a029817d3d feat: allow suffix after wildcard in wildcard access URL (#4524) 2022-10-14 18:25:11 +00:00
Dean Sheather d898737d6d feat: app sharing (now open source!) (#4378) 2022-10-15 02:46:38 +10:00
Kira Pilot bf0aca35fa fix: ensure deleting workspace creates audit log (#4537)
* fix: ensure deleting workspace creates audit log

* getting rid of comments

* remove whitespace

* pushing failing test

* fixed test
2022-10-14 09:47:38 -04:00
Jon Ayers 4e57b9fbdc fix: allow regular users to push files (#4500)
- As part of merging support for Template RBAC
  and user groups a permission check on reading files
  was relaxed.

  With the addition of admin roles on individual templates, regular
  users are now able to push template versions if they have
  inherited the 'admin' role for a template. In order to do so
  they need to be able to create and read their own files. Since
  collisions on hash in the past were ignored, this means that a regular user
  who pushes a template version with a file hash that collides with
  an existing hash will not be able to read the file (since it belongs to
  another user).

  This commit fixes the underlying problem which was that
  the files table had a primary key on the 'hash' column.
  This was not a problem at the time because only template
  admins and other users with similar elevated roles were
  able to read all files regardless of ownership. To fix this
  a new column and primary key 'id' has been introduced to the files
  table. The unique constraint has been updated to be hash+created_by.
  Tables (provisioner_jobs) that referenced files.hash have been updated
  to reference files.id. Relevant API endpoints have also been updated.
2022-10-13 18:02:52 -05:00
Colin Adler a55186cd02 fix(database): remove usage of String() for comparing UUIDs (#4547) 2022-10-13 22:38:30 +00:00
Garrett Delfosse 459ee4e66a feat: add pagination to getWorkspaces (#4521) 2022-10-13 12:41:13 -04:00
Kyle Carberry 574e5d37c7 fix: Remove case sensitivity check in OIDC email domain (#4534)
Fixes #4533.
2022-10-13 15:51:54 +00:00
Kyle Carberry 0d0ea981da fix: Filter by deleted when querying workspaces (#4512)
Fixes #4508.
2022-10-12 14:53:03 -05:00
Jon Ayers 0fa8f528c2 chore: change view perm to use (#4496) 2022-10-12 14:33:21 -05:00
Jon Ayers 47805643f7 fix: allow user admins to manage groups (#4498) 2022-10-12 14:33:03 -05:00
Presley Pizzo 62357084ba feat: filter for running workspaces (#4157)
* Refactor workspaces xservice

* Remove layout comment

* Format

* Add comments

* Add running workspaces filter to frontend

* Start on backend - add status to filter

* Update sql and add test - wip

* Attempt to unconvert status for easier querying

* Fix syntax

* Join jobs table, untested

* sql

* Add Status to GetAuthorizedWorkspaces

* Update job tests to have canceled time

* fmt

* add status filter to database fake

Co-authored-by: Colin Adler <colin1adler@gmail.com>
2022-10-11 13:50:41 -04: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
Dean Sheather b1a095e486 feat: show listening ports in port forward popup (#4389)
* feat: show listening ports in port forward popup

* Move fetch logic to a machine

* feat: don't show  app ports and common non-HTTP ports

Co-authored-by: Bruno Quaresma <bruno@coder.com>
2022-10-12 01:10:02 +10:00
Jon Ayers 3120c94c22 feat: add template RBAC/groups (#4235) 2022-10-10 15:37:06 -05:00
Garrett Delfosse b1faaef482 feat: deployment flags (#4426) 2022-10-10 15:04:15 -04:00
Kyle Carberry daa34cf7b8 fix: Return deleted users when fetching workspace builds (#4441)
Fixes #4359.
2022-10-10 18:03:54 +00:00
Ammar Bandukwala eefc26c108 Hide build logs older than 30 days (#4436) 2022-10-09 20:01:18 +00:00
Mathias Fredriksson adcf8838d2 fix: Ensure GitHub OAuth2 users are active in organization (#4416) 2022-10-07 19:53:58 +03:00
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
Garrett Delfosse 32bb1e7ce9 fix: add back missing postAPIKey route (#4406) 2022-10-06 17:56:43 -04:00
Garrett Delfosse f5df54831a feat: tokens (#4380) 2022-10-06 19:02:27 +00:00
Dean Sheather 3b15f13ae4 fix: fix apps being unavailable until rebuild (#4395) 2022-10-06 10:23:55 -05:00
Dean Sheather 1386465631 feat: add endpoint to get listening ports in agent (#4260) 2022-10-06 22:38:22 +10:00
Dean Sheather 2a66395fb7 feat: use app wildcards for apps if configured (#4263)
* feat: use app wildcards for apps if configured

* feat: relative_path -> subdomain

- rename relative_path -> subdomain when referring to apps
    - migrate workspace_apps.relative_path to workspace_apps.subdomain
- upgrade coder/coder terraform module to 0.5.0
2022-10-05 19:23:01 +00:00
Kyle Carberry 8940ea179e fix: Always set DisconnectedAt if the agent isn't connected (#4328)
Fixes #4315.
2022-10-05 00:28:47 +00:00
Steven Masley 587017665a feat: Also log out of apps if they are hosted on the same domain (#4334)
* feat: Also log out of apps if they are hosted on the same domain

* Update comment
2022-10-04 19:01:16 -04:00
Kyle Carberry f2952000d9 fix: Ensure WebSockets routinely transfer data (#4367)
Fixes #4351.
2022-10-04 17:10:58 -05:00
Garrett Delfosse ffbaa93722 feat: add experimental flag (#4364) 2022-10-04 19:45:00 +00:00
Dean Sheather d165d76338 feat: static error page in applications handlers (#4299) 2022-10-05 02:30:55 +10:00
Steven Masley cd4ab97efa feat: Convert rego queries into SQL clauses (#4225)
* feat: Convert rego queries into SQL clauses

* Fix postgres quotes to single quotes

* Ensure all test cases can compile into SQL clauses

* Do not export extra types

* Add custom query with rbac filter

* First draft of a custom authorized db call

* Add comments + tests

* Support better regex style matching for variables

* Handle jsonb arrays

* Remove auth call on workspaces

* Fix PG endpoints test

* Match psql implementation

* Add some comments

* Remove unused argument

* Add query name for tracking

* Handle nested types

This solves it without proper types in our AST.
Might bite the bullet and implement some better types

* Add comment

* Renaming function call to GetAuthorizedWorkspaces
2022-10-04 11:35:33 -04:00
Bruno Quaresma bf63cc929a fix: Fix audit search query (#4352) 2022-10-03 20:56:54 -03:00
Garrett Delfosse 738a38d71f chore: remove resources calls (#4344) 2022-10-03 21:01:13 +00:00
Kyle Carberry 9bc0d06aa0 fix: Install Terraform once and only log >=500 (#4339)
Fixes #4302.
2022-10-03 15:19:02 -05:00
Bruno Quaresma 15d7b78527 fix: Handle invalid resource types and actions (#4341)
* fix: Handle invalid resource types and actions

* Return all values if invalid

* Use types
2022-10-03 15:29:01 -03:00
Steven Masley 0a95ba62b1 chore: Deprecate old cookie value (#4336)
Older clis will need to be updated.
Modern clis cannot communicate with <8.15 coderd
2022-10-03 13:04:22 -04:00
Kyle Carberry df2649ed2a fix: Test flake in TestWorkspaceStatus (#4333)
This also changes the status to be on the workspace build, since
that's where the true value is calculated. This exposed a bug where
jobs could never enter the canceled state unless fetched by a
provisioner daemon, which was nice to fix!

See: https://github.com/coder/coder/actions/runs/3175304200/jobs/5173479506
2022-10-03 11:43:11 -05:00
Steven Masley d11d83cc98 chore: Template-admin cannot create/update/delete workspaces (#4329)
This perm was changed to only be able to read workspaces
2022-10-03 11:20:13 -05:00
Steven Masley 4919975f13 chore: Remove template-admin can create/update/delete workspaces (#4280)
Cannot crud someone else's workspace
2022-10-02 18:54:57 -04:00
Garrett Delfosse 139bc6f58b chore: derive workspace status on backend (#4284) 2022-09-30 17:36:21 -04:00
Steven Masley d8008de77a chore: Optimize Filter() for small lists (#4282) 2022-09-30 15:55:08 -04:00
Garrett Delfosse 69c73b2d28 feat: workspace quotas (#4184) 2022-09-30 14:01:20 -04:00
Ammar Bandukwala 4b540b7c42 docs: simplify Docker quickstart (#4257) 2022-09-29 17:55:15 -05:00
Steven Masley 028a4edbd4 chore: Add flusher to make implement http.Flusher interface (#4255) 2022-09-29 01:16:11 +00:00
Colin Adler 6d2b7ea3ba fix(audit): only generate diff on request success (#4253) 2022-09-28 17:28:33 -05:00