Build environment for docs.icinga.com
Go to file
Blerim Sheqa ad5ba73a2b
Merge pull request #11 from Icinga/examples-icingadb
examples: Add icingadb-latest.yml
2024-12-19 12:43:35 +01:00
examples examples: Add icingadb-latest.yml 2024-12-19 12:43:10 +01:00
overrides Disable survey popup 2024-11-29 11:30:33 +01:00
.gitignore Update Styles 2019-01-25 16:16:32 +01:00
Gemfile Fix cloning and checkout mechanism 2017-10-18 15:06:30 +02:00
README.md Update README.md 2020-11-03 14:06:11 +01:00
build-docs.rb Fix whitespaces 2024-10-24 13:33:11 +02:00
config.yml Add global config 2018-01-30 10:39:46 +01:00
mkdocs.template.yml Fix footer links 2024-12-18 09:05:54 +01:00
parse_template.py Add parse_template.py 2022-01-28 14:28:23 +01:00

README.md

Icinga Documentation

This repository includes scripts to build the documentation for all Icinga projects.

The build-docs.rb script clones the configured project to a certain directory and switches to the specified branch. It searches for *.md files within the configured directory and creates documentation sections out of them. The ordering is defined by the file names. The capitalized name of each file is used as a title for this documentation section. The generates the mkdocs.yml file.

Usage

Usage: build-docs.rb -c config.yml -t mkdocs.template.yml}
    -f, --config FILENAME            Configuration file with project definition. Defaults to "config.yml"
    -t, --template FILENAME          This file is used as template for the generated mkdocs.yaml. Defaults to "mkdocs.template.yml"
    -h, --help                       Show this message

Configuration

config.yml

This file defines generally for which project documentation should be build.

General settings:

Option Description
site_name The site_name is displayed as title on the generated page
source_dir' Target directory to store the documentation source.
site_dir Target directory for generated html
project General project settings

Project settings:

Option Description
git Git repository to clone
ref Git branch or tag to checkout. For tags use tags/v1.1.0 notation
target A unique name to define the target. This is added to source_dir and site_dir
docs_dir Directory within the repository that includes documentation files. Eg. doc
latest If set to true, this documentation will be marked as the latest. This is important for the URLs.
subprojects A project may include one ore more sub-projects.

Subprojects are optional. They allow you to display a project documentation within another project documentation. We need this for Icinga Web 2, Icinga Director and other projects where we summarise multiple repositories into one documentation.

Example:

site_name: 'Icinga 2'
source_dir: 'www/source'
site_dir: 'www/html'
project:
  git: 'https://github.com/Icinga/icinga2.git'
  ref: 'support/2.7'
  target: 'icinga2'
  docs_dir: 'doc'
  latest: true

Example with subprojects:

site_name: 'Director'
source_dir: 'www/source'
site_dir: 'www/html'
project:
  git: 'https://github.com/Icinga/icingaweb2-module-director.git'
  ref: 'support/1.4'
  target: 'director'
  docs_dir: 'doc'
  latest: true
  subprojects:
    PuppetDB:
      git: 'https://github.com/Icinga/icingaweb2-module-puppetdb.git'
      ref: 'master'
      target: 'puppetdb'
      docs_dir: 'puppetdb/doc'

mkdocs.template.yml

This file is used as a template for the final mkdocs.yml. Default settings and some other configuration options are here.

Run Development Server

To see a live preview of the documentation you can run a development server that will refresh automatically on changes.

Clone this repository and install dependencies:

user@localhost ~/ $ git clone https://github.com/Icinga/icinga-docs-tools.git
user@localhost ~/ $ cd icinga-docs-tools
user@localhost ~/ $ bundle install --path vendor

Create and configure configuration file:

Build documentation:

user@localhost ~/ $ bundle exec build-docs.rb -f examples/businessprocess-latest.yml

Run server:

docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material:6.1.0

You should be able to access the documentation now in your browser by calling the address https://localhost:8000