This is a [Next.js](https://nextjs.org)-based website with some custom code to integrate documentation from other repositories and fetch information about available Prometheus component downloads from GitHub.
See [`CONTRIBUTING.md`](CONTRIBUTING.md) for general instructions for new Prometheus contributors.
The documentation hosted on this website is pulled together from multiple repositories:
* The main documentation contents are located in the [`docs`](docs) directory of this repository.
* Documentation concerning the Prometheus server is [maintained in the Prometheus server repository](https://github.com/prometheus/prometheus/tree/main/docs) and cloned into the website at build time.
* Documentation concerning the Alertmanager server is [maintained in the Alertmanager server repository](https://github.com/prometheus/alertmanager/tree/main/docs) and cloned into the website at build time.
As a guideline, please keep the documentation generally applicable and avoid use-case-specific changes.
You'll need to have the following installed on your system:
* [Node.js](https://nodejs.org/en/download/)
* [NPM](https://www.npmjs.com/get-npm)
### Environment variables
For downloading documentation from other repositories as well as for fetching information about available downloads, the build scripts need a GitHub access token with read access to the repositories. You can create a personal access token in your GitHub account settings (https://github.com/settings/tokens/new).
Create a `.env` file in the root of the repository and add the following environment variable:
```env
# The URL of the Prometheus server repository
GITHUB_TOKEN=<your_github_token>
```
### Installing npm dependencies
To install all required [npm](https://www.npmjs.com/) package dependencies, run:
This cleans any previous build artifacts, fetches the latest documentation from the Prometheus and Alertmanager repositories, fetches information about available downloads (for the Download page), builds the website, and then indexes it (for the built-in [Pagefind](https://pagefind.app/)-based search functionality).
The final output is a static website in the `out` directory.
NOTE: Spotlight search is not available in development mode, as it requires building a [Pagefind](https://pagefind.app/) index on the static output and then loading the generated `/pagefind/pagefind.js` file. This only happens when building the app for production via `npm run build` (part of `npm run build-all`).
You can configure some high-level settings for the documentation website in the [`docs-config.ts`](docs-config.ts) file in the root of the repository. This file configures: