Skip to content
Open
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
6 changes: 6 additions & 0 deletions docs/antora.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# Cockpit is a module of the 'home' component, like the operators.
# The release scripts set the version to YY.M and prerelease to false on release branches.
name: home
version: 'nightly'
prerelease: true
53 changes: 53 additions & 0 deletions docs/modules/cockpit/pages/getting-started.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
= Getting started
:description: Install Stackable Cockpit on Kubernetes with Helm, connect it to an OIDC provider, PostgreSQL and Trino, and run your first SQL query.

This guide installs Cockpit with Helm and runs a first Trino query.
You need an existing PostgreSQL database, an OIDC client for Cockpit, a Trino cluster, the Stackable Secret Operator and an Ingress or reverse proxy that serves `https://cockpit.example.com`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we make this a bullet point list?

Register the OIDC client with the redirect URI `https://cockpit.example.com/api/auth/callback/oidc`, see xref:installation/authentication.adoc[].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Register the OIDC client with the redirect URI `https://cockpit.example.com/api/auth/callback/oidc`, see xref:installation/authentication.adoc[].
Register the OIDC client with the redirect URI `https://cockpit.example.com/api/auth/callback/oidc`, see the xref:installation/authentication.adoc[authentication] page for more details.


Create a Secret with the database password and the OIDC client secret:

[source,console]
----
$ kubectl create secret generic cockpit \
--from-literal=database-password='<database password>' \
--from-literal=oidc-client-secret='<OIDC client secret>'
----

Create a values file `cockpit-values.yaml`:

[source,yaml]
----
origin: https://cockpit.example.com # <1>
auth:
baseUrl: https://cockpit.example.com
oidc:
discoveryUrl: https://keycloak.example.com/realms/sdp/.well-known/openid-configuration
clientId: cockpit
clientSecret:
secretKeyRef:
name: cockpit
database:
host: postgresql
password:
secretKeyRef:
name: cockpit
tls:
secretClass: tls # <2>
trino:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wasn't it also possible to connect to a Trino from inside Cockpit itself?

If so I think we should probably mention that this 1:1 connection is potentially only temporary.

url: https://trino-coordinator-default-headless:8443
tls:
secretClass: tls # <3>
----
<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].
<2> The SecretClass that provides the CA certificate of PostgreSQL. Cockpit verifies the certificate by default, see xref:installation/database.adoc[].
<3> The SecretClass that provides the CA certificate of Trino.

Install the chart:

[source,console,subs="attributes"]
----
$ helm install cockpit oci://oci.stackable.tech/sdp-charts/cockpit --version {stackable-operator-version} --values cockpit-values.yaml
----

Open the URL in a browser, log in, select *Trino* in the sidebar and run a query such as `SELECT * FROM system.runtime.nodes`.
26 changes: 26 additions & 0 deletions docs/modules/cockpit/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
= Stackable Cockpit
:description: Stackable Cockpit is a web UI for the Stackable Data Platform with a Trino SQL editor, an S3 storage browser and a dashboard with bookmarks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we phrase this a bit more "openly" so that it is still correct-ish when we add more components but forget to update the description?

:github: https://github.com/stackabletech/cockpit/

[.link-bar]
* {github}[GitHub {external-link-icon}^]

Stackable Cockpit is a web UI for the Stackable Data Platform (SDP).
Users log in once through OpenID Connect (OIDC) and work with the platform's services from a single place.

Comment on lines +7 to +10

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We should probably include a screenshot of the entrypoint of the Cockpit (most likely the dashboard with a few bookmarks).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Screenshots are so annoying to update...... but we should have at least one or two somewhere, not more in my opinion.

== Getting started

Follow the xref:getting-started.adoc[] guide to install Cockpit with Helm and run your first Trino query.

== Modules

Cockpit consists of modules, and more are added over time:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Cockpit consists of modules, and more are added over time:
Cockpit consists of modules:

I'd remove the promise.


* xref:modules/trino.adoc[Trino]: a SQL editor with code completion and a schema browser.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
* xref:modules/trino.adoc[Trino]: a SQL editor with code completion and a schema browser.
* xref:modules/trino.adoc[Trino]: an SQL editor with code completion and a schema browser.

* xref:modules/storage.adoc[Storage]: a file browser for S3-compatible object storage.
* xref:modules/bookmarks.adoc[Bookmarks]: links to frequently used tools on the dashboard.

== Architecture

Cockpit is a Node.js server that connects to Trino as the logged-in user and to S3 with the connections each user configures.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd say "Node.js server" is an implementation detail we can leave out. And I also don't think we need to say what goes into PostgreSQL. The code is available if needed. I'd just remove this entire section (Architecture). It's just going to drift.

It stores users, sessions, bookmarks and storage connections in PostgreSQL.
31 changes: 31 additions & 0 deletions docs/modules/cockpit/pages/installation/authentication.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
= Authentication
:description: Configure login to Stackable Cockpit with any OpenID Connect provider, such as Keycloak, including callback URL, scopes and session secret.

