percona / pmm-doc

Percona Monitoring and Management (PMM) Technical Documentation
https://docs.percona.com/percona-monitoring-and-management/
GNU Affero General Public License v3.0
42 stars 89 forks source link
documentation mkdocs pmm

Percona Monitoring and Management (PMM) Documentation

render Build Helm Podman

Percona Monitoring and Management (PMM) is a database monitoring solution that is free and open-source.

This repo holds the source files for the official PMM technical documentation.

To contribute to that documentation, you can:

Introduction

We use MkDocs to convert Markdown files into a static HTML website (or PDF). This process is called building the documentation.

The documentation source files are in the docs directory. (Other files in this repo are explained in Directories and files.)

The two major PMM versions are kept in separate branches:

Before you start, it helps to know what Git, Python and Docker are, what Markdown is and how to write it, and how to install and use those things on the command line. (If you don't, consider opening a Jira issue instead.)

Building the documentation

If you'd like to have a local copy of PMM documentation, or are thinking about contributing, it helps if you can build the documentation to see how it will look when published. The easiest way is to use Docker, as this avoids having to install MkDocs and its dependencies.

With Docker

  1. Install Docker.

  2. Clone this repository.

  3. Change directory to pmm-doc.

  4. Use our PMM documentation Docker image to build the documentation:

    docker run --rm -v $(pwd):/docs perconalab/pmm-doc-md mkdocs build
  5. Find the site directory, open index.html in a browser to view the first page of documentation.

If you want to see how things look as you edit, MkDocs has a built-in server for live previewing. After (or instead of) building, run:

docker run --rm -v $(pwd):/docs -p 8000:8000 perconalab/pmm-doc-md mkdocs serve --dev-addr=0.0.0.0:8000

Wait until you see INFO - Start detecting changes then point your browser to http://0.0.0.0:8000.

Without Docker

If you don't use Docker, you must install MkDocs and all its dependencies.

  1. Install Python.

  2. Install MkDocs and required extensions:

    pip install -r requirements.txt
  3. Build the site:

    mkdocs build
  4. Open site/index.html

Or, to run the built-in web server:

mkdocs serve

View the site at http://0.0.0.0:8000

PDF

How to create a PDF version of the documentation.

  1. (For Percona staff) If building for a release of PMM, edit mkdocs-base.yml and change:

    • The release number in plugins.with-pdf.output_path
    • The release number and date in plugins.with-pdf.cover_subtitle
  2. Build

    • With Docker:

      docker run --rm -v $(pwd):/docs -e ENABLE_PDF_EXPORT=1 perconalab/pmm-doc-md mkdocs build -f mkdocs-pdf.yml
    • Without:

      ENABLE_PDF_EXPORT=1 mkdocs build -f mkdocs-pdf.yml
  3. The PDF is in site/_pdf.

Directories and files

Version switching

We use mike to build different versions of the documentation. Currently, only two are built, the latest PMM 1 and PMM 2 versions.

A GitHub actions workflow runs mike which in turn runs mkdocs. The HTML is committed and pushed to the publish branch. The whole branch is then copied (by an internal Percona Jenkins job) to our web server.

Image overlays

docs/using/interface.md uses an image of the home dashboard overlaid with numbered boxes to identify menu bars and control. This approach means the home dashboard image and its numbered version always look the same. You need only recreate the home page image in 1280x1280 format, then merge with the numbered overlay.

Here's how it's done.

The overlay image is merged with a copy of the latest home dashboard using composite, one of the ImageMagick tools.

composite docs/_images/PMM_Home_Dashboard_Overlay.png docs/_images/PMM_Home_Dashboard.jpg docs/_images/PMM_Home_Dashboard_Numbered.png

Spelling and grammar

The GitHub actions build job performs a basic spell check. (A grammar check is currently commented out in the actions file.) You can do these yourself on the command line if you have Node.js installed.

npm i markdown-spellcheck -g
mdspell --report --en-us --ignore-acronyms --ignore-numbers docs/<path to file>.md

To check all files:

mdspell --report --en-us --ignore-acronyms --ignore-numbers "docs/**/*.md"

Add any custom dictionary words to .spelling. The results of the spell check are printed, but the job ignores the return status.

Grammar is checked using write-good.

npm i write-good -g
write-good docs/<path to file>.md

To check all files:

write-good docs/**/*.md

Link checking

We're using the mkdocs-htmlproofer-plugin link checking plugin to detect broken URLs. It works well, but increases the build time significantly (by between 10 and 50 times longer).

The plugin is installed in our PMM documentation Docker image and by the GitHub action, but it is commented out in mkdocs.yml.

To enable it for local builds, uncomment the line with htmlproofer in the plugins section of mkdocs.yml and parse the build output for warnings.