Skip to content

Commit 02af365

Browse files
committed
healthcheck url
1 parent 9f22b4b commit 02af365

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
@@ -416,7 +416,7 @@ func New(options *Options) *API {
416416
r.Use(httpmw.ExtractWorkspaceAgent(options.Database))
417417
r.Get("/metadata", api.workspaceAgentMetadata)
418418
r.Post("/version", api.postWorkspaceAgentVersion)
419-
r.Post("/app-healths", api.postWorkspaceAppHealths)
419+
r.Post("/app-health", api.postWorkspaceAppHealth)
420420
r.Get("/gitsshkey", api.agentGitSSHKey)
421421
r.Get("/coordinate", api.workspaceAgentCoordinate)
422422
r.Get("/report-stats", api.workspaceAgentReportStats)

coderd/coderdtest/authorize.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func AGPLRoutes(a *AuthTester) (map[string]string, map[string]RouteCheck) {
5757
"GET:/api/v2/workspaceagents/me/metadata": {NoAuthorize: true},
5858
"GET:/api/v2/workspaceagents/me/coordinate": {NoAuthorize: true},
5959
"POST:/api/v2/workspaceagents/me/version": {NoAuthorize: true},
60-
"POST:/api/v2/workspaceagents/me/app-healths": {NoAuthorize: true},
60+
"POST:/api/v2/workspaceagents/me/app-health": {NoAuthorize: true},
6161
"GET:/api/v2/workspaceagents/me/report-stats": {NoAuthorize: true},
6262

6363
// These endpoints have more assertions. This is good, add more endpoints to assert if you can!

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
@@ -416,7 +416,8 @@ func convertApps(dbApps []database.WorkspaceApp) []codersdk.WorkspaceApp {
416416
Command: dbApp.Command.String,
417417
Icon: dbApp.Icon,
418418
HealthcheckEnabled: dbApp.HealthcheckEnabled,
419-
HealthcheckPeriod: dbApp.HealthcheckPeriod,
419+
HealthcheckURL: dbApp.HealthcheckUrl,
420+
HealthcheckInterval: dbApp.HealthcheckPeriod,
420421
HealthcheckThreshold: dbApp.HealthcheckThreshold,
421422
Health: codersdk.WorkspaceAppHealth(dbApp.Health),
422423
})

0 commit comments

Comments
 (0)