Users log in to Cockpit through an OpenID Connect (OIDC) provider, for example Keycloak.
Register a confidential client for Cockpit with the redirect URI `<base URL>/api/auth/callback/oidc`.

[source,yaml]
----
auth:
baseUrl: https://cockpit.example.com # <1>
oidc:
discoveryUrl: https://keycloak.example.com/realms/sdp/.well-known/openid-configuration
clientId: cockpit
clientSecret:
secretKeyRef:
name: cockpit
key: oidc-client-secret
extraScopes: [] # <2>
sessionSecret:
secretKeyRef:
name: "" # <3>
----
<1> The URL users open in the browser.
<2> Scopes requested in addition to `openid`, `profile` and `email`.
<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`.
Set it explicitly when deploying with `helm template` or Argo CD, which cannot read the existing Secret, otherwise every deployment logs out all users.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Set it explicitly when deploying with `helm template` or Argo CD, which cannot read the existing Secret, otherwise every deployment logs out all users.
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.


The OIDC claim that becomes the Trino user is configured in the xref:modules/trino.adoc#_user_identity[Trino module].

WARNING: With `auth.oidc.enabled: false`, Cockpit has no login and all visitors share one anonymous user.
Use this only for local testing.
23 changes: 23 additions & 0 deletions docs/modules/cockpit/pages/installation/database.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
= Database
:description: Connect Stackable Cockpit to PostgreSQL, which stores users, sessions, bookmarks and storage connections, and configure TLS for the connection.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This list and the one below can just become outdated fast. I'd not name implementation specifics here.


Cockpit requires a PostgreSQL database for users, sessions, bookmarks and storage connections.
It creates and migrates its tables on startup.

[source,yaml]
----
database:
host: postgresql
port: 5432
name: cockpit
user: cockpit
password:
secretKeyRef:
name: cockpit
key: database-password
tls:
mode: verify-full # <1>
secretClass: tls # <2>
----
<1> `verify-full` (default), `require` (encrypt without verification) or `disable`.
<2> Provides the CA certificate of PostgreSQL. Alternatively set `caCert` to a mounted file. Both require `verify-full`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<2> Provides the CA certificate of PostgreSQL. Alternatively set `caCert` to a mounted file. Both require `verify-full`.
<2> Provides the CA certificate of PostgreSQL. Alternatively set `caCert` to a mounted file. `secretClass` and `caCert` both require `verify-full`.

109 changes: 109 additions & 0 deletions docs/modules/cockpit/pages/installation/helm.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
= Helm chart
:description: Install Stackable Cockpit with its Helm chart and configure ingress, reverse proxy headers, CA certificates and the scratch volume.

The Helm chart deploys Cockpit.
It does not deploy PostgreSQL, the OIDC provider or Trino.
The chart is published to `oci.stackable.tech/sdp-charts/cockpit`.
The https://github.com/stackabletech/cockpit/blob/{stackable-operator-branch}/deploy/helm/cockpit/README.md[chart README{external-link-icon}^] lists all values.

[source,console,subs="attributes"]
----
$ helm install cockpit oci://oci.stackable.tech/sdp-charts/cockpit --version {stackable-operator-version} --values cockpit-values.yaml
----

== Ingress and reverse proxy

IMPORTANT: Cockpit must be served over HTTPS, because session cookies and credentials such as S3 keys pass through the browser connection.
Cockpit itself serves plain HTTP, so terminate TLS at the Ingress or reverse proxy and use `https://` URLs for `origin` and `auth.baseUrl`.

The chart creates a ClusterIP Service on port 3000 and can create an Ingress with the `ingress` values.

Cockpit must be served at the root path `/` of its host, for example `https://cockpit.example.com/`.
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.

Set `origin` to the URL users open in the browser.
Behind a reverse proxy, also set the forwarded headers Cockpit trusts:

[source,yaml]
----
origin: https://cockpit.example.com
proxy:
protocolHeader: x-forwarded-proto
hostHeader: x-forwarded-host
----

=== Response header size

Pages send a `Link` header that preloads their JavaScript and CSS.
It grows with the number of files a page loads and exceeds 4 KB on some pages.
Proxies with a smaller header buffer answer these pages with `502 Bad Gateway`, for example ingress-nginx and nginx with their default `4k` buffer.
Raise the buffer to 16 KB:

[source,yaml]
----
ingress:
enabled: true
className: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-buffer-size: "16k"
----

For plain nginx, set `proxy_buffer_size 16k;` and `proxy_busy_buffers_size 16k;`.

// TODO: Remove once Cockpit uses SvelteKit 3, which preloads with <link> elements instead of a header, see https://github.com/sveltejs/kit/pull/15939.

== CA certificates

For backends with a private CA, set either a SecretClass or the path of a mounted CA file:

[source,yaml]
----
trino:
tls:
secretClass: tls # <1>
database:
tls:
caCert: /stackable/database-ca/ca.crt # <2>
extraVolumes:
- name: database-ca
secret:
secretName: database-ca
extraVolumeMounts:
- name: database-ca
mountPath: /stackable/database-ca
readOnly: true
----
<1> The Secret Operator mounts the CA certificate of the SecretClass.
<2> A CA file mounted from a Secret.

The same options exist under `storage.tls` for S3 endpoints.

== Additional environment variables

To set xref:reference/environment-variables.adoc[environment variables] directly, use `extraEnv` or `extraEnvFrom`:

[source,yaml]
----
extraEnv:
- name: LOG_LEVEL
value: debug
----

== Scratch volume

The chart mounts an emptyDir at `/tmp` for the archive preview cache.
Keep `tmp.sizeLimit` above `storage.archiveCacheMaxMb`, otherwise the kubelet evicts the pod when the cache fills up:

[source,yaml]
----
tmp:
sizeLimit: 1Gi
storage:
archiveCacheMaxMb: 512
----

== Replicas

Cockpit keeps running queries in memory, so keep `replicaCount` at `1`.

// TODO: Remove once query state is shared between replicas, see https://github.com/stackabletech/cockpit/issues/310.
10 changes: 10 additions & 0 deletions docs/modules/cockpit/pages/installation/monitoring.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
= Monitoring
:description: Stackable Cockpit exposes Prometheus metrics at /metrics and a health endpoint at /healthz, and writes structured JSON logs.

Cockpit exposes Prometheus metrics at `/metrics` on port 3000, without authentication.
They include HTTP request durations, Trino query counts and storage operation metrics.

The chart's liveness, readiness and startup probes use `/healthz`.

Cockpit writes JSON logs to stdout.
Set the log level with `logging.level`; the default is `info`.
29 changes: 29 additions & 0 deletions docs/modules/cockpit/pages/modules/bookmarks.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
= Bookmarks
: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.

The dashboard and the sidebar show bookmarks to frequently used tools, such as the web UIs of the platform's services.
Each user can add up to 25 bookmarks of their own.
Pinned bookmarks appear under _Favourites_ at the top of the sidebar.

== Global bookmarks

Global bookmarks are shown to every user, before their own bookmarks.
Users cannot change them.

[source,yaml]
----
bookmarks:
global:
- productId: superset # <1>
name: Dashboards # <2>
url: https://superset.example.com # <3>
environment: prod # <4>
pinned: true # <5>
----
<1> One of `trino`, `superset`, `airflow`, `nifi`, `druid`, `opensearch`, `hdfs`, `hbase`, `spark` or `custom`. It selects the icon; unknown values are shown as `custom`.
<2> Up to 40 characters.
<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.
<4> Optional. A label shown on the bookmark, up to 100 characters.
<5> Optional. Shows the bookmark under _Favourites_. Defaults to `false`.

`bookmarks.global` must be a YAML list.
54 changes: 54 additions & 0 deletions docs/modules/cockpit/pages/modules/storage.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
= Storage
:description: The storage module of Stackable Cockpit is a file browser for S3-compatible object storage with previews, uploads, downloads and file editing.

The storage module is a file browser for S3-compatible object storage.
Users browse buckets, upload and download files, preview common formats such as CSV, Parquet, images, PDFs and archives, and edit text files.

The module is disabled by default:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
The module is disabled by default:
The module is disabled by default.
To enable it, set:


[source,yaml]
----
features:
storage:
enabled: true
storage:
encryptionKey:
secretKeyRef:
name: cockpit
key: storage-encryption-key # <1>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The getting started guide never mentions creating this or adding it to that secret. Not sure if we should but right now someone following that guide will come here and it'll break.

tls:
secretClass: tls # <2>
----
<1> A 64-character hex string, for example from `openssl rand -hex 32`.
<2> Optional. Provides the CA certificate of the S3 endpoints. Alternatively set `caCert` to a mounted file.

Each user adds their own S3 connections in the UI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
Each user adds their own S3 connections in the UI.
Each user adds their own S3 storage connections in the UI.

Cockpit stores them in the database, with the credentials encrypted by the encryption key.
If the key changes or is lost, the stored credentials can no longer be read.

The CA certificate in `storage.tls` replaces the system trust store, so endpoints with publicly trusted certificates fail while it is set.

== File operations

Cut, copy, paste, rename and drag-and-drop move are disabled by default, because they can cause many S3 requests:

[source,yaml]
----
features:
storage:
transfer: true
----

== Limits

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[reference]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
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[reference]:
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]:


[source,yaml]
----
storage:
filePreviewRows: 500
maxEditableFileSize: 10485760 # <1>
config:
bodySizeLimit: 12M
----
<1> `config.bodySizeLimit` must be at least this large, otherwise saving large files fails.
Loading
Loading