Skip to content

Commit 9032c1e

Browse files
authored
Add docs (#422)
* feat(docs): first draft * docs: Version the docs with the SDP like the operators Cockpit is released together with the SDP, so the docs become the 'cockpit' module of the 'home' component instead of a component of their own. The release scripts set the version on release branches. * docs: Install the published Helm chart * style(docs): Use single quotes in antora.yml * docs: Fix bookmark key and database TLS in getting started * docs: Add the OIDC redirect URI to getting started * docs: Address review findings * docs: Document startup validation, logging variables and global bookmark rules * docs(trino): Document how Trino errors are shown * docs(helm): Document that Cockpit must be served at the root path * docs: Name the generated session Secret and list all prerequisites Getting started also needs the Secret Operator for the SecretClasses and an Ingress or reverse proxy that serves Cockpit over HTTPS. * docs: Fix the OIDC redirect URI and Trino URL in examples better-auth 1.7 serves the generic OAuth callback at /api/auth/callback/oidc. The Trino TLS certificate from the Secret Operator covers the headless role group Service, not trino-coordinator. * docs(helm): Document the proxy buffer size for large response headers * docs: pr feedback * docs: Add a dashboard screenshot to the overview page
1 parent 80e5c61 commit 9032c1e

13 files changed

Lines changed: 677 additions & 0 deletions

File tree

‎docs/antora.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
# Cockpit is a module of the 'home' component, like the operators.
3+
# The release scripts set the version to YY.M and prerelease to false on release branches.
4+
name: home
5+
version: 'nightly'
6+
prerelease: true
98.9 KB
Loading
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
= Getting started
2+
:description: Install Stackable Cockpit on Kubernetes with Helm, connect it to an OIDC provider, PostgreSQL and Trino, and run your first SQL query.
3+
4+
This guide installs Cockpit with Helm and runs a first Trino query.
5+
You need:
6+
7+
* a PostgreSQL database,
8+
* an OIDC client for Cockpit with the redirect URI `https://cockpit.example.com/api/auth/callback/oidc`, see the xref:installation/authentication.adoc[authentication] page for more details,
9+
* a Trino cluster,
10+
* the xref:secret-operator:index.adoc[Stackable Secret Operator],
11+
* an Ingress or reverse proxy that serves `https://cockpit.example.com`.
12+
13+
Create a Secret with the database password and the OIDC client secret:
14+
15+
[source,console]
16+
----
17+
$ kubectl create secret generic cockpit \
18+
--from-literal=database-password='<database password>' \
19+
--from-literal=oidc-client-secret='<OIDC client secret>'
20+
----
21+
22+
Create a values file `cockpit-values.yaml`:
23+
24+
[source,yaml]
25+
----
26+
origin: https://cockpit.example.com # <1>
27+
auth:
28+
baseUrl: https://cockpit.example.com
29+
oidc:
30+
discoveryUrl: https://keycloak.example.com/realms/sdp/.well-known/openid-configuration
31+
clientId: cockpit
32+
clientSecret:
33+
secretKeyRef:
34+
name: cockpit
35+
database:
36+
host: postgresql
37+
password:
38+
secretKeyRef:
39+
name: cockpit
40+
tls:
41+
secretClass: tls # <2>
42+
trino:
43+
url: https://trino-coordinator-default-headless:8443 # <3>
44+
tls:
45+
secretClass: tls # <4>
46+
----
47+
<1> The URL users open in the browser. It must use HTTPS, see xref:installation/helm.adoc#_ingress_and_reverse_proxy[Ingress and reverse proxy].
48+
<2> The SecretClass that provides the CA certificate of PostgreSQL. Cockpit verifies the certificate by default, see xref:installation/database.adoc[].
49+
<3> Optional. Without `trino.url`, each user enters a Trino connection in Cockpit, see xref:modules/trino.adoc#_connection[Connection].
50+
<4> The SecretClass that provides the CA certificate of Trino.
51+
52+
Install the chart:
53+
54+
[source,console,subs="attributes"]
55+
----
56+
$ helm install cockpit oci://oci.stackable.tech/sdp-charts/cockpit --version {stackable-operator-version} --values cockpit-values.yaml
57+
----
58+
59+
Open the URL in a browser, log in, select *Trino* in the sidebar and run a query such as `SELECT * FROM system.runtime.nodes`.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
= Stackable Cockpit
2+
:description: Stackable Cockpit is a web UI for the Stackable Data Platform (SDP) to work with services such as Trino and S3 storage from a single place, behind one OIDC login.
3+
:github: https://github.com/stackabletech/cockpit/
4+
5+
[.link-bar]
6+
* {github}[GitHub {external-link-icon}^]
7+
8+
Stackable Cockpit is a web UI for the Stackable Data Platform (SDP).
9+
Users log in once through OpenID Connect (OIDC) and work with the platform's services from a single place.
10+
11+
image::dashboard.png[Cockpit dashboard with bookmarks to Trino, Superset, Airflow and other tools]
12+
13+
== Getting started
14+
15+
Follow the xref:getting-started.adoc[] guide to install Cockpit with Helm and run your first Trino query.
16+
17+
== Modules
18+
19+
Cockpit consists of modules:
20+
21+
* xref:modules/trino.adoc[Trino]: an SQL editor with code completion and a schema browser.
22+
* xref:modules/storage.adoc[Storage]: a file browser for S3-compatible object storage.
23+
* xref:modules/bookmarks.adoc[Bookmarks]: links to frequently used tools on the dashboard.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
= Authentication
2+
:description: Configure login to Stackable Cockpit with any OpenID Connect provider, such as Keycloak, including callback URL, scopes and session secret.
3+
4+
Users log in to Cockpit through an OpenID Connect (OIDC) provider, for example Keycloak.
5+
Register a confidential client for Cockpit with the redirect URI `<base URL>/api/auth/callback/oidc`.
6+
7+
[source,yaml]
8+
----
9+
auth:
10+
baseUrl: https://cockpit.example.com # <1>
11+
oidc:
12+
discoveryUrl: https://keycloak.example.com/realms/sdp/.well-known/openid-configuration
13+
clientId: cockpit
14+
clientSecret:
15+
secretKeyRef:
16+
name: cockpit
17+
key: oidc-client-secret
18+
extraScopes: [] # <2>
19+
sessionSecret:
20+
secretKeyRef:
21+
name: "" # <3>
22+
----
23+
<1> The URL users open in the browser.
24+
<2> Scopes requested in addition to `openid`, `profile` and `email`.
25+
<3> The secret that signs session cookies. If empty, the chart generates a Secret (`cockpit-session` for the release `cockpit`) and keeps it across `helm upgrade`.
26+
Set it explicitly when deploying with `helm template` or Argo CD. They cannot read the existing Secret, so every deployment would generate a new one and log out all users.
27+
28+
The OIDC claim that becomes the Trino user is configured in the xref:modules/trino.adoc#_user_identity[Trino module].
29+
30+
WARNING: With `auth.oidc.enabled: false`, Cockpit has no login and all visitors share one anonymous user.
31+
Use this only for local testing.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
= Database
2+
:description: Connect Stackable Cockpit to its PostgreSQL database and configure TLS for the connection.
3+
4+
Cockpit stores its data in a PostgreSQL database.
5+
It creates and migrates its tables on startup.
6+
7+
[source,yaml]
8+
----
9+
database:
10+
host: postgresql
11+
port: 5432
12+
name: cockpit
13+
user: cockpit
14+
password:
15+
secretKeyRef:
16+
name: cockpit
17+
key: database-password
18+
tls:
19+
mode: verify-full # <1>
20+
secretClass: tls # <2>
21+
----
22+
<1> `verify-full` (default), `require` (encrypt without verification) or `disable`.
23+
<2> Provides the CA certificate of PostgreSQL. Alternatively set `caCert` to a mounted file. `secretClass` and `caCert` both require `verify-full`.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
= Helm chart
2+
:description: Install Stackable Cockpit with its Helm chart and configure ingress, reverse proxy headers, CA certificates and the scratch volume.
3+
4+
The Helm chart deploys Cockpit.
5+
It does not deploy PostgreSQL, the OIDC provider or Trino.
6+
The chart is published to `oci.stackable.tech/sdp-charts/cockpit`.
7+
The https://github.com/stackabletech/cockpit/blob/{stackable-operator-branch}/deploy/helm/cockpit/README.md[chart README{external-link-icon}^] lists all values.
8+
9+
[source,console,subs="attributes"]
10+
----
11+
$ helm install cockpit oci://oci.stackable.tech/sdp-charts/cockpit --version {stackable-operator-version} --values cockpit-values.yaml
12+
----
13+
14+
== Ingress and reverse proxy
15+
16+
IMPORTANT: Cockpit must be served over HTTPS, because session cookies and credentials such as S3 keys pass through the browser connection.
17+
Cockpit itself serves plain HTTP, so terminate TLS at the Ingress or reverse proxy and use `https://` URLs for `origin` and `auth.baseUrl`.
18+
19+
The chart creates a ClusterIP Service on port 3000 and can create an Ingress with the `ingress` values.
20+
21+
Cockpit must be served at the root path `/` of its host, for example `https://cockpit.example.com/`.
22+
Other base paths such as `https://example.com/cockpit/` are not supported, so do not route a path prefix to Cockpit or rewrite paths in the Ingress or reverse proxy.
23+
24+
Set `origin` to the URL users open in the browser.
25+
Behind a reverse proxy, also set the forwarded headers Cockpit trusts:
26+
27+
[source,yaml]
28+
----
29+
origin: https://cockpit.example.com
30+
proxy:
31+
protocolHeader: x-forwarded-proto
32+
hostHeader: x-forwarded-host
33+
----
34+
35+
=== Response header size
36+
37+
Pages send a `Link` header that preloads their JavaScript and CSS.
38+
It grows with the number of files a page loads and exceeds 4 KB on some pages.
39+
Proxies with a smaller header buffer answer these pages with `502 Bad Gateway`, for example ingress-nginx and nginx with their default `4k` buffer.
40+
Raise the buffer to 16 KB:
41+
42+
[source,yaml]
43+
----
44+
ingress:
45+
enabled: true
46+
className: nginx
47+
annotations:
48+
nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"
49+
----
50+
51+
For plain nginx, set `proxy_buffer_size 16k;` and `proxy_busy_buffers_size 16k;`.
52+
53+
// TODO: Remove once Cockpit uses SvelteKit 3, which preloads with <link> elements instead of a header, see https://github.com/sveltejs/kit/pull/15939.
54+
55+
== CA certificates
56+
57+
For backends with a private CA, set either a SecretClass or the path of a mounted CA file:
58+
59+
[source,yaml]
60+
----
61+
trino:
62+
tls:
63+
secretClass: tls # <1>
64+
database:
65+
tls:
66+
caCert: /stackable/database-ca/ca.crt # <2>
67+
extraVolumes:
68+
- name: database-ca
69+
secret:
70+
secretName: database-ca
71+
extraVolumeMounts:
72+
- name: database-ca
73+
mountPath: /stackable/database-ca
74+
readOnly: true
75+
----
76+
<1> The Secret Operator mounts the CA certificate of the SecretClass.
77+
<2> A CA file mounted from a Secret.
78+
79+
The same options exist under `storage.tls` for S3 endpoints.
80+
81+
== Additional environment variables
82+
83+
To set xref:reference/environment-variables.adoc[environment variables] directly, use `extraEnv` or `extraEnvFrom`:
84+
85+
[source,yaml]
86+
----
87+
extraEnv:
88+
- name: LOG_LEVEL
89+
value: debug
90+
----
91+
92+
== Scratch volume
93+
94+
The chart mounts an emptyDir at `/tmp` for the archive preview cache.
95+
Keep `tmp.sizeLimit` above `storage.archiveCacheMaxMb`, otherwise the kubelet evicts the pod when the cache fills up:
96+
97+
[source,yaml]
98+
----
99+
tmp:
100+
sizeLimit: 1Gi
101+
storage:
102+
archiveCacheMaxMb: 512
103+
----
104+
105+
== Replicas
106+
107+
Cockpit keeps running queries in memory, so keep `replicaCount` at `1`.
108+
109+
// TODO: Remove once query state is shared between replicas, see https://github.com/stackabletech/cockpit/issues/310.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
= Monitoring
2+
:description: Stackable Cockpit exposes Prometheus metrics at /metrics and a health endpoint at /healthz, and writes structured JSON logs.
3+
4+
Cockpit exposes Prometheus metrics at `/metrics` on port 3000, without authentication.
5+
They include HTTP request durations, Trino query counts and storage operation metrics.
6+
7+
The chart's liveness, readiness and startup probes use `/healthz`.
8+
9+
Cockpit writes JSON logs to stdout.
10+
Set the log level with `logging.level`; the default is `info`.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
= Bookmarks
2+
:description: The dashboard of Stackable Cockpit shows bookmarks to the web UIs of the platform's services, set up by each user or globally by the administrator.
3+
4+
The dashboard and the sidebar show bookmarks to frequently used tools, such as the web UIs of the platform's services.
5+
Each user can add up to 25 bookmarks of their own.
6+
Pinned bookmarks appear under _Favourites_ at the top of the sidebar.
7+
8+
== Global bookmarks
9+
10+
Global bookmarks are shown to every user, before their own bookmarks.
11+
Users cannot change them.
12+
13+
[source,yaml]
14+
----
15+
bookmarks:
16+
global:
17+
- productId: superset # <1>
18+
name: Dashboards # <2>
19+
url: https://superset.example.com # <3>
20+
environment: prod # <4>
21+
pinned: true # <5>
22+
----
23+
<1> One of `trino`, `superset`, `airflow`, `nifi`, `druid`, `opensearch`, `hdfs`, `hbase`, `spark` or `custom`. It selects the icon; unknown values are shown as `custom`.
24+
<2> Up to 40 characters.
25+
<3> An HTTP or HTTPS URL without a user name or password. Every user can see it in the page source, so it must not contain a token or other secret either.
26+
<4> Optional. A label shown on the bookmark, up to 100 characters.
27+
<5> Optional. Shows the bookmark under _Favourites_. Defaults to `false`.
28+
29+
`bookmarks.global` must be a YAML list.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
= Storage
2+
:description: The storage module of Stackable Cockpit is a file browser for S3-compatible object storage with previews, uploads, downloads and file editing.
3+
4+
The storage module is a file browser for S3-compatible object storage.
5+
Users browse buckets, upload and download files, preview common formats such as CSV, Parquet, images, PDFs and archives, and edit text files.
6+
7+
The module is disabled by default.
8+
To enable it, add an encryption key to the `cockpit` Secret:
9+
10+
[source,console]
11+
----
12+
$ kubectl patch secret cockpit --type merge \
13+
-p "{\"stringData\":{\"storage-encryption-key\":\"$(openssl rand -hex 32)\"}}"
14+
----
15+
16+
Then set:
17+
18+
[source,yaml]
19+
----
20+
features:
21+
storage:
22+
enabled: true
23+
storage:
24+
encryptionKey:
25+
secretKeyRef:
26+
name: cockpit
27+
key: storage-encryption-key # <1>
28+
tls:
29+
secretClass: tls # <2>
30+
----
31+
<1> A 64-character hex string. Keep a backup, see below.
32+
<2> Optional. Provides the CA certificate of the S3 endpoints. Alternatively set `caCert` to a mounted file.
33+
34+
Each user adds their own S3 storage connections in the UI.
35+
Cockpit stores them in the database, with the credentials encrypted by the encryption key.
36+
If the key changes or is lost, the stored credentials can no longer be read.
37+
38+
The CA certificate in `storage.tls` replaces the system trust store, so endpoints with publicly trusted certificates fail while it is set.
39+
40+
== File operations
41+
42+
Cut, copy, paste, rename and drag-and-drop move are disabled by default, because they can cause many S3 requests:
43+
44+
[source,yaml]
45+
----
46+
features:
47+
storage:
48+
transfer: true
49+
----
50+
51+
== Limits
52+
53+
Preview sizes, upload and transfer concurrency, the archive cache and the download history retention are set under `storage`, see the xref:reference/environment-variables.adoc#_storage[storage environment variables reference]:
54+
55+
[source,yaml]
56+
----
57+
storage:
58+
filePreviewRows: 500
59+
maxEditableFileSize: 10485760 # <1>
60+
config:
61+
bodySizeLimit: 12M
62+
----
63+
<1> `config.bodySizeLimit` must be at least this large, otherwise saving large files fails.

0 commit comments

Comments
 (0)