Files
nomad/website/content/docs/configuration/ui.mdx
Phil Renaud 35e1ea4328 [cli] UI URL hints for common CLI commands (#24454)
* Basic implementation for server members and node status

* Commands for alloc status and job status

* -ui flag for most commands

* url hints for variables

* url hints for job dispatch, evals, and deployments

* agent config ui.cli_url_links to disable

* Fix an issue where path prefix was presumed for variables

* driver uncomment and general cleanup

* -ui flag on the generic status endpoint

* Job run command gets namespaces, and no longer gets ui hints for --output flag

* Dispatch command hints get a namespace, and bunch o tests

* Lots of tests depend on specific output, so let's not mess with them

* figured out what flagAddress is all about for testServer, oof

* Parallel outside of test instances

* Browser-opening test, sorta

* Env var for disabling/enabling CLI hints

* Addressing a few PR comments

* CLI docs available flags now all have -ui

* PR comments addressed; switched the env var to be consistent and scrunched monitor-adjacent hints a bit more

* ui.Output -> ui.Warn; moves hints from stdout to stderr

* isTerminal check and parseBool on command option

* terminal.IsTerminal check removed for test-runner-not-being-terminal reasons
2025-03-07 13:23:35 -05:00

129 lines
5.0 KiB
Plaintext

---
layout: docs
page_title: ui Block in Agent Configuration
description: |-
Configure Nomad's web UI in the `ui` block of a Nomad agent configuration. Provide Vault and Consul links, add custom text to Nomad's UI, and define the HTTP Content Security Policy response header.
---
# `ui` Block in Agent Configuration
<Placement groups={['ui']} />
This page provides reference information for configuring Nomad's web UI in the
`ui` block of a Nomad agent configuration. Provide Vault and Consul links,
add custom text to display in Nomad's UI, and define the HTTP Content
Security Policy response header.
```hcl
ui {
enabled = true
content_security_policy {
connect_src = ["*"]
default_src = ["'none'"]
form_action = ["'none'"]
frame_ancestors = ["'none'"]
img_src = ["'self'","data:"]
script_src = ["'self'"]
style_src = ["'self'","'unsafe-inline'"]
}
consul {
ui_url = "https://consul.example.com:8501/ui"
}
vault {
ui_url = "https://vault.example.com:8200/ui"
}
label {
text = "Staging Cluster"
background_color = "yellow"
text_color = "#000000"
}
}
```
A default `ui` block is automatically merged with all Nomad agent
configurations. Note that the UI can be served from any Nomad agent,
and the configuration is individual to each agent.
## `ui` Parameters
- `enabled` `(bool: true)` - Specifies whether the web UI is
enabled. If disabled, the `/ui/` path will return an empty web page.
- `consul` <code>([Consul]: nil)</code> - Configures integrations
between the Nomad web UI and the Consul web UI.
- `vault` <code>([Vault]: nil)</code> - Configures integrations
between the Nomad web UI and the Vault web UI.
- `label` <code>([Label]: nil)</code> - Configures a user-defined
label to display in the Nomad Web UI header.
- `show_cli_hints` `(bool: true)` - Controls whether CLI commands display hints
about equivalent UI pages. For example, when running `nomad server members`,
the CLI shows a message indicating where to find server information in
the web UI. Set to `false` to disable these hints.
## `content_security_policy` Parameters
The `content_security_policy` block configures the HTTP
[Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
header sent with the web UI response.
- `connect_src` `(array<string>: ["*"])` - Specifies the valid sources for
`connect-src` in the Content Security Policy header.
- `default_src` `(array<string>: ["'none'"])` - Specifies the valid sources for
`default-src` in the Content Security Policy header.
- `form_action` `(array<string>: ["'none'"])` - Specifies the valid sources for
`form-action` in the Content Security Policy header.
- `frame_ancestors` `(array<string>: ["'none'"])` - Specifies the valid sources
for `frame-ancestors` in the Content Security Policy header.
- `img_src` `(array<string>: ["'self'", "data:"])` - Specifies the valid sources
for `img-src` in the Content Security Policy header.
- `script_src` `(array<string>: ["'self'"])` - Specifies the valid sources for
`script-src` in the Content Security Policy header.
- `style_src` `(array<string>: ["'self'","'unsafe-inline'"])` - Specifies the
valid sources for `style-src` in the Content Security Policy header.
## `consul` Parameters
- `ui_url` `(string: "")` - Specifies the full base URL to a Consul
web UI (for example: `https://consul.example.com:8501/ui`. This URL
is used to build links from the Nomad web UI to a Consul web
UI. Note that this URL will not typically be the same one used for
the agent's [`consul.address`]; the `consul.address` is the URL used
by the Nomad to communicate with Consul, whereas the
`ui.consul.ui_url` is the URL you'll visit in your browser. If
this field is omitted, this integration will be disabled.
## `vault` Parameters
- `ui_url` `(string: "")` - Specifies the full base URL to a Vault
web UI (for example: `https://vault.example.com:8200/ui`. This URL
is used to build links from the Nomad web UI to a Vault web
UI. Note that this URL will not typically be the same one used for
the agent's [`vault.address`]; the `vault.address` is the URL used
by the Nomad to communicate with Vault, whereas the
`ui.vault.ui_url` is the URL you'll visit in your browser. If
this field is omitted, this integration will be disabled.
## `label` Parameters
- `text` `(string: "")` - Specifies the text of the label that will be
displayed in the header of the Web UI.
- `background_color` `(string: "")` - The background color of the label to
be displayed. The Web UI defaults to a black background. HEX values
may be used.
- `text_color` `(string: "")` - The text color of the label to be displayed.
The Web UI defaults to white text. HEX values may be used.
[web UI]: /nomad/tutorials/web-ui
[Consul]: /nomad/docs/configuration/ui#consul-parameters
[Vault]: /nomad/docs/configuration/ui#vault-parameters
[Label]: /nomad/docs/configuration/ui#label-parameters
[`consul.address`]: /nomad/docs/configuration/consul#address
[`vault.address`]: /nomad/docs/configuration/vault#address