docs: Refactor Loki configuration to be included via docs/shared (#12556)
Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
This commit is contained in:
@@ -85,10 +85,11 @@ PROMTAIL_UI_FILES := $(shell find ./clients/pkg/promtail/server/ui -type f -name
|
||||
|
||||
# Documentation source path
|
||||
DOC_SOURCES_PATH := docs/sources
|
||||
DOC_TEMPLATE_PATH := docs/templates
|
||||
|
||||
# Configuration flags documentation
|
||||
DOC_FLAGS_TEMPLATE := $(DOC_SOURCES_PATH)/configure/index.template
|
||||
DOC_FLAGS := $(DOC_SOURCES_PATH)/configure/_index.md
|
||||
DOC_FLAGS_TEMPLATE := $(DOC_TEMPLATE_PATH)/configuration.template
|
||||
DOC_FLAGS := $(DOC_SOURCES_PATH)/shared/configuration.md
|
||||
|
||||
##########
|
||||
# Docker #
|
||||
|
||||
+8
-18
@@ -1,5 +1,5 @@
|
||||
# The source of this file is https://raw.githubusercontent.com/grafana/writers-toolkit/main/docs/docs.mk.
|
||||
# 3.0.0 (2023-05-18)
|
||||
# A changelog is included in the head of the `make-docs` script.
|
||||
include variables.mk
|
||||
-include variables.mk.local
|
||||
|
||||
@@ -34,11 +34,6 @@ endif
|
||||
# First project is considered the primary one used for doc-validator.
|
||||
PRIMARY_PROJECT := $(subst /,-,$(firstword $(subst :, ,$(firstword $(PROJECTS)))))
|
||||
|
||||
# Name for the container.
|
||||
ifeq ($(origin DOCS_CONTAINER), undefined)
|
||||
export DOCS_CONTAINER := $(PRIMARY_PROJECT)-docs
|
||||
endif
|
||||
|
||||
# Host port to publish container port to.
|
||||
ifeq ($(origin DOCS_HOST_PORT), undefined)
|
||||
export DOCS_HOST_PORT := 3002
|
||||
@@ -76,11 +71,11 @@ docs-rm: ## Remove the docs container.
|
||||
|
||||
.PHONY: docs-pull
|
||||
docs-pull: ## Pull documentation base image.
|
||||
$(PODMAN) pull $(DOCS_IMAGE)
|
||||
$(PODMAN) pull -q $(DOCS_IMAGE)
|
||||
|
||||
make-docs: ## Fetch the latest make-docs script.
|
||||
make-docs:
|
||||
if [[ ! -f "$(PWD)/make-docs" ]]; then
|
||||
if [[ ! -f "$(CURDIR)/make-docs" ]]; then
|
||||
echo 'WARN: No make-docs script found in the working directory. Run `make update` to download it.' >&2
|
||||
exit 1
|
||||
fi
|
||||
@@ -88,32 +83,27 @@ make-docs:
|
||||
.PHONY: docs
|
||||
docs: ## Serve documentation locally, which includes pulling the latest `DOCS_IMAGE` (default: `grafana/docs-base:latest`) container image. See also `docs-no-pull`.
|
||||
docs: docs-pull make-docs
|
||||
$(PWD)/make-docs $(PROJECTS)
|
||||
$(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: docs-no-pull
|
||||
docs-no-pull: ## Serve documentation locally without pulling the `DOCS_IMAGE` (default: `grafana/docs-base:latest`) container image.
|
||||
docs-no-pull: make-docs
|
||||
$(PWD)/make-docs $(PROJECTS)
|
||||
$(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: docs-debug
|
||||
docs-debug: ## Run Hugo web server with debugging enabled. TODO: support all SERVER_FLAGS defined in website Makefile.
|
||||
docs-debug: make-docs
|
||||
WEBSITE_EXEC='hugo server --bind 0.0.0.0 --port 3002 --debug' $(PWD)/make-docs $(PROJECTS)
|
||||
WEBSITE_EXEC='hugo server --bind 0.0.0.0 --port 3002 --debug' $(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: doc-validator
|
||||
doc-validator: ## Run doc-validator on the entire docs folder.
|
||||
doc-validator: make-docs
|
||||
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) $(PWD)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: doc-validator/%
|
||||
doc-validator/%: ## Run doc-validator on a specific path. To lint the path /docs/sources/administration, run 'make doc-validator/administration'.
|
||||
doc-validator/%: make-docs
|
||||
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) DOC_VALIDATOR_INCLUDE=$(subst doc-validator/,,$@) $(PWD)/make-docs $(PROJECTS)
|
||||
DOCS_IMAGE=$(DOC_VALIDATOR_IMAGE) $(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: vale
|
||||
vale: ## Run vale on the entire docs folder.
|
||||
vale: make-docs
|
||||
DOCS_IMAGE=$(VALE_IMAGE) $(PWD)/make-docs $(PROJECTS)
|
||||
DOCS_IMAGE=$(VALE_IMAGE) $(CURDIR)/make-docs $(PROJECTS)
|
||||
|
||||
.PHONY: update
|
||||
update: ## Fetch the latest version of this Makefile and the `make-docs` script from Writers' Toolkit.
|
||||
|
||||
+477
-89
@@ -1,10 +1,224 @@
|
||||
#!/bin/sh
|
||||
# The source of this file is https://raw.githubusercontent.com/grafana/writers-toolkit/main/docs/make-docs.
|
||||
# 3.0.0 (2023-05-18)
|
||||
# # `make-docs` procedure changelog
|
||||
#
|
||||
# Updates should conform to the guidelines in https://keepachangelog.com/en/1.1.0/.
|
||||
# [Semantic versioning](https://semver.org/) is used to help the reader identify the significance of changes.
|
||||
# Changes are relevant to this script and the support docs.mk GNU Make interface.
|
||||
#
|
||||
# ## 6.0.1 (2024-02-28)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Suppress new errors relating to absent content introduced in https://github.com/grafana/website/pull/17561.
|
||||
#
|
||||
# ## 6.0.0 (2024-02-16)
|
||||
#
|
||||
# ### Changed
|
||||
#
|
||||
# - Require `jq` for human readable `make doc-validator` output.
|
||||
#
|
||||
# ## 5.4.0 (2024-02-12)
|
||||
#
|
||||
# ### Changed
|
||||
#
|
||||
# - Set `WEBSITE_MOUNTS=true` when a user includes the `website` project.
|
||||
#
|
||||
# Ensures consistent behavior across repositories.
|
||||
# To disable website mounts, add `export WEBSITE_MOUNTS := false` to your `variables.mk` or `variables.mk.local` file.
|
||||
# - Use website mounts and container volumes also when a user includes the `grafana-cloud` project.
|
||||
#
|
||||
# ## 5.3.0 (2024-02-08)
|
||||
#
|
||||
# ### Changed
|
||||
#
|
||||
# - Updated support for plugins monorepo now that multiple projects have been moved into it.
|
||||
# - Use `printf` instead of `echo` for better portability of output.
|
||||
#
|
||||
# https://www.in-ulm.de/~mascheck/various/echo+printf/
|
||||
#
|
||||
# ## 5.2.0 (2024-01-18)
|
||||
#
|
||||
# ### Changed
|
||||
#
|
||||
# - Updated `make vale` to use latest Vale style and configuration.
|
||||
# - Updated `make vale` to use platform appropriate image.
|
||||
#
|
||||
# ## 5.1.2 (2023-11-08)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Hide manual_mount warning messages from non-debug output.
|
||||
# Set the DEBUG environment variable to see all hidden messages.
|
||||
#
|
||||
# ## 5.1.1 (2023-10-30)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Support for Datadog and Oracle data source plugins repositories.
|
||||
#
|
||||
# ## 5.1.0 (2023-10-20)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Support for the plugins monorepo.
|
||||
#
|
||||
# ## 5.0.0 (2023-10-18)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Improved support for website repository.
|
||||
#
|
||||
# Mount more content and provide some feedback to users that the build can take time.
|
||||
#
|
||||
# - Ability to enter the `grafana/docs-base` container with a shell using the `ENTER` environment variable.
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Correct key combination for interrupting the process.
|
||||
#
|
||||
# Keyboards use capital letters so this more accurately reflects the exact key combination users are expected to press.
|
||||
#
|
||||
# ### Removed
|
||||
#
|
||||
# - Imperfect implementation of container name.
|
||||
#
|
||||
# Facilitates running `make vale` and `make docs` at once.
|
||||
# Container names are convenient for recognition in `docker ps` but the current implementation has more downsides than upsides.
|
||||
#
|
||||
# - Forced platform specification now that multiple architecture images exist.
|
||||
#
|
||||
# Significantly speeds up build times on larger repositories.
|
||||
#
|
||||
# ## 4.2.2 (2023-10-05)
|
||||
|
||||
# - Added support for Jira data source and MongoDB data source plugins repositories.
|
||||
#
|
||||
# ## 4.2.1 (2023-09-13)
|
||||
|
||||
# ## Fixed
|
||||
#
|
||||
# - Improved consistency of the webserver request loop by polling the Hugo port rather than the proxy port.
|
||||
#
|
||||
# ## 4.2.0 (2023-09-01)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Retry the initial webserver request up to ten times to allow for the process to start.
|
||||
# If it is still failing after ten seconds, an error message is logged.
|
||||
#
|
||||
# ## 4.1.1 (2023-07-20)
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Replaced use of `realpath` with POSIX compatible alternative to determine default value for REPOS_PATH.
|
||||
#
|
||||
# ## 4.1.0 (2023-06-16)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Mounts of `layouts` and `config` directories for the `website` project.
|
||||
# Ensures that local changes to mounts or shortcodes are reflected in the development server.
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Version inference for versioned docs pages.
|
||||
# Pages in versioned projects now have the `versioned: true` front matter set to ensure that "version" in $.Page.Scratch is set on builds.
|
||||
#
|
||||
# ## 4.0.0 (2023-06-06)
|
||||
#
|
||||
# ### Removed
|
||||
#
|
||||
# - `doc-validator/%` target.
|
||||
# The behavior of the target was not as described.
|
||||
# Instead, to limit `doc-validator` to only specific files, refer to https://grafana.com/docs/writers-toolkit/writing-guide/tooling-and-workflows/validate-technical-documentation/#run-on-specific-files.
|
||||
#
|
||||
# ## 3.0.0 (2023-05-18)
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Compatibility with the updated Make targets in the `website` repository.
|
||||
# `docs` now runs this script itself, `server-docs` builds the site with the `docs` Hugo environment.
|
||||
#
|
||||
# ## 2.0.0 (2023-05-18)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Support for the grafana-cloud/frontend-observability/faro-web-sdk project.
|
||||
# - Use of `doc-validator` v2.0.x which includes breaking changes to command line options.
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Source grafana-cloud project from website repository.
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Support for running the Vale linter with `make vale`.
|
||||
#
|
||||
# ## 1.2.1 (2023-05-05)
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Use `latest` tag of `grafana/vale` image by default instead of hardcoded older version.
|
||||
# - Fix mounting multiple projects broken by the changes in 1.0.1
|
||||
#
|
||||
# ## 1.2.0 (2023-05-05)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Support for running the Vale linter with `make vale`.
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# ## 1.1.0 (2023-05-05)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Rewrite error output so it can be followed by text editors.
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Fix `docs-debug` container process port.
|
||||
#
|
||||
# ## 1.0.1 (2023-05-04)
|
||||
#
|
||||
# ### Fixed
|
||||
#
|
||||
# - Ensure complete section hierarchy so that all projects have a visible menu.
|
||||
#
|
||||
# ## 1.0.0 (2023-05-04)
|
||||
#
|
||||
# ### Added
|
||||
#
|
||||
# - Build multiple projects simultaneously if all projects are checked out locally.
|
||||
# - Run [`doc-validator`](https://github.com/grafana/technical-documentation/tree/main/tools/cmd/doc-validator) over projects.
|
||||
# - Redirect project root to mounted version.
|
||||
# For example redirect `/docs/grafana/` to `/docs/grafana/latest/`.
|
||||
# - Support for Podman or Docker containers with `PODMAN` environment variable.
|
||||
# - Support for projects:
|
||||
# - agent
|
||||
# - enterprise-logs
|
||||
# - enterprise-metrics
|
||||
# - enterprise-traces
|
||||
# - grafana
|
||||
# - grafana-cloud
|
||||
# - grafana-cloud/machine-learning
|
||||
# - helm-charts/mimir-distributed
|
||||
# - helm-charts/tempo-distributed
|
||||
# - incident
|
||||
# - loki
|
||||
# - mimir
|
||||
# - oncall
|
||||
# - opentelemetry
|
||||
# - phlare
|
||||
# - plugins
|
||||
# - slo
|
||||
# - tempo
|
||||
# - writers-toolkit
|
||||
|
||||
|
||||
set -ef
|
||||
|
||||
readonly DOCS_CONTAINER="${DOCS_CONTAINER:-make-docs}"
|
||||
readonly DOCS_HOST_PORT="${DOCS_HOST_PORT:-3002}"
|
||||
readonly DOCS_IMAGE="${DOCS_IMAGE:-grafana/docs-base:latest}"
|
||||
|
||||
@@ -14,11 +228,24 @@ readonly DOC_VALIDATOR_SKIP_CHECKS="${DOC_VALIDATOR_SKIP_CHECKS:-^image-}"
|
||||
readonly HUGO_REFLINKSERRORLEVEL="${HUGO_REFLINKSERRORLEVEL:-WARNING}"
|
||||
readonly VALE_MINALERTLEVEL="${VALE_MINALERTLEVEL:-error}"
|
||||
readonly WEBSITE_EXEC="${WEBSITE_EXEC:-make server-docs}"
|
||||
# If set, the docs-base image will run a prebuild script that sets up Hugo mounts.
|
||||
readonly WEBSITE_MOUNTS="${WEBSITE_MOUNTS:-}"
|
||||
|
||||
PODMAN="$(if command -v podman >/dev/null 2>&1; then echo podman; else echo docker; fi)"
|
||||
|
||||
if ! command -v curl >/dev/null 2>&1; then
|
||||
if ! command -v wget >/dev/null 2>&1; then
|
||||
errr 'either `curl` or `wget` must be installed for this script to work.'
|
||||
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! command -v "${PODMAN}" >/dev/null 2>&1; then
|
||||
errr 'either `podman` or `docker` must be installed for this script to work.'
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
about() {
|
||||
cat <<EOF
|
||||
Test documentation locally with multiple source repositories.
|
||||
@@ -48,7 +275,7 @@ EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly REPOS_PATH="${REPOS_PATH:-$(realpath "$(git rev-parse --show-toplevel)/..")}"
|
||||
readonly REPOS_PATH="${REPOS_PATH:-$(cd "$(git rev-parse --show-toplevel)/.." && echo "${PWD}")}"
|
||||
|
||||
if [ -z "${REPOS_PATH}" ]; then
|
||||
cat <<EOF >&2
|
||||
@@ -63,21 +290,27 @@ SOURCES_as_code='as-code-docs'
|
||||
SOURCES_enterprise_metrics='backend-enterprise'
|
||||
SOURCES_enterprise_metrics_='backend-enterprise'
|
||||
SOURCES_grafana_cloud='website'
|
||||
SOURCES_grafana_cloud_alerting_and_irm_machine_learning='machine-learning'
|
||||
SOURCES_grafana_cloud_alerting_and_irm_slo='slo'
|
||||
SOURCES_grafana_cloud_k6='k6-docs'
|
||||
SOURCES_grafana_cloud_data_configuration_integrations='cloud-onboarding'
|
||||
SOURCES_grafana_cloud_frontend_observability_faro_web_sdk='faro-web-sdk'
|
||||
SOURCES_grafana_cloud_machine_learning='machine-learning'
|
||||
SOURCES_helm_charts_mimir_distributed='mimir'
|
||||
SOURCES_helm_charts_tempo_distributed='tempo'
|
||||
SOURCES_opentelemetry='opentelemetry-docs'
|
||||
SOURCES_plugins_grafana_datadog_datasource='datadog-datasource'
|
||||
SOURCES_plugins_grafana_oracle_datasource='oracle-datasource'
|
||||
|
||||
VERSIONS_as_code='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_alerting_and_irm_machine_learning='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_alerting_and_irm_slo='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_k6='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_data_configuration_integrations='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_frontend_observability_faro_web_sdk='UNVERSIONED'
|
||||
VERSIONS_grafana_cloud_machine_learning='UNVERSIONED'
|
||||
VERSIONS_opentelemetry='UNVERSIONED'
|
||||
VERSIONS_plugins_grafana_datadog_datasource='latest'
|
||||
VERSIONS_plugins_grafana_oracle_datasource='latest'
|
||||
VERSIONS_technical_documentation='UNVERSIONED'
|
||||
VERSIONS_website='UNVERSIONED'
|
||||
VERSIONS_writers_toolkit='UNVERSIONED'
|
||||
@@ -86,8 +319,10 @@ PATHS_grafana_cloud='content/docs/grafana-cloud'
|
||||
PATHS_helm_charts_mimir_distributed='docs/sources/helm-charts/mimir-distributed'
|
||||
PATHS_helm_charts_tempo_distributed='docs/sources/helm-charts/tempo-distributed'
|
||||
PATHS_mimir='docs/sources/mimir'
|
||||
PATHS_plugins_grafana_datadog_datasource='docs/sources'
|
||||
PATHS_plugins_grafana_oracle_datasource='docs/sources'
|
||||
PATHS_tempo='docs/sources/tempo'
|
||||
PATHS_website='content/docs'
|
||||
PATHS_website='content'
|
||||
|
||||
# identifier STR
|
||||
# Replace characters that are not valid in an identifier with underscores.
|
||||
@@ -102,6 +337,77 @@ aget() {
|
||||
eval echo '$'"$(identifier "$1")_$(identifier "$2")"
|
||||
}
|
||||
|
||||
# src returns the project source repository name for a project.
|
||||
src() {
|
||||
_project="$1"
|
||||
|
||||
case "${_project}" in
|
||||
plugins/*)
|
||||
if [ -z "$(aget SOURCES "${_project}")" ]; then
|
||||
echo plugins-private
|
||||
else
|
||||
aget SOURCES "${_project}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ -z "$(aget SOURCES "${_project}")" ]; then
|
||||
echo "${_project}"
|
||||
else
|
||||
aget SOURCES "${_project}"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
unset _project
|
||||
}
|
||||
|
||||
# path returns the relative path within the repository that contain the docs for a project.
|
||||
path() {
|
||||
_project="$1"
|
||||
|
||||
case "${_project}" in
|
||||
plugins/*)
|
||||
if [ -z "$(aget PATHS "${_project}")" ]; then
|
||||
echo "${_project}/docs/sources"
|
||||
else
|
||||
aget PATHS "${_project}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ -z "$(aget PATHS "${_project}")" ]; then
|
||||
echo "docs/sources"
|
||||
else
|
||||
aget PATHS "${_project}"
|
||||
fi
|
||||
esac
|
||||
|
||||
unset _project
|
||||
}
|
||||
|
||||
# version returns the version for a project. Unversioned projects return the special value 'UNVERSIONED'.
|
||||
version() {
|
||||
_project="$1"
|
||||
|
||||
case "${_project}" in
|
||||
plugins/*)
|
||||
if [ -z "$(aget VERSIONS "${_project}")" ]; then
|
||||
echo "UNVERSIONED"
|
||||
else
|
||||
aget VERSIONS "${_project}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ -z "$(aget VERSIONS "${_project}")" ]; then
|
||||
echo latest
|
||||
else
|
||||
aget VERSIONS "${_project}"
|
||||
fi
|
||||
esac
|
||||
|
||||
unset _project
|
||||
}
|
||||
|
||||
|
||||
# new_proj populates a new project structure.
|
||||
new_proj() {
|
||||
_project="$1"
|
||||
@@ -112,31 +418,19 @@ new_proj() {
|
||||
# If version is not set, use the script mapping of project to default versions if it exists.
|
||||
# Fallback to 'latest'.
|
||||
if [ -z "${_version}" ]; then
|
||||
if [ -z "$(aget VERSIONS "${_project}")" ]; then
|
||||
_version=latest
|
||||
else
|
||||
_version="$(aget VERSIONS "${_project}")"
|
||||
fi
|
||||
_version="$(version "${_project}")"
|
||||
fi
|
||||
|
||||
# If repo is not set, use the script mapping of project to repo name if it exists.
|
||||
# Fallback to using the project name.
|
||||
if [ -z "${_repo}" ]; then
|
||||
if [ -z "$(aget SOURCES "${_project}")" ]; then
|
||||
_repo="${_project}"
|
||||
else
|
||||
_repo="$(aget SOURCES "${_project}")"
|
||||
fi
|
||||
_repo="$(src "${_project}")"
|
||||
fi
|
||||
|
||||
# If path is not set, use the script mapping of project to docs sources path if it exists.
|
||||
# Fallback to using 'docs/sources'.
|
||||
if [ -z "${_path}" ]; then
|
||||
if [ -z "$(aget PATHS "${_project}")" ]; then
|
||||
_path="docs/sources"
|
||||
else
|
||||
_path="$(aget PATHS "${_project}")"
|
||||
fi
|
||||
_path="$(path "${_project}")"
|
||||
fi
|
||||
|
||||
echo "${_project}:${_version}:${_repo}:${_path}"
|
||||
@@ -150,7 +444,7 @@ proj_url() {
|
||||
$1
|
||||
POSIX_HERESTRING
|
||||
|
||||
if [ "${_project}" = 'website' ]; then
|
||||
if [ "${_project}" = website ]; then
|
||||
echo "http://localhost:${DOCS_HOST_PORT}/docs/"
|
||||
|
||||
unset _project _version
|
||||
@@ -184,8 +478,8 @@ proj_dst() {
|
||||
$1
|
||||
POSIX_HERESTRING
|
||||
|
||||
if [ "${_project}" = 'website' ]; then
|
||||
echo '/hugo/content/docs'
|
||||
if [ "${_project}" = website ]; then
|
||||
echo '/hugo/content'
|
||||
|
||||
unset _project _version
|
||||
return
|
||||
@@ -214,9 +508,10 @@ repo_path() {
|
||||
done
|
||||
unset IFS
|
||||
|
||||
echo "ERRR: could not find project '${_repo}' in any of the paths in REPOS_PATH '${REPOS_PATH}'." >&2
|
||||
echo "NOTE: you must have a checkout of the project '${_repo}' at '${REPOS_PATH##:*}/${_repo}'." >&2
|
||||
echo "NOTE: if you have cloned the repository into a directory with a different name, consider changing it to ${_repo}." >&2
|
||||
errr "could not find project '${_repo}' in any of the paths in REPOS_PATH '${REPOS_PATH}'."
|
||||
note "you must have a checkout of the project '${_repo}' at '${REPOS_PATH##:*}/${_repo}'."
|
||||
note "if you have cloned the repository into a directory with a different name, consider changing it to ${_repo}."
|
||||
|
||||
unset _repo
|
||||
exit 1
|
||||
}
|
||||
@@ -242,7 +537,7 @@ proj_canonical() {
|
||||
$1
|
||||
POSIX_HERESTRING
|
||||
|
||||
if [ "${_project}" = 'website' ]; then
|
||||
if [ "${_project}" = website ]; then
|
||||
echo '/docs'
|
||||
|
||||
unset _project _version
|
||||
@@ -302,6 +597,59 @@ POSIX_HERESTRING
|
||||
unset _project _version _repo _path
|
||||
}
|
||||
|
||||
await_build() {
|
||||
url="$1"
|
||||
req="$(if command -v curl >/dev/null 2>&1; then echo 'curl -s -o /dev/null'; else echo 'wget -q'; fi)"
|
||||
|
||||
i=1
|
||||
max=10
|
||||
while [ "${i}" -ne "${max}" ]
|
||||
do
|
||||
sleep 1
|
||||
debg "Retrying request to web server assuming the process is still starting up."
|
||||
i=$((i + 1))
|
||||
|
||||
if ${req} "${url}"; then
|
||||
printf '\r\nView documentation locally:\r\n'
|
||||
for x in ${url_src_dst_vers}; do
|
||||
IFS='^' read -r url _ _ <<POSIX_HERESTRING
|
||||
$x
|
||||
POSIX_HERESTRING
|
||||
|
||||
if [ -n "${url}" ]; then
|
||||
if [ "${_url}" != "arbitrary" ]; then
|
||||
printf '\r %s\r\n' "${url}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
printf '\r\nPress Ctrl+C to stop the server\r\n'
|
||||
|
||||
unset i max req url
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
printf '\r\n'
|
||||
errr 'The build was interrupted or a build error occurred, check the previous logs for possible causes.'
|
||||
note 'You might need to use Ctrl+C to end the process.'
|
||||
|
||||
unset i max req url
|
||||
}
|
||||
|
||||
debg() {
|
||||
if [ -n "${DEBUG}" ]; then
|
||||
printf 'DEBG: %s\r\n' "$1" >&2
|
||||
fi
|
||||
}
|
||||
|
||||
errr() {
|
||||
printf 'ERRR: %s\r\n' "$1" >&2
|
||||
}
|
||||
|
||||
note() {
|
||||
printf 'NOTE: %s\r\n' "$1" >&2
|
||||
}
|
||||
|
||||
url_src_dst_vers="$(url_src_dst_vers "$@")"
|
||||
|
||||
volumes=""
|
||||
@@ -311,9 +659,20 @@ for arg in "$@"; do
|
||||
IFS=: read -r _project _ _repo _ <<POSIX_HERESTRING
|
||||
${arg}
|
||||
POSIX_HERESTRING
|
||||
if [ "${_project}" = website ]; then
|
||||
if [ "${_project}" = website ] || [ "${_project}" = grafana-cloud ]; then
|
||||
note "Please be patient, building the website can take some time."
|
||||
|
||||
# If set, the docs-base image will run a prebuild script that sets up Hugo mounts.
|
||||
if [ "${WEBSITE_MOUNTS}" = false ]; then
|
||||
unset WEBSITE_MOUNTS
|
||||
else
|
||||
readonly WEBSITE_MOUNTS=true
|
||||
fi
|
||||
|
||||
_repo="$(repo_path website)"
|
||||
volumes="--volume=${_repo}/config:/hugo/config"
|
||||
volumes="${volumes} --volume=${_repo}/layouts:/hugo/layouts"
|
||||
volumes="${volumes} --volume=${_repo}/scripts:/hugo/scripts"
|
||||
fi
|
||||
unset _project _repo
|
||||
done
|
||||
@@ -325,13 +684,14 @@ POSIX_HERESTRING
|
||||
|
||||
if [ "${_url}" != "arbitrary" ]; then
|
||||
if [ ! -f "${_src}/_index.md" ]; then
|
||||
echo "ERRR: Index file '${_src}/_index.md' does not exist." >&2
|
||||
echo "Is '${_src}' the correct source directory?" >&2
|
||||
errr "Index file '${_src}/_index.md' does not exist."
|
||||
note "Is '${_src}' the correct source directory?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "DEBG: Mounting '${_src}' at container path '${_dst}'" >&2
|
||||
debg "Mounting '${_src}' at container path '${_dst}'"
|
||||
|
||||
if [ -z "${volumes}" ]; then
|
||||
volumes="--volume=${_src}:${_dst}"
|
||||
else
|
||||
@@ -354,53 +714,70 @@ POSIX_HERESTRING
|
||||
|
||||
case "${image}" in
|
||||
'grafana/doc-validator')
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
errr '`jq` must be installed for the `doc-validator` target to work.'
|
||||
note 'To install `jq`, refer to https://jqlang.github.io/jq/download/,'
|
||||
|
||||
exit 1
|
||||
fi
|
||||
|
||||
proj="$(new_proj "$1")"
|
||||
echo
|
||||
printf '\r\n'
|
||||
"${PODMAN}" run \
|
||||
--init \
|
||||
--interactive \
|
||||
--name "${DOCS_CONTAINER}" \
|
||||
--platform linux/amd64 \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
"${DOCS_IMAGE}" \
|
||||
--include="${DOC_VALIDATOR_INCLUDE}" \
|
||||
--skip-checks="${DOC_VALIDATOR_SKIP_CHECKS}" \
|
||||
/hugo/content/docs \
|
||||
"$(proj_canonical "${proj}")" | sed "s#$(proj_dst "${proj}")#sources#"
|
||||
--init \
|
||||
--interactive \
|
||||
--platform linux/amd64 \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
"${DOCS_IMAGE}" \
|
||||
"--include=${DOC_VALIDATOR_INCLUDE}" \
|
||||
"--skip-checks=${DOC_VALIDATOR_SKIP_CHECKS}" \
|
||||
"/hugo/content$(proj_canonical "${proj}")" \
|
||||
"$(proj_canonical "${proj}")" \
|
||||
| sed "s#$(proj_dst "${proj}")#sources#" \
|
||||
| jq -r '"ERROR: \(.location.path):\(.location.range.start.line // 1):\(.location.range.start.column // 1): \(.message)" + if .suggestions[0].text then "\nSuggestion: \(.suggestions[0].text)" else "" end'
|
||||
;;
|
||||
'grafana/vale')
|
||||
proj="$(new_proj "$1")"
|
||||
echo
|
||||
printf '\r\n'
|
||||
"${PODMAN}" run \
|
||||
--init \
|
||||
--interactive \
|
||||
--name "${DOCS_CONTAINER}" \
|
||||
--platform linux/amd64 \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
"${DOCS_IMAGE}" \
|
||||
--minAlertLevel="${VALE_MINALERTLEVEL}" \
|
||||
--config=/etc/vale/.vale.ini \
|
||||
--output=line \
|
||||
/hugo/content/docs | sed "s#$(proj_dst "${proj}")#sources#"
|
||||
--init \
|
||||
--interactive \
|
||||
--rm \
|
||||
--workdir /etc/vale \
|
||||
--tty \
|
||||
${volumes} \
|
||||
"${DOCS_IMAGE}" \
|
||||
"--minAlertLevel=${VALE_MINALERTLEVEL}" \
|
||||
'--glob=*.md' \
|
||||
--output=/etc/vale/rdjsonl.tmpl \
|
||||
/hugo/content/docs | sed "s#$(proj_dst "${proj}")#sources#"
|
||||
;;
|
||||
*)
|
||||
tempfile="$(mktemp -t make-docs.XXX)"
|
||||
cat <<EOF >"${tempfile}"
|
||||
#!/usr/bin/env bash
|
||||
|
||||
tc() {
|
||||
set \${*,,}
|
||||
echo \${*^}
|
||||
}
|
||||
|
||||
for redirect in ${redirects}; do
|
||||
IFS='^' read -r path ver <<<"\${redirect}"
|
||||
echo -e "---\\nredirectURL: \"\${path/\/hugo\/content/}\"\\ntype: redirect\\n---\\n" > "\${path/\${ver}/_index.md}"
|
||||
echo -e "---\\nredirectURL: \"\${path/\/hugo\/content/}\"\\ntype: redirect\\nversioned: true\\n---\\n" > "\${path/\${ver}/_index.md}"
|
||||
done
|
||||
|
||||
for x in "${url_src_dst_vers}"; do
|
||||
IFS='^' read -r _ _ dst _ <<<"\${x}"
|
||||
|
||||
title="\${dst%/*}"
|
||||
title="\$(tc \${title##*/})"
|
||||
while [[ -n "\${dst}" ]]; do
|
||||
touch "\${dst}/_index.md"
|
||||
if [[ ! -f "\${dst}/_index.md" ]]; then
|
||||
echo -e "---title: \${title}\\n---\\n\\n# \${title}\\n\\n{{< section >}}" > "\${dst}/_index.md"
|
||||
fi
|
||||
dst="\${dst%/*}"
|
||||
done
|
||||
done
|
||||
@@ -412,36 +789,47 @@ fi
|
||||
${WEBSITE_EXEC}
|
||||
EOF
|
||||
chmod +x "${tempfile}"
|
||||
volumes="${volumes} --volume=$(realpath "${tempfile}"):/entrypoint"
|
||||
volumes="${volumes} --volume=${tempfile}:/entrypoint"
|
||||
readonly volumes
|
||||
|
||||
echo
|
||||
echo "Documentation will be served at the following URLs:"
|
||||
for x in ${url_src_dst_vers}; do
|
||||
IFS='^' read -r url _ _ <<POSIX_HERESTRING
|
||||
$x
|
||||
POSIX_HERESTRING
|
||||
IFS='' read -r cmd <<EOF
|
||||
${PODMAN} run \
|
||||
--env=HUGO_REFLINKSERRORLEVEL=${HUGO_REFLINKSERRORLEVEL} \
|
||||
--init \
|
||||
--interactive \
|
||||
--publish=${DOCS_HOST_PORT}:3002 \
|
||||
--publish=3003:3003 \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
${DOCS_IMAGE}
|
||||
EOF
|
||||
|
||||
if [ -n "${url}" ]; then
|
||||
if [ "${_url}" != "arbitrary" ]; then
|
||||
echo " ${url}"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "${ENTER}" ]; then
|
||||
${cmd} /bin/bash
|
||||
elif [ -n "${DEBUG}" ]; then
|
||||
await_build http://localhost:3003 &
|
||||
|
||||
echo
|
||||
"${PODMAN}" run \
|
||||
--env "HUGO_REFLINKSERRORLEVEL=${HUGO_REFLINKSERRORLEVEL}" \
|
||||
--init \
|
||||
--interactive \
|
||||
--name "${DOCS_CONTAINER}" \
|
||||
--platform linux/amd64 \
|
||||
--publish "${DOCS_HOST_PORT}:3002" \
|
||||
--publish "3003:3003" \
|
||||
--rm \
|
||||
--tty \
|
||||
${volumes} \
|
||||
"${DOCS_IMAGE}" \
|
||||
/entrypoint
|
||||
debg "${cmd} /entrypoint"
|
||||
${cmd} /entrypoint
|
||||
else
|
||||
await_build http://localhost:3003 &
|
||||
|
||||
${cmd} /entrypoint 2>&1\
|
||||
| sed -u \
|
||||
-e '/Web Server is available at http:\/\/localhost:3003\/ (bind address 0.0.0.0)/ d' \
|
||||
-e '/^hugo server/ d' \
|
||||
-e '/fatal: not a git repository (or any parent up to mount point \/)/ d' \
|
||||
-e '/Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)./ d' \
|
||||
-e "/Makefile:[0-9]*: warning: overriding recipe for target 'docs'/ d" \
|
||||
-e "/docs.mk:[0-9]*: warning: ignoring old recipe for target 'docs'/ d" \
|
||||
-e '/\/usr\/bin\/make -j 2 proxy hserver-docs HUGO_PORT=3003/ d' \
|
||||
-e '/website-proxy/ d' \
|
||||
-e '/rm -rf dist*/ d' \
|
||||
-e '/Press Ctrl+C to stop/ d' \
|
||||
-e '/make/ d' \
|
||||
-e '/WARNING: The manual_mount source directory/ d' \
|
||||
-e '/docs\/_index.md .* not found/ d'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,6 @@
|
||||
---
|
||||
headless: true
|
||||
description: |
|
||||
A headless page sets the render and list build options to never, creating a bundle of page resources.
|
||||
These page resources are accessible to the `docs/shared` shortcode.
|
||||
---
|
||||
+1
-13
@@ -1,22 +1,10 @@
|
||||
---
|
||||
title: Grafana Loki configuration parameters
|
||||
menuTitle: Configure
|
||||
description: Configuration reference for the parameters used to configure Grafana Loki.
|
||||
aliases:
|
||||
- ./configuration # /docs/loki/<LOKI_VERSION>/configuration/
|
||||
weight: 400
|
||||
title: Grafana Loki configuration parameters
|
||||
---
|
||||
|
||||
# Grafana Loki configuration parameters
|
||||
|
||||
{{ .GeneratedFileWarning }}
|
||||
|
||||
Grafana Loki is configured in a YAML file (usually referred to as `loki.yaml` )
|
||||
which contains information on the Loki server and its individual components,
|
||||
depending on which mode Loki is launched in.
|
||||
|
||||
Configuration examples can be found in the [Configuration Examples]({{ `{{< relref "./examples/configuration-examples" >}}` }}) document.
|
||||
|
||||
## Printing Loki config at runtime
|
||||
|
||||
If you pass Loki the flag `-print-config-stderr` or `-log-config-reverse-order`, (or `-print-config-stderr=true`)
|
||||
Reference in New Issue
Block a user