# Documentation overview

We use [Antora](https://docs.antora.org/antora/latest/) to write our user facing documentation, [Netlify](https://www.netlify.com/) to host it and the [Diátaxis](https://diataxis.fr/) framework as the guide for the structure of the content. The main repository for the documentation is the [Documentation](https://github.com/stackabletech/documentation) repository and each operator and other tools have a `docs` directory from which content is pulled in. Have a look at the [Project overview](https://docs.stackable.tech/home/stable/contributor/project-overview/index.md) to learn about the repositories that are involved in providing the documentation.

## Content structure: Diátaxis

The [Diátaxis](https://diataxis.fr/) framework is a way to classify documentation content into four groups with distinct use cases.

![diataxis](https://docs.stackable.tech/home/stable/contributor/_images/diataxis.png)

**Source: [https://diataxis.fr/](https://diataxis.fr/)**

Documentation exists along two axis: _study_ or _work_; _pracital steps_ and _theory_. Practical learning happens in tutorials, and they are backed up by conceptual background information (theory). On the work oriented side, documentation should contain exhaustive reference information (every commandline flag, every yaml property, their type and whether they are optional or not etc.) as well as narrow, task oriented guides.

At Stackable we have to document the platform as a whole, individual operators, products and command line tools like `stackablectl`.

**Conceptual** information lives at the platform level in the [Concepts](https://docs.stackable.tech/home/stable/concepts/index.md) section. Some operators have their own specific concepts such as [ZNodes](https://docs.stackable.tech/home/stable/zookeeper/znodes/index.md) for ZooKeeper, but most concepts apply to all operators (i.e. roles and role groups, resource management, config overrides).

**Tutorials** (learning oriented guides) exist at the [top level](https://docs.stackable.tech/home/stable/tutorials/index.md) but there are also the Getting Started guides for all the individual operators. Tutorials provide complete set up information and require very little to be there already in contrast to guides (work instead of study oriented) which are more focused on solving specific tasks. There are also the [Demos](https://docs.stackable.tech/home/stable/demos/index.md) which are complete solutions that showcase how the platform integrates different products in a unified, reproducible and transparent way.

**Guides** are also instructional, but focus a narrow topic, something that the user might want to solve in their particular setup. For example: "How do I set up Kerberos with HDFS?" or "How do I connect Superset to Druid?" The guide has to account for different use-cases (i.e. the user is using their own pre-existing ZooKeeper instead of our ZooKeeper). This is not the case for tutorials. Since this kind of information is typically product specific, it is located in the usage guide section of individual operators.

**Reference** information for the Stackable platform entails all the settings and Options in our YAMLs, which we generate. The reference is found at [https://hub.stackable.tech/crds](https://hub.stackable.tech/crds) on the Stackable Hub, which ingests the CRDs of every operator automatically.

### Style guide

The [Documentation style guide](https://docs.stackable.tech/home/stable/contributor/docs/style-guide/index.md) contains all the information about the writing style, formatting style, naming documents and more.

## Technical bits: Antora, Netlify, Pagefind

[Antora](https://docs.antora.org/antora/latest/) uses a [playbook](https://docs.antora.org/antora/latest/playbook/) to build the documentation. It pulls documentation content from all the individual operator repositories, so an operators documentation is maintained in the same repository as the code. Antora builds a static website which we serve over [Netlify](https://www.netlify.com/). The web template of the documentation is also custom made and lives in the `ui/` directory of the [documentation repository](https://github.com/stackabletech/documentation).

For search, we use [pagefind](https://pagefind.app/) - a static search. The search index is generated as part of the build process and no external index is queried during search.

For Antora, the [Antora Zulip chatroom](https://antora.zulipchat.com/) is a good place to get help (besides the documentation)!

Building the documentation and also the deployment process on Netlify are documented in the [README](https://github.com/stackabletech/documentation/blob/main/README.adoc) file of the documentation repository.

## Executable tutorials

The getting started guides for each operator are backed by an executable script from which the documentation includes excerpts. This has the benefit that the guides are easily tested. When writing a new guide, please also write it in this way. Have a look at the existing getting started guides on how to do this.

## Templating

There is a templating mechanism in the docs. This has been introduced to template in mostly version numbers, so the updating doesn’t have to be done by hand.

Every Operator repo has a script `scripts/docs_templating.sh` and a file with templating variables `docs/templating_vars.yaml`. The script applies the variables to all `.j2` files in the `docs` directory.

This is used for getting started scripts, and in there only for versions of operators and for Helm Chart URLs.

Without this templating mechanism, every release these values would need to be updated by hand (or possibly with a search and replace) with is error prone and time consuming.

## Branch, component and version structure

The documentation consists of two _components_, the `home` and `management` component. All documentation for the operators is in the `home` component, and it is versioned with the platform versions (23.11, 24.3, 24.7 etc.). The `management` component contains the docs for `stackablectl`. It is not versioned (there is only a single, current version).

The `home` component is actually a [distributed component](https://docs.antora.org/antora/latest/distributed-component-version/), which means that it is split across multiple repositories. Each operator repository has a `docs` directory where the docs are found, and in there the `antora.yml` file specifies that the component is `home`, which means that the `home` component is partially defined across all operator repositories.

For versions, all Stackable repositories use [trunk based development](https://trunkbaseddevelopment.com/), and so the documentation is also pulled from different release branches in each repository. Each branch contains only a single version, and the `main` branch contains the `nightly` docs version. Using branches to structure component version is also [recommended by Antora](https://docs.antora.org/antora/latest/playbook/content-branches/).
