Skip to content

Commit 11ed7fd

Browse files
committed
healthcheck url
1 parent a54e7f7 commit 11ed7fd

File tree

15 files changed

+37
-15
lines changed

15 files changed

+37
-15
lines changed

coderd/coderd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func New(options *Options) *API {
415415
r.Use(httpmw.ExtractWorkspaceAgent(options.Database))
416416
r.Get("/metadata", api.workspaceAgentMetadata)
417417
r.Post("/version", api.postWorkspaceAgentVersion)
418-
r.Post("/app-healths", api.postWorkspaceAppHealths)
418+
r.Post("/app-health", api.postWorkspaceAppHealth)
419419
r.Get("/listen", api.workspaceAgentListen)
420420

421421
r.Get("/gitsshkey", api.agentGitSSHKey)

coderd/coderdtest/authtest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
198198
"GET:/api/v2/workspaceagents/me/turn": {NoAuthorize: true},
199199
"GET:/api/v2/workspaceagents/me/coordinate": {NoAuthorize: true},
200200
"POST:/api/v2/workspaceagents/me/version": {NoAuthorize: true},
201-
"POST:/api/v2/workspaceagents/me/app-healths": {NoAuthorize: true},
201+
"POST:/api/v2/workspaceagents/me/app-health": {NoAuthorize: true},
202202
"GET:/api/v2/workspaceagents/me/report-stats": {NoAuthorize: true},
203203
"GET:/api/v2/workspaceagents/{workspaceagent}/iceservers": {NoAuthorize: true},
204204

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,7 @@ func (q *fakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
20282028
Url: arg.Url,
20292029
RelativePath: arg.RelativePath,
20302030
HealthcheckEnabled: arg.HealthcheckEnabled,
2031+
HealthcheckUrl: arg.HealthcheckUrl,
20312032
HealthcheckPeriod: arg.HealthcheckPeriod,
20322033
HealthcheckThreshold: arg.HealthcheckThreshold,
20332034
Health: arg.Health,

coderd/database/dump.sql

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/migrations/000051_workspace_app_health.up.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ CREATE TYPE workspace_app_health AS ENUM ('disabled', 'initializing', 'healthy',
33
ALTER TABLE ONLY workspace_apps
44
ADD COLUMN IF NOT EXISTS updated_at timestamptz NOT NULL DEFAULT '-infinity',
55
ADD COLUMN IF NOT EXISTS healthcheck_enabled boolean NOT NULL DEFAULT FALSE,
6+
ADD COLUMN IF NOT EXISTS healthcheck_url text NOT NULL DEFAULT '',
67
ADD COLUMN IF NOT EXISTS healthcheck_period int NOT NULL DEFAULT 0,
78
ADD COLUMN IF NOT EXISTS healthcheck_threshold int NOT NULL DEFAULT 0,
89
ADD COLUMN IF NOT EXISTS health workspace_app_health NOT NULL DEFAULT 'disabled';

coderd/database/models.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceapps.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ INSERT INTO
2222
url,
2323
relative_path,
2424
healthcheck_enabled,
25+
healthcheck_url,
2526
healthcheck_period,
2627
healthcheck_threshold,
2728
health
2829
)
2930
VALUES
30-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) RETURNING *;
31+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13) RETURNING *;
3132

3233
-- name: UpdateWorkspaceAppHealthByID :exec
3334
UPDATE

coderd/provisionerdaemons.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,10 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
825825
String: app.Url,
826826
Valid: app.Url != "",
827827
},
828-
RelativePath: app.RelativePath,
828+
RelativePath: app.RelativePath,
829+
// default to disabled until we tie up the terraform
829830
HealthcheckEnabled: false,
831+
HealthcheckUrl: "",
830832
HealthcheckPeriod: 0,
831833
HealthcheckThreshold: 0,
832834
Health: database.WorkspaceAppHealthDisabled,

coderd/workspaceagents.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,8 @@ func convertApps(dbApps []database.WorkspaceApp) []codersdk.WorkspaceApp {
658658
Command: dbApp.Command.String,
659659
Icon: dbApp.Icon,
660660
HealthcheckEnabled: dbApp.HealthcheckEnabled,
661-
HealthcheckPeriod: dbApp.HealthcheckPeriod,
661+
HealthcheckURL: dbApp.HealthcheckUrl,
662+
HealthcheckInterval: dbApp.HealthcheckPeriod,
662663
HealthcheckThreshold: dbApp.HealthcheckThreshold,
663664
Health: codersdk.WorkspaceAppHealth(dbApp.Health),
664665
})

0 commit comments

Comments
 (0)