Skip to content

chore: add proxy health interval flag/env config #7919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cli/testdata/coder_server_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ backed by Tailscale and WireGuard.
The maximum lifetime duration users can specify when creating an API
token.

--proxy-health-interval duration, $CODER_PROXY_HEALTH_INTERVAL (default: 1m0s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be health-check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Felt long to say health check and figured health-interval was descriptive enough

The interval in which coderd should be checking the status of
workspace proxies.

--session-duration duration, $CODER_SESSION_DURATION (default: 24h0m0s)
The token expiry duration for browser sessions. Sessions may last
longer if they are actively making requests, but this functionality
Expand Down
3 changes: 3 additions & 0 deletions cli/testdata/server-config.yaml.golden
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ networking:
# directly in the database.
# (default: <unset>, type: bool)
disablePasswordAuth: false
# The interval in which coderd should be checking the status of workspace proxies.
# (default: 1m0s, type: duration)
proxyHealthInterval: 1m0s
# Configure TLS / HTTPS for your Coder deployment. If you're running
# Coder behind a TLS-terminating reverse proxy or are accessing Coder over a
# secure link, you can safely ignore these settings.
Expand Down
3 changes: 3 additions & 0 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ type DeploymentValues struct {
SSHConfig SSHConfig `json:"config_ssh,omitempty" typescript:",notnull"`
WgtunnelHost clibase.String `json:"wgtunnel_host,omitempty" typescript:",notnull"`
DisableOwnerWorkspaceExec clibase.Bool `json:"disable_owner_workspace_exec,omitempty" typescript:",notnull"`
ProxyHealthStatusInterval clibase.Duration `json:"proxy_health_status_interval,omitempty" typescript:",notnull"`

Config clibase.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
WriteConfig clibase.Bool `json:"write_config,omitempty" typescript:",notnull"`
Expand Down Expand Up @@ -1497,6 +1498,16 @@ Write out the current server config as YAML to stdout.`,
Default: "", // empty string means pick best server
Hidden: true,
},
{
Name: "Proxy Health Check Interval",
Description: "The interval in which coderd should be checking the status of workspace proxies.",
Flag: "proxy-health-interval",
Env: "CODER_PROXY_HEALTH_INTERVAL",
Default: (time.Minute).String(),
Value: &c.ProxyHealthStatusInterval,
Group: &deploymentGroupNetworkingHTTP,
YAML: "proxyHealthInterval",
},
}
return opts
}
Expand Down
1 change: 1 addition & 0 deletions docs/api/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
"daemons": 0,
"force_cancel_interval": 0
},
"proxy_health_status_interval": 0,
"proxy_trusted_headers": ["string"],
"proxy_trusted_origins": ["string"],
"rate_limit": {
Expand Down
3 changes: 3 additions & 0 deletions docs/api/schemas.md
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"daemons": 0,
"force_cancel_interval": 0
},
"proxy_health_status_interval": 0,
"proxy_trusted_headers": ["string"],
"proxy_trusted_origins": ["string"],
"rate_limit": {
Expand Down Expand Up @@ -2273,6 +2274,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"daemons": 0,
"force_cancel_interval": 0
},
"proxy_health_status_interval": 0,
"proxy_trusted_headers": ["string"],
"proxy_trusted_origins": ["string"],
"rate_limit": {
Expand Down Expand Up @@ -2389,6 +2391,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
| `pprof` | [codersdk.PprofConfig](#codersdkpprofconfig) | false | | |
| `prometheus` | [codersdk.PrometheusConfig](#codersdkprometheusconfig) | false | | |
| `provisioner` | [codersdk.ProvisionerConfig](#codersdkprovisionerconfig) | false | | |
| `proxy_health_status_interval` | integer | false | | |
| `proxy_trusted_headers` | array of string | false | | |
| `proxy_trusted_origins` | array of string | false | | |
| `rate_limit` | [codersdk.RateLimitConfig](#codersdkratelimitconfig) | false | | |
Expand Down
11 changes: 11 additions & 0 deletions docs/cli/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,17 @@ Serve prometheus metrics on the address defined by prometheus address.

Number of provisioner daemons to create on start. If builds are stuck in queued state for a long time, consider increasing this.

### --proxy-health-interval

| | |
| ----------- | ------------------------------------------------ |
| Type | <code>duration</code> |
| Environment | <code>$CODER_PROXY_HEALTH_INTERVAL</code> |
| YAML | <code>networking.http.proxyHealthInterval</code> |
| Default | <code>1m0s</code> |

The interval in which coderd should be checking the status of workspace proxies.

### --proxy-trusted-headers

| | |
Expand Down
1 change: 1 addition & 0 deletions enterprise/cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func (r *RootCmd) server() *clibase.Cmd {
DERPServerRelayAddress: options.DeploymentValues.DERP.Server.RelayURL.String(),
DERPServerRegionID: int(options.DeploymentValues.DERP.Server.RegionID.Value()),
Options: options,
ProxyHealthInterval: options.DeploymentValues.ProxyHealthStatusInterval.Value(),
}

api, err := coderd.New(ctx, o)
Expand Down
1 change: 1 addition & 0 deletions site/src/api/typesGenerated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export interface DeploymentValues {
readonly config_ssh?: SSHConfig
readonly wgtunnel_host?: string
readonly disable_owner_workspace_exec?: boolean
readonly proxy_health_status_interval?: number
// This is likely an enum in an external package ("github.com/coder/coder/cli/clibase.YAMLConfigPath")
readonly config?: string
readonly write_config?: boolean
Expand Down