|
| 1 | +# Loki |
| 2 | + |
| 3 | +The [Loki](https://github.com/grafana/loki) project is a log aggregation system |
| 4 | +designed to store and query logs from multiple sources. It's part of the |
| 5 | +[Grafana](https://github.com/grafana/grafana) ecosystem and optimizing for |
| 6 | +cost-effective and efficient log storage. Loki's design is to work seamlessly |
| 7 | +with Grafana for visualization and Prometheus for metrics. |
| 8 | + |
| 9 | +## Makefile Overview |
| 10 | + |
| 11 | +This Makefile manages the Loki Helm chart, which simplifies the deployment and |
| 12 | +management of Loki in a Kubernetes environment. The Makefile provides targets |
| 13 | +to automate common tasks such as pulling the latest Loki YAML configuration, |
| 14 | +upgrading Loki, and ensure required tools are present. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +Before using the Makefile, ensure you have the following tools installed: |
| 19 | + |
| 20 | +- `helm` |
| 21 | + |
| 22 | +### Makefile Targets |
| 23 | + |
| 24 | +- **all**: This is the default target that runs `check-tools`, `clean`, and |
| 25 | +`manifests` targets in sequence. |
| 26 | +- **init**: Adds the Grafana Helm repository and updates the Helm repository |
| 27 | +index. |
| 28 | +- **manifests**: Removes the previous Loki YAML file and pulls the latest Loki |
| 29 | +YAML configuration from the Helm chart using the specified `values.yaml` file. |
| 30 | +- **upgrade**: Removes the previous Loki YAML file and upgrades the Loki |
| 31 | +deployment using the latest configuration from the Helm chart. |
| 32 | +- **check-tools**: Ensures that the required tools (e.g., Helm) are available |
| 33 | +on the system. |
| 34 | +- **help**: Displays usage information for the Makefile targets. |
| 35 | + |
| 36 | +### Usage |
| 37 | + |
| 38 | +1. **Initialize Helm Repository** |
| 39 | + |
| 40 | + Before using the Makefile, you need to initialize the Helm repository: |
| 41 | + |
| 42 | + ```sh |
| 43 | + make init |
| 44 | + ``` |
| 45 | + |
| 46 | +2. **Generate Loki Manifests** |
| 47 | + |
| 48 | + To generate the Loki YAML configuration file, run: |
| 49 | + |
| 50 | + ```sh |
| 51 | + make manifests |
| 52 | + ``` |
| 53 | + |
| 54 | + This will remove the previous `loki.yaml` file and pull the latest |
| 55 | + configuration from the Helm chart. |
| 56 | + |
| 57 | +3. **Upgrade Loki** |
| 58 | + |
| 59 | + To upgrade the Loki deployment with the latest configuration, run: |
| 60 | + |
| 61 | + ```sh |
| 62 | + make upgrade |
| 63 | + ``` |
| 64 | + |
| 65 | + This will remove the previous `loki.yaml` file and upgrade the Loki deployment. |
| 66 | + |
| 67 | +4. **Check Required Tools** |
| 68 | + |
| 69 | + Ensure the installation of required tools by running: |
| 70 | + |
| 71 | + ```sh |
| 72 | + make check-tools |
| 73 | + ``` |
| 74 | + |
| 75 | + This will check that Helm is available on your system. |
| 76 | + |
| 77 | +5. **Display Help** |
| 78 | + |
| 79 | + To display the help message with information about the Makefile targets, run: |
| 80 | + |
| 81 | + ```sh |
| 82 | + make help |
| 83 | + ``` |
| 84 | + |
| 85 | +### Default Variables |
| 86 | + |
| 87 | +- **DEFAULT_VERSION**: The default version of Loki to use (e.g., `6.22.0`). |
| 88 | +- **LOKI_VERSION**: The version of Loki to use, which can be overridden by |
| 89 | +setting this variable. |
| 90 | +- **LOKI_OUTPUT_YAML**: The output file for the Loki YAML configuration |
| 91 | +(default: `vendor/loki.yaml`). |
| 92 | +- **VALUES_FILE**: The path to the `values.yaml` file used for Helm configuration. |
| 93 | + |
| 94 | +### Example |
| 95 | + |
| 96 | +To generate the Loki manifests using a specific version and values file, you |
| 97 | +can run: |
| 98 | + |
| 99 | +```sh |
| 100 | +make LOKI_VERSION=2.4.1 VALUES_FILE=/path/to/your/values.yaml manifests |
| 101 | +``` |
| 102 | + |
| 103 | +This will pull the specified version of Loki and use the provided `values.yaml` |
| 104 | +file for configuration. |
0 commit comments