From ea4557c65af77c6a8f1fc8be82c816aef4a06ec6 Mon Sep 17 00:00:00 2001 From: "Grot (@grafanabot)" <43478413+grafanabot@users.noreply.github.com> Date: Thu, 2 May 2024 16:36:29 +0100 Subject: [PATCH] chore: [release-3.0.x] docs: Update docker installation topic (#12861) Co-authored-by: J Stickler --- .../send-data/promtail/installation.md | 63 ++++++---- docs/sources/setup/install/docker.md | 117 ++++++++++++++---- 2 files changed, 127 insertions(+), 53 deletions(-) diff --git a/docs/sources/send-data/promtail/installation.md b/docs/sources/send-data/promtail/installation.md index 2daa12638083..4d2359e94c17 100644 --- a/docs/sources/send-data/promtail/installation.md +++ b/docs/sources/send-data/promtail/installation.md @@ -23,43 +23,52 @@ See the instructions [here](https://grafana.com/docs/loki//setup/i ## Install using Docker -```bash -# modify tag to most recent version -docker pull grafana/promtail:2.9.2 -``` +1. Make sure to modify the tag to the most recent version. + + ```bash + docker pull grafana/promtail:3.0.0 + ``` + +1. Create your Promtail configuration file in a file called `promtail-config.yaml`. Refer to the [Promtail configuration reference](https://grafana.com/docs/loki//send-data/promtail/configuration/) for more details. + +1. Note that you will need to replace `` in the commands with your local path. + + ```bash + docker run -v :/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.0.0 --config.file=/mnt/config/promtail-config.yaml + ``` ## Install using Helm -Make sure that Helm is installed. -See [Installing Helm](https://helm.sh/docs/intro/install/). -Then you can add Grafana's chart repository to Helm: +1. Make sure that Helm is installed. See [Installing Helm](https://helm.sh/docs/intro/install/). -```bash -helm repo add grafana https://grafana.github.io/helm-charts -``` +1. Then you can add Grafana's chart repository to Helm: -And the chart repository can be updated by running: + ```bash + helm repo add grafana https://grafana.github.io/helm-charts + ``` -```bash -helm repo update -``` +1. Update the chart repository: -Create the configuration file `values.yaml`. The example below illustrates a connection to the locally deployed loki server: + ```bash + helm repo update + ``` -```yaml -config: - # publish data to loki - clients: - - url: http://loki-gateway/loki/api/v1/push - tenant_id: 1 -``` +1. Create the configuration file `values.yaml`. The example below illustrates a connection to the locally deployed loki server: -Finally, Promtail can be deployed with: + ```yaml + config: + # publish data to loki + clients: + - url: http://loki-gateway/loki/api/v1/push + tenant_id: 1 + ``` -```bash -# The default helm configuration deploys promtail as a daemonSet (recommended) -helm upgrade --values values.yaml --install promtail grafana/promtail -``` +1. Finally, Promtail can be deployed with: + + ```bash + # The default helm configuration deploys promtail as a daemonSet (recommended) + helm upgrade --values values.yaml --install promtail grafana/promtail + ``` ## Install as Kubernetes daemonSet (recommended) diff --git a/docs/sources/setup/install/docker.md b/docs/sources/setup/install/docker.md index 8e9007c0fdf4..de2006250a7c 100644 --- a/docs/sources/setup/install/docker.md +++ b/docs/sources/setup/install/docker.md @@ -9,55 +9,120 @@ weight: 400 # Install Loki with Docker or Docker Compose You can install Loki and Promtail with Docker or Docker Compose if you are evaluating, testing, or developing Loki. -For production, Grafana recommends installing with Tanka or Helm. +For production, Grafana recommends installing with Helm or Tanka. -The configuration acquired with these installation instructions run Loki as a single binary. +The configuration files associated with these installation instructions run Loki as a single binary. ## Prerequisites - [Docker](https://docs.docker.com/install) - [Docker Compose](https://docs.docker.com/compose/install) (optional, only needed for the Docker Compose install method) -## Install with Docker +## Install with Docker on Linux -**Linux** +1. Create a directory called `loki`. Make `loki` your current working directory: -Copy and paste the commands below into your command line. + ```bash + mkdir loki + cd loki + ``` -```bash -wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/cmd/loki/loki-local-config.yaml -O loki-config.yaml -docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:2.9.2 -config.file=/mnt/config/loki-config.yaml -wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml -docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.9.2 -config.file=/mnt/config/promtail-config.yaml -``` +1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. + + ```bash + wget https://raw.githubusercontent.com/grafana/loki/v3.0.0/cmd/loki/loki-local-config.yaml -O loki-config.yaml + wget https://raw.githubusercontent.com/grafana/loki/v3.0.0/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml + ``` + +1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. + + ```bash + docker run --name loki -d -v $(pwd):/mnt/config -p 3100:3100 grafana/loki:3.0.0 -config.file=/mnt/config/loki-config.yaml + docker run --name promtail -d -v $(pwd):/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.0.0 -config.file=/mnt/config/promtail-config.yaml + ``` + + {{< admonition type="note" >}} + The image is configured to run by default as user `loki` with UID `10001` and GID `10001`. You can use a different user, specially if you are using bind mounts, by specifying the UID with a `docker run` command and using `--user=UID` with a numeric UID suited to your needs. + {{< /admonition >}} + +1. Verify that your containers are running: -When finished, `loki-config.yaml` and `promtail-config.yaml` are downloaded in the directory you chose. Docker containers are running Loki and Promtail using those config files. + ```bash + docker container ls + ``` -Navigate to http://localhost:3100/metrics to view the metrics and http://localhost:3100/ready for readiness. + You should see something similar to the following: -The image is configured to run by default as user loki with UID `10001` and GID `10001`. You can use a different user, specially if you are using bind mounts, by specifying the UID with a `docker run` command and using `--user=UID` with numeric UID suited to your needs. + ```bash -**Windows** + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + 9485de9ad351 grafana/promtail:3.0.0 "/usr/bin/promtail -…" About a minute ago Up About a minute promtail + cece1df84519 grafana/loki:3.0.0 "/usr/bin/loki -conf…" About a minute ago Up About a minute 0.0.0.0:3100->3100/tcp, :::3100->3100/tcp loki + ``` -Copy and paste the commands below into your terminal. Note that you will need to replace the `` in the commands with your local path. +1. Verify that Loki is up and running. + + - To view readiness, navigate to http://localhost:3100/ready. + - To view metrics, navigate to http://localhost:3100/metrics. + +## Install with Docker on Windows + +1. Copy and paste the following commands into your command line to download `loki-local-config.yaml` and `promtail-docker-config.yaml` to your `loki` directory. Note that you will need to replace the `` in the commands with your local path. ```bash cd "" -wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/cmd/loki/loki-local-config.yaml -O loki-config.yaml -docker run --name loki -v :/mnt/config -p 3100:3100 grafana/loki:2.9.2 --config.file=/mnt/config/loki-config.yaml -wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml -docker run -v :/mnt/config -v /var/log:/var/log --link loki grafana/promtail:2.9.2 --config.file=/mnt/config/promtail-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v3.0.0/cmd/loki/loki-local-config.yaml -O loki-config.yaml +wget https://raw.githubusercontent.com/grafana/loki/v3.0.0/clients/cmd/promtail/promtail-docker-config.yaml -O promtail-config.yaml ``` -When finished, `loki-config.yaml` and `promtail-config.yaml` are downloaded in the directory you chose. Docker containers are running Loki and Promtail using those config files. +1. Copy and paste the following commands into your command line to start the Docker containers using the configuration files you downloaded in the previous step. Note that you will need to replace the `` in the commands with your local path. + +```bash +docker run --name loki -v :/mnt/config -p 3100:3100 grafana/loki:3.0.0 --config.file=/mnt/config/loki-config.yaml +docker run -v :/mnt/config -v /var/log:/var/log --link loki grafana/promtail:3.0.0 --config.file=/mnt/config/promtail-config.yaml +``` -Navigate to http://localhost:3100/metrics to view the output. +1. Verify that Loki is up and running. + + - To view readiness, navigate to http://localhost:3100/ready. + - To view metrics, navigate to http://localhost:3100/metrics. ## Install with Docker Compose Run the following commands in your command line. They work for Windows or Linux systems. -```bash -wget https://raw.githubusercontent.com/grafana/loki/v2.9.2/production/docker-compose.yaml -O docker-compose.yaml -docker-compose -f docker-compose.yaml up -``` +1. Create a directory called `loki`. Make `loki` your current working directory: + + ```bash + mkdir loki + cd loki + ``` + +1. Copy and paste the following command into your command line to download the `docker-compose` file. + + ```bash + wget https://raw.githubusercontent.com/grafana/loki/v3.0.0/production/docker-compose.yaml -O docker-compose.yaml + ``` + +1. With `loki` as the current working directory, run the following 'docker-compose` command: + + ```bash + docker-compose -f docker-compose.yaml up + ``` + + You should see something similar to the following: + + ```bash + ✔ Container mydevice-minio-1 Started 0.0s + ✔ Container mydevice-flog-1 Started 0.0s + ✔ Container mydevice-write-1 Started 0.0s + ✔ Container mydevice-read-1 Started 0.0s + ✔ Container mydevice-gateway-1 Started 0.0s + ✔ Container mydevice-grafana-1 Started 0.0s + ✔ Container mydevice-promtail-1 Started 0.0s + ``` + +1. Verify that Loki is up and running. + + - To view readiness, navigate to http://localhost:3100/ready. + - To view metrics, navigate to http://localhost:3100/metrics.