1262eef2c0
feat: add support for coder_script
( #9584 )
...
* Add basic migrations
* Improve schema
* Refactor agent scripts into it's own package
* Support legacy start and stop script format
* Pipe the scripts!
* Finish the piping
* Fix context usage
* It works!
* Fix sql query
* Fix SQL query
* Rename `LogSourceID` -> `SourceID`
* Fix the FE
* fmt
* Rename migrations
* Fix log tests
* Fix lint err
* Fix gen
* Fix story type
* Rename source to script
* Fix schema jank
* Uncomment test
* Rename proto to TimeoutSeconds
* Fix comments
* Fix comments
* Fix legacy endpoint without specified log_source
* Fix non-blocking by default in agent
* Fix resources tests
* Fix dbfake
* Fix resources
* Fix linting I think
* Add fixtures
* fmt
* Fix startup script behavior
* Fix comments
* Fix context
* Fix cancel
* Fix SQL tests
* Fix e2e tests
* Interrupt on Windows
* Fix agent leaking script process
* Fix migrations
* Fix stories
* Fix duplicate logs appearing
* Gen
* Fix log location
* Fix tests
* Fix tests
* Fix log output
* Show display name in output
* Fix print
* Return timeout on start context
* Gen
* Fix fixture
* Fix the agent status
* Fix startup timeout msg
* Fix command using shared context
* Fix timeout draining
* Change signal type
* Add deterministic colors to startup script logs
---------
Co-authored-by: Muhammad Atif Ali <atif@coder.com >
2023-09-25 16:47:17 -05:00
8d8402da00
fix(coderd/database): avoid clobbering workspace build state ( #9826 )
...
Fixes #9823 .
- Decomposes UpdateWorkspaceBuildByID into UpdateWorkspaceBuildProvisionerStateByID and UpdateWorkspaceBuildDeadlineByID.
- Replaces existing invocations of UpdateWorkspaceBuildByID with the newer queries where applicable.
- Modifies GetActiveWorkspaceBuildsByTemplateID to not return incomplete workspace builds.
2023-09-22 16:22:07 +01:00
c900b5f8df
feat: add single tailnet support to pgcoord ( #9351 )
2023-09-21 14:30:48 -05:00
b0e3daa120
feat(coderd): support weekly aggregated insights ( #9684 )
2023-09-19 13:06:19 +02:00
375c70d141
feat: integrate Acquirer for provisioner jobs ( #9717 )
...
* chore: add Acquirer to provisionerdserver pkg
Signed-off-by: Spike Curtis <spike@coder.com >
* code review improvements & fixes
Signed-off-by: Spike Curtis <spike@coder.com >
* feat: integrate Acquirer for provisioner jobs
Signed-off-by: Spike Curtis <spike@coder.com >
* Fix imports, whitespace
Signed-off-by: Spike Curtis <spike@coder.com >
* provisionerdserver always closes; remove poll interval from playwright
Signed-off-by: Spike Curtis <spike@coder.com >
* post jobs outside transactions
Signed-off-by: Spike Curtis <spike@coder.com >
* graceful shutdown in test
Signed-off-by: Spike Curtis <spike@coder.com >
* Mark AcquireJob deprecated
Signed-off-by: Spike Curtis <spike@coder.com >
* Graceful shutdown on all provisionerd tests
Signed-off-by: Spike Curtis <spike@coder.com >
* Deprecate, not remove CLI flags
Signed-off-by: Spike Curtis <spike@coder.com >
---------
Signed-off-by: Spike Curtis <spike@coder.com >
2023-09-19 10:25:57 +04:00
aa8652c928
fix(dbtestutil): avoid truncating inserts that span multiple lines ( #9756 )
2023-09-18 19:46:22 +00:00
1df7589105
feat(coderd/database/dbtestutil): add ability to dump database on failure ( #9704 )
...
Adds dbtestutil.DumpOnFailure() to allow dumping the entire test database contents upon test failure.
This does nothing for dbfake currently.
2023-09-18 11:50:15 +01:00
9bcff30dee
fix(coderd/database): migrate workspaces.last_used_at to timestamptz ( #9699 )
2023-09-18 11:07:54 +01:00
72dff7f188
fix(enterprise/dbcrypt): do not skip deleted users when encrypting or deleting ( #9694 )
...
- Broadens scope of data generation in TestServerDBCrypt over all user login types, statuses, and deletion status.
- Adds support for specifying user status / user deletion status in dbgen
- Adds more comprehensive logging in TestServerDBCrypt upon test failure (to be generalized and expanded upon in a follow-up)
- Adds AllUserIDs query, updates dbcrypt to use this instead of GetUsers.
2023-09-15 15:09:40 +01:00
d0d64bbdca
refactor: define insights interval ( #9693 )
2023-09-15 12:01:00 +00:00
65db7a71b7
feat(coderd/database/dbtestutil): set default database timezone to non-UTC in unit tests ( #9672 )
...
- Adds dbtestutil.WithTimezone(tz) to allow setting the timezone for a test database.
- Modifies our test database setup code to pick a consistently weird timezone for the database.
- Adds the facility randtz.Name() to pick a random timezone which is consistent across subtests (via sync.Once).
- Adds a linter rule to warn against setting the test database timezone to UTC.
2023-09-15 09:01:32 +01:00
8b6e2862fd
refactor(coderd): collapse activityBumpWorkspace into a single query ( #9652 )
...
* Adds unit-style tests for activityBumpWorkspace
* Ports logic of activityBumpWorkspace to a SQL query
* Updates activityBumpWorkspace to call above query
2023-09-14 09:09:51 +01:00
2ac532982d
feat(coderd/database): generate foreign key constraints and add database.IsForeignKeyViolation ( #9657 )
...
* feat(coderd/database): generate foreign key constraints, add database.IsForeignKeyViolation
* address PR comments
2023-09-13 13:28:46 +01:00
7918e65510
feat(coderd): add dbcrypt package ( #9522 )
...
- Adds package enterprise/dbcrypt to implement database encryption/decryption
- Adds table dbcrypt_keys and associated queries
- Adds columns oauth_access_token_key_id and oauth_refresh_token_key_id
to tables git_auth_links and user_links
Co-authored-by: Kyle Carberry <kyle@coder.com >
2023-09-06 12:06:26 +01:00
76ab22f539
chore(coderd/database): introduce compile-time guard against import in slim build ( #9521 )
...
This change introduces a compile-time error when `coderd/database` is
imported into the slim build. This is to guard against accidentally
growing the binary size via import.
Ref: #9380
2023-09-04 19:01:11 +00:00
6fc1f5276d
refactor(coderd/httpapi): remove database, dbauthz and rbac imports ( #9481 )
...
Ref: #9380
2023-09-04 19:39:14 +03:00
19d7da3d24
refactor(coderd/database): split Time
and Now
into dbtime
package ( #9482 )
...
Ref: #9380
2023-09-01 16:50:12 +00:00
5d7a77911e
fix: use getProvisionerJobByIDNoLock ( #9484 )
2023-09-01 13:21:18 +00:00
1de61246a3
feat: add experimental template autostop requirement template settings UI ( #9417 )
2023-08-30 20:41:27 +00:00
ee24260614
feat: allow configuring display apps from template ( #9100 )
2023-08-30 14:53:42 -05:00
a572800d47
chore: rename template restart requirement to autostop requirement ( #9295 )
2023-08-29 18:35:05 +00:00
6ba92ef924
ci: enable gocognit ( #9359 )
...
And, bring the server under 300:
* Removed the undocumented "disable" STUN address in favor of the
--disable-direct flag.
2023-08-27 14:46:44 -05:00
7f14b50dbe
chore: rename locked to dormant ( #9290 )
...
* chore: rename locked to dormant
- The following columns have been updated:
- workspace.locked_at -> dormant_at
- template.inactivity_ttl -> time_til_dormant
- template.locked_ttl -> time_til_dormant_autodelete
This change has also been reflected in the SDK.
A route has also been updated from /workspaces/<id>/lock to /workspaces/<id>/dormant
2023-08-24 13:25:54 -05:00
af939d1e94
fix(coderd): optimize template app insights query for speed and decrease intervals ( #9302 )
2023-08-24 14:34:38 +00:00
04d5e3f54f
fix(coderd): rewrite template insights query for speed and fix intervals ( #9300 )
2023-08-24 14:38:32 +03:00
d00817ea4a
perf(coderd): simplify insights queries to speed them up ( #9299 )
2023-08-24 10:52:20 +00:00
6b69abfec7
fix(coderd): use stable sorting for insights and improve test coverage ( #9250 )
...
Fixes #9213
2023-08-24 13:36:40 +03:00
707a0a2d95
fix: resolve deadlock when fetching everyone group for in-memory db ( #9277 )
2023-08-23 16:54:16 +00:00
6e41cd1eda
feat: add activity bumping to template scheduling ( #9040 )
2023-08-22 15:15:13 -05:00
37a3b42c55
feat: add last_used search params to workspaces ( #9230 )
...
* feat: add last_used search params to workspaces
2023-08-22 08:41:58 -05:00
b2ca3ebaa3
fix: add workspace_proxy type to auditlog friendly strings ( #9194 )
...
* fix: add workspace_proxy type to auditlog friendly strings
* add unit test and organization type
2023-08-21 10:53:41 -05:00
5d4a17717f
refactor(coderd): fetch owner information when authorizing workspace agent ( #9123 )
...
* Refactors the existing httpmw tests to use dbtestutil so that we can test them against a real database if desired,
* Modifies the GetWorkspaceAgentByAuthToken to return the owner and associated roles, removing the need for additional queries
2023-08-21 15:49:26 +01:00
03453b1e02
feat(coderd): add template app usage to insights ( #9138 )
...
Fixes #8658
2023-08-21 15:08:58 +03:00
22e781eced
chore: add /v2 to import module path ( #9072 )
...
* chore: add /v2 to import module path
go mod requires semantic versioning with versions greater than 1.x
This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```
Migrate generated files to import /v2
* Fix gen
2023-08-18 18:55:43 +00:00
2f6687a475
feat: expose Everyone group through UI ( #9117 )
...
- Allows setting quota allowances on the 'Everyone' group.
2023-08-17 13:25:16 -05:00
6fd9975aed
feat(coderd): add coder_app
usage stats ( #9001 )
...
Updates #8658
2023-08-16 15:22:00 +03:00
6cdf1c73c0
chore: update sqlc to version 1.20.0 ( #9111 )
2023-08-15 20:06:03 +00:00
47b8bf6585
feat: update workspace deadline when template policy changes ( #8964 )
2023-08-14 21:16:47 +00:00
bc862fa493
chore: upgrade tailscale to v1.46.1 ( #8913 )
2023-08-09 19:50:26 +00:00
00a8221e51
fix: rename duplicate migration ( #8989 )
2023-08-09 05:49:13 +00:00
07fd73c4a0
chore: allow multiple agent subsystems, add exectrace ( #8933 )
2023-08-08 22:10:28 -07:00
f4122fa9f5
feat: add auto group create from OIDC ( #8884 )
...
* add flag for auto create groups
* fixup! add flag for auto create groups
* sync missing groups
Also added a regex filter to filter out groups that are not
important
2023-08-08 11:37:49 -05:00
e8627195a2
feat(coderd): expose parameter description and type ( #8944 )
2023-08-07 16:11:44 +00:00
9fb18f3ae5
feat(coderd): batch agent stats inserts ( #8875 )
...
This PR adds support for batching inserts to the workspace_agents_stats table.
Up to 1024 stats are batched, and flushed every second in a batch.
2023-08-04 17:00:42 +01:00
e43608395c
feat: add frontend for locked workspaces ( #8655 )
...
- Fix workspaces query for locked workspaces.
2023-08-03 19:46:02 -05:00
d3991fac26
feat(coderd): add parameter insights to template insights ( #8656 )
2023-08-03 14:43:23 +00:00
eddd4f8888
chore: fix dupliate migration round 2 ( #8867 )
2023-08-02 16:28:30 +00:00
4c1e63aae8
feat: add display_name field to groups ( #8740 )
...
* feat: add display_name field to groups
This is a non-unique human friendly group name for display
purposes. This means a display name can be used instead of
using an environment var to remap groups with OIDC names to
Coder names. Now groups can retain the OIDC name for mapping,
and use a display name for display purposes.
2023-08-02 10:53:06 -05:00
e482d39052
chore: fix duplicate migration ( #8866 )
2023-08-02 15:09:10 +00:00
cd1e088f7c
feat: add --derp-only flag to wsproxy ( #8850 )
2023-08-03 00:35:06 +10:00