From 938eaf2f5ff1346f35bd22a1b13f9dc23c78db46 Mon Sep 17 00:00:00 2001 From: Yuri Lima Date: Tue, 13 May 2025 10:58:37 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20NEW:=20Add=20Loki=20service=20an?= =?UTF-8?q?d=20configuration=20to=20Docker=20Compose=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/loki-config.yaml | 30 ++++++++++++++++++++++++++++++ docker-compose.yml | 25 ++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 config/loki-config.yaml diff --git a/config/loki-config.yaml b/config/loki-config.yaml new file mode 100644 index 0000000..4f419e8 --- /dev/null +++ b/config/loki-config.yaml @@ -0,0 +1,30 @@ +--- +auth_enabled: false + +server: + http_listen_port: 3100 + +common: + instance_addr: 127.0.0.1 + path_prefix: /loki + storage: + filesystem: + chunks_directory: /loki/chunks + rules_directory: /loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + +schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +ruler: + alertmanager_url: http://localhost:9093 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 596596e..03bdf04 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ volumes: driver: local prometheus-data: driver: local + data_loki: + driver: local networks: grafana-prometheus: external: true @@ -58,6 +60,26 @@ services: restart: unless-stopped networks: - grafana-prometheus + loki: + container_name: loki + image: docker.io/grafana/loki:3.5.0 + command: "-config.file=/etc/loki/config.yaml" # Tells Grafana Loki to start with the config file. + ports: + # --> (Optional) Remove when using traefik... + - "3100:3100" + # <-- + volumes: + - ./config/loki-config.yaml:/etc/loki/config.yaml:ro + - data_loki:/loki:rw + networks: + - grafana-prometheus + restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "--spider", "-q", "http://localhost:3100/ready"] + interval: 10s # check every 10 seconds + timeout: 5s # wait max 5 seconds per check + retries: 5 # mark as unhealthy after 5 failures + start_period: 20s # wait 20s after container starts before first check https_portal: container_name: https_portal image: "steveltn/https-portal:1.21" @@ -81,4 +103,5 @@ services: - ./https_portal/log:/var/log/nginx # nginx logs depends_on: - prometheus - - grafana \ No newline at end of file + - grafana + - loki \ No newline at end of file