Move standalone examples to a new top-level section (#10794)

**What this PR does / why we need it**:

Moves the standalone examples inside the _Configuration_ section to a
new top-level _Examples_ section.
We can use this section to add more examples in the future.

---------

Co-authored-by: Ashwanth <iamashwanth@gmail.com>
Co-authored-by: J Stickler <julie.stickler@grafana.com>
pull/10893/head^2
Salva Corts 2 years ago committed by GitHub
parent ec54c723eb
commit 214c4444be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      Makefile
  2. 2
      docs/sources/configure/_index.md
  3. 13
      docs/sources/configure/examples/_index.md
  4. 7
      docs/sources/configure/examples/configuration-examples.md
  5. 5
      docs/sources/configure/examples/query-frontend.md
  6. 0
      docs/sources/configure/examples/yaml/1-Local-Configuration-Example.yaml
  7. 0
      docs/sources/configure/examples/yaml/10-Expanded-S3-Snippet.yaml
  8. 0
      docs/sources/configure/examples/yaml/11-COS-HMAC-Example.yaml
  9. 0
      docs/sources/configure/examples/yaml/12-COS-APIKey-Example.yaml
  10. 0
      docs/sources/configure/examples/yaml/13-COS-Trusted-Profile-Example.yaml
  11. 0
      docs/sources/configure/examples/yaml/15-Memberlist-Ring-Snippet.yaml
  12. 0
      docs/sources/configure/examples/yaml/16-(Deprecated)-Cassandra-Snippet.yaml
  13. 0
      docs/sources/configure/examples/yaml/17-(Deprecated)-S3-And-DynamoDB-Snippet.yaml
  14. 0
      docs/sources/configure/examples/yaml/2-S3-Cluster-Example.yaml
  15. 0
      docs/sources/configure/examples/yaml/3-S3-Without-Credentials-Snippet.yaml
  16. 0
      docs/sources/configure/examples/yaml/4-GCS-Example.yaml
  17. 0
      docs/sources/configure/examples/yaml/5-BOS-Example.yaml
  18. 0
      docs/sources/configure/examples/yaml/6-Compactor-Snippet.yaml
  19. 0
      docs/sources/configure/examples/yaml/7-Schema-Migration-Snippet.yaml
  20. 0
      docs/sources/configure/examples/yaml/8-alibaba-cloud-storage-Snippet.yaml
  21. 0
      docs/sources/configure/examples/yaml/9-S3-With-SSE-KMS-Snippet.yaml
  22. 0
      docs/sources/configure/examples/yaml/README.txt
  23. 2
      docs/sources/configure/index.template

@ -786,33 +786,34 @@ check-doc: doc
################### ###################
# Example Configs # # Example Configs #
################### ###################
CONFIG_DOC_PATH := $(DOC_SOURCES_PATH)/configure EXAMPLES_DOC_PATH := $(DOC_SOURCES_PATH)/configure/examples
CONFIG_EXAMPLES_PATH := $(CONFIG_DOC_PATH)/examples EXAMPLES_DOC_OUTPUT_PATH := $(EXAMPLES_DOC_PATH)/configuration-examples.md
CONFIG_EXAMPLES_SKIP_VALIDATION_FLAG := "doc-example:skip-validation=true" EXAMPLES_YAML_PATH := $(EXAMPLES_DOC_PATH)/yaml
EXAMPLES_SKIP_VALIDATION_FLAG := "doc-example:skip-validation=true"
# Validate the example configurations that we provide in ./docs/sources/configure/examples # Validate the example configurations that we provide in ./docs/sources/configure/examples
# We run the validation only for complete examples, not snippets. # We run the validation only for complete examples, not snippets.
# Complete examples should contain "Example" in their file name. # Complete examples should contain "Example" in their file name.
validate-example-configs: loki validate-example-configs: loki
for f in $$(grep -rL $(CONFIG_EXAMPLES_SKIP_VALIDATION_FLAG) $(CONFIG_EXAMPLES_PATH)/*.yaml); do echo "Validating provided example config: $$f" && ./cmd/loki/loki -config.file=$$f -verify-config || exit 1; done for f in $$(grep -rL $(EXAMPLES_SKIP_VALIDATION_FLAG) $(EXAMPLES_YAML_PATH)/*.yaml); do echo "Validating provided example config: $$f" && ./cmd/loki/loki -config.file=$$f -verify-config || exit 1; done
# Dynamically generate ./docs/sources/configure/examples.md using the example configs that we provide. # Dynamically generate ./docs/sources/configure/examples.md using the example configs that we provide.
# This target should be run if any of our example configs change. # This target should be run if any of our example configs change.
generate-example-config-doc: generate-example-config-doc:
echo "Removing existing doc at $(CONFIG_DOC_PATH)/examples.md and re-generating. . ." echo "Removing existing doc at $(EXAMPLES_DOC_OUTPUT_PATH) and re-generating. . ."
# Title and Heading # Title and Heading
echo -e "---\ntitle: Examples\ndescription: Loki Configuration Examples\n---\n # Examples" > $(CONFIG_DOC_PATH)/examples.md echo -e "---\ntitle: Configuration\ndescription: Loki Configuration Examples and Snippets\nweight: 100\n---\n# Configuration" > $(EXAMPLES_DOC_OUTPUT_PATH)
# Append each configuration and its file name to examples.md # Append each configuration and its file name to examples.md
for f in $$(find $(CONFIG_EXAMPLES_PATH)/*.yaml -printf "%f\n" | sort -k1n); do \ for f in $$(find $(EXAMPLES_YAML_PATH)/*.yaml -printf "%f\n" | sort -k1n); do \
echo -e "\n## $$f\n\n\`\`\`yaml\n" >> $(CONFIG_DOC_PATH)/examples.md; \ echo -e "\n## $$f\n\n\`\`\`yaml\n" >> $(EXAMPLES_DOC_OUTPUT_PATH); \
grep -v $(CONFIG_EXAMPLES_SKIP_VALIDATION_FLAG) $(CONFIG_EXAMPLES_PATH)/$$f >> $(CONFIG_DOC_PATH)/examples.md; \ grep -v $(EXAMPLES_SKIP_VALIDATION_FLAG) $(EXAMPLES_YAML_PATH)/$$f >> $(EXAMPLES_DOC_OUTPUT_PATH); \
echo -e "\n\`\`\`\n" >> $(CONFIG_DOC_PATH)/examples.md; \ echo -e "\n\`\`\`\n" >> $(EXAMPLES_DOC_OUTPUT_PATH); \
done done
# Fail our CI build if changes are made to example configurations but our doc is not updated # Fail our CI build if changes are made to example configurations but our doc is not updated
check-example-config-doc: generate-example-config-doc check-example-config-doc: generate-example-config-doc
@if ! (git diff --exit-code ./docs/sources/configure/examples.md); then \ @if ! (git diff --exit-code $(EXAMPLES_DOC_OUTPUT_PATH)); then \
echo -e "\nChanges found in generated example configuration doc"; \ echo -e "\nChanges found in generated example configuration doc"; \
echo "Run 'make generate-example-config-doc' and commit the changes to fix this error."; \ echo "Run 'make generate-example-config-doc' and commit the changes to fix this error."; \
echo "If you are actively developing these files you can ignore this error"; \ echo "If you are actively developing these files you can ignore this error"; \

@ -15,7 +15,7 @@ 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, which contains information on the Loki server and its individual components,
depending on which mode Loki is launched in. depending on which mode Loki is launched in.
Configuration examples can be found in the [Configuration Examples]({{< relref "./examples" >}}) document. Configuration examples can be found in the [Configuration Examples]({{< relref "./examples/configuration-examples" >}}) document.
## Printing Loki config at runtime ## Printing Loki config at runtime

@ -0,0 +1,13 @@
---
title: Examples
menuTitle: Examples
description: Examples to help you run Grafana Loki.
weight: 800
---
# Examples
The following pages contain examples of how to configure Grafana Loki.
- [Configuration snippets and ready-to-use configuration examples]({{< relref "./configuration-examples" >}}).
- [Deploy a query frontend on a existing cluster]({{< relref "./query-frontend" >}}).

@ -1,8 +1,9 @@
--- ---
title: Examples title: Configuration
description: Loki Configuration Examples description: Loki Configuration Examples and Snippets
weight: 100
--- ---
# Examples # Configuration
## 1-Local-Configuration-Example.yaml ## 1-Local-Configuration-Example.yaml

@ -1,10 +1,7 @@
--- ---
title: Query frontend example title: Query frontend example
menuTitle: menuTitle:
description: Kubernetes query frontent example. description: Kubernetes query frontend example.
aliases:
- ../configuration/query-frontend/
- ../configure/query-frontend/
weight: 200 weight: 200
--- ---
# Query frontend example # Query frontend example

@ -15,7 +15,7 @@ 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, which contains information on the Loki server and its individual components,
depending on which mode Loki is launched in. depending on which mode Loki is launched in.
Configuration examples can be found in the [Configuration Examples]({{ `{{< relref "./examples" >}}` }}) document. Configuration examples can be found in the [Configuration Examples]({{ `{{< relref "./examples/configuration-examples" >}}` }}) document.
## Printing Loki config at runtime ## Printing Loki config at runtime

Loading…
Cancel
Save