From ef4e6e06c203a1a769e9ac4d9f518380503ba772 Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 16:14:01 +0900 Subject: [PATCH 1/6] feat(infra): modify docker-compose.yml to add loki-aws container & modify each ports --- grafana/docker-compose.yml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml index fb6a3b1..2f73637 100644 --- a/grafana/docker-compose.yml +++ b/grafana/docker-compose.yml @@ -8,7 +8,7 @@ services: image: grafana/loki:2.9.0 container_name: loki-test ports: - - "3100:3100" + - "3199:3199" volumes: - '$PWD/loki-config-test.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml @@ -19,12 +19,24 @@ services: image: grafana/loki:2.9.0 container_name: loki-stage ports: - - "3200:3100" + - "3101:3101" volumes: - '$PWD/loki-config-stage.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml networks: - - loki + - loki + + loki-aws: + image: grafana/loki:2.9.0 + container_name: loki-aws + ports: + - "3199:3199" + volumes: + - '$PWD/loki-config-aws.yml:/etc/loki/loki-config.yml' + command: -config.file=/etc/loki/loki-config.yml + networks: + - loki + grafana: image: grafana/grafana:latest From 733d9015b2d55692a8335bdd280de0219e975ebc Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 16:35:32 +0900 Subject: [PATCH 2/6] feat(infra): modify loki config yaml file & Caddyfile to modify ports --- grafana/Caddyfile | 16 ++++++++--- grafana/loki-config-aws.yml | 50 +++++++++++++++++++++++++++++++++++ grafana/loki-config-stage.yml | 2 +- grafana/loki-config-test.yml | 2 +- 4 files changed, 65 insertions(+), 5 deletions(-) create mode 100644 grafana/loki-config-aws.yml diff --git a/grafana/Caddyfile b/grafana/Caddyfile index 21bbb81..63eaff2 100644 --- a/grafana/Caddyfile +++ b/grafana/Caddyfile @@ -1,7 +1,17 @@ grafana.codedang.com { - handle /loki/* { - uri strip_prefix /loki - reverse_proxy 127.0.0.1:3200 + handle /lokiaws { + uri strip_prefix /lokiaws + reverse_proxy 127.0.0.1:3100 + } + + handle /lokistage { + uri strip_prefix /lokistage + reverse_proxy 127.0.0.1:3101 + } + + handle /lokitest { + uri strip_prefix /lokitest + reverse_proxy 127.0.0.1:3199 } handle { diff --git a/grafana/loki-config-aws.yml b/grafana/loki-config-aws.yml new file mode 100644 index 0000000..68c3c9f --- /dev/null +++ b/grafana/loki-config-aws.yml @@ -0,0 +1,50 @@ +auth_enabled: false + +server: + http_listen_port: 3100 + grpc_listen_port: 9096 + +common: + instance_addr: 127.0.0.1 + path_prefix: /tmp/loki + storage: + filesystem: + chunks_directory: /tmp/loki/chunks + rules_directory: /tmp/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory + +query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 + +schema_config: + configs: + - from: 2020-10-24 + store: boltdb-shipper + object_store: filesystem + schema: v11 + index: + prefix: index_ + period: 24h + +ruler: + alertmanager_url: http://localhost:9093 + +# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration +# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/ +# +# Statistics help us better understand how Loki is used, and they show us performance +# levels for most users. This helps us prioritize features and documentation. +# For more information on what's sent, look at +# https://github.com/grafana/loki/blob/main/pkg/usagestats/stats.go +# Refer to the buildReport method to see what goes into a report. +# +# If you would like to disable reporting, uncomment the following lines: +#analytics: +# reporting_enabled: false diff --git a/grafana/loki-config-stage.yml b/grafana/loki-config-stage.yml index 68c3c9f..4b1e99d 100644 --- a/grafana/loki-config-stage.yml +++ b/grafana/loki-config-stage.yml @@ -1,7 +1,7 @@ auth_enabled: false server: - http_listen_port: 3100 + http_listen_port: 3101 grpc_listen_port: 9096 common: diff --git a/grafana/loki-config-test.yml b/grafana/loki-config-test.yml index 68c3c9f..a3cfdb1 100644 --- a/grafana/loki-config-test.yml +++ b/grafana/loki-config-test.yml @@ -1,7 +1,7 @@ auth_enabled: false server: - http_listen_port: 3100 + http_listen_port: 3199 grpc_listen_port: 9096 common: From 7415b2b10cc81f02332db1d3e209aa7c6f7eb315 Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 16:45:54 +0900 Subject: [PATCH 3/6] chore(infra): port typo --- grafana/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml index 2f73637..fc38b69 100644 --- a/grafana/docker-compose.yml +++ b/grafana/docker-compose.yml @@ -8,7 +8,7 @@ services: image: grafana/loki:2.9.0 container_name: loki-test ports: - - "3199:3199" + - "3100:3100" volumes: - '$PWD/loki-config-test.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml @@ -25,7 +25,7 @@ services: command: -config.file=/etc/loki/loki-config.yml networks: - loki - + loki-aws: image: grafana/loki:2.9.0 container_name: loki-aws From 80086eaa01e3433eddfcd27b7b236c1d6603539e Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 16:51:15 +0900 Subject: [PATCH 4/6] feat(infra): modify container port to loki default port(3100) --- grafana/docker-compose.yml | 6 +++--- grafana/loki-config-stage.yml | 2 +- grafana/loki-config-test.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml index fc38b69..0ccb44f 100644 --- a/grafana/docker-compose.yml +++ b/grafana/docker-compose.yml @@ -8,7 +8,7 @@ services: image: grafana/loki:2.9.0 container_name: loki-test ports: - - "3100:3100" + - "3199:3100" volumes: - '$PWD/loki-config-test.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml @@ -19,7 +19,7 @@ services: image: grafana/loki:2.9.0 container_name: loki-stage ports: - - "3101:3101" + - "3101:3100" volumes: - '$PWD/loki-config-stage.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml @@ -30,7 +30,7 @@ services: image: grafana/loki:2.9.0 container_name: loki-aws ports: - - "3199:3199" + - "3100:3100" volumes: - '$PWD/loki-config-aws.yml:/etc/loki/loki-config.yml' command: -config.file=/etc/loki/loki-config.yml diff --git a/grafana/loki-config-stage.yml b/grafana/loki-config-stage.yml index 4b1e99d..68c3c9f 100644 --- a/grafana/loki-config-stage.yml +++ b/grafana/loki-config-stage.yml @@ -1,7 +1,7 @@ auth_enabled: false server: - http_listen_port: 3101 + http_listen_port: 3100 grpc_listen_port: 9096 common: diff --git a/grafana/loki-config-test.yml b/grafana/loki-config-test.yml index a3cfdb1..68c3c9f 100644 --- a/grafana/loki-config-test.yml +++ b/grafana/loki-config-test.yml @@ -1,7 +1,7 @@ auth_enabled: false server: - http_listen_port: 3199 + http_listen_port: 3100 grpc_listen_port: 9096 common: From e36c0347b4b3683d2554c93d60559c9f4be4607b Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 16:53:58 +0900 Subject: [PATCH 5/6] chore(infra): modify Caddyfile url to add /* --- grafana/Caddyfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grafana/Caddyfile b/grafana/Caddyfile index 63eaff2..7cde254 100644 --- a/grafana/Caddyfile +++ b/grafana/Caddyfile @@ -1,15 +1,15 @@ grafana.codedang.com { - handle /lokiaws { + handle /lokiaws/* { uri strip_prefix /lokiaws reverse_proxy 127.0.0.1:3100 } - handle /lokistage { + handle /lokistage/* { uri strip_prefix /lokistage reverse_proxy 127.0.0.1:3101 } - handle /lokitest { + handle /lokitest/* { uri strip_prefix /lokitest reverse_proxy 127.0.0.1:3199 } From 7bfeae17cbad5d0d59025b6aa8879d0aa1b55296 Mon Sep 17 00:00:00 2001 From: Kang-Eunsu Date: Thu, 18 Jan 2024 17:05:48 +0900 Subject: [PATCH 6/6] chore(infra): erase loki stage from Caddyfile --- grafana/Caddyfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/grafana/Caddyfile b/grafana/Caddyfile index 7cde254..ddffbc1 100644 --- a/grafana/Caddyfile +++ b/grafana/Caddyfile @@ -3,11 +3,6 @@ grafana.codedang.com { uri strip_prefix /lokiaws reverse_proxy 127.0.0.1:3100 } - - handle /lokistage/* { - uri strip_prefix /lokistage - reverse_proxy 127.0.0.1:3101 - } handle /lokitest/* { uri strip_prefix /lokitest