-
-
Save wardbekker/6abde118f530a725e60acb5adb04508a to your computer and use it in GitHub Desktop.
Loki Simple Scalable Deployment Mode Docker Compose config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
version: "3" | |
networks: | |
loki: | |
services: | |
read: | |
image: grafana/loki:2.4.1 | |
command: "-config.file=/etc/loki/config.yaml -target=read" | |
ports: | |
- 3100 | |
- 7946 | |
- 9095 | |
volumes: | |
- ./loki-config.yaml:/etc/loki/config.yaml | |
depends_on: | |
- minio | |
networks: &loki-dns | |
loki: | |
aliases: | |
- loki | |
write: | |
image: grafana/loki:2.4.1 | |
command: "-config.file=/etc/loki/config.yaml -target=write" | |
ports: | |
- 3100 | |
- 7946 | |
- 9095 | |
volumes: | |
- ./loki-config.yaml:/etc/loki/config.yaml | |
depends_on: | |
- minio | |
networks: | |
<<: *loki-dns | |
minio: | |
image: minio/minio | |
entrypoint: | |
- sh | |
- -euc | |
- | | |
mkdir -p /data/loki-data && \ | |
mkdir -p /data/loki-ruler && \ | |
minio server /data | |
environment: | |
- MINIO_ACCESS_KEY=loki | |
- MINIO_SECRET_KEY=supersecret | |
- MINIO_PROMETHEUS_AUTH_TYPE=public | |
- MINIO_UPDATE=off | |
ports: | |
- 9000 | |
volumes: | |
- ./.data/minio:/data | |
networks: | |
- loki | |
grafana: | |
image: grafana/grafana:latest | |
environment: | |
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning | |
- GF_AUTH_ANONYMOUS_ENABLED=true | |
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin | |
depends_on: | |
- gateway | |
entrypoint: | |
- sh | |
- -euc | |
- | | |
mkdir -p /etc/grafana/provisioning/datasources | |
cat <<EOF > /etc/grafana/provisioning/datasources/ds.yaml | |
apiVersion: 1 | |
datasources: | |
- name: Loki | |
type: loki | |
access: proxy | |
url: http://gateway:3100 | |
jsonData: | |
httpHeaderName1: "X-Scope-OrgID" | |
secureJsonData: | |
httpHeaderValue1: "tenant1" | |
EOF | |
/run.sh | |
ports: | |
- "3000:3000" | |
networks: | |
- loki | |
gateway: | |
image: nginx:latest | |
depends_on: | |
- read | |
- write | |
entrypoint: | |
- sh | |
- -euc | |
- | | |
cat <<EOF > /etc/nginx/nginx.conf | |
user nginx; | |
worker_processes 16; ## Default: 1 | |
events { | |
worker_connections 1000; | |
} | |
http { | |
resolver 127.0.0.11; | |
server { | |
listen 3100; | |
location = / { | |
return 200 'OK'; | |
auth_basic off; | |
} | |
location = /api/prom/push { | |
proxy_pass http://write:3100\$$request_uri; | |
} | |
location = /api/prom/tail { | |
proxy_pass http://read:3100\$$request_uri; | |
proxy_set_header Upgrade \$$http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
location ~ /api/prom/.* { | |
proxy_pass http://read:3100\$$request_uri; | |
} | |
location = /loki/api/v1/push { | |
proxy_pass http://write:3100\$$request_uri; | |
} | |
location = /loki/api/v1/tail { | |
proxy_pass http://read:3100\$$request_uri; | |
proxy_set_header Upgrade \$$http_upgrade; | |
proxy_set_header Connection "upgrade"; | |
} | |
location ~ /loki/api/.* { | |
proxy_pass http://read:3100\$$request_uri; | |
} | |
} | |
} | |
EOF | |
/docker-entrypoint.sh nginx -g "daemon off;" | |
ports: | |
- "3100:3100" | |
networks: | |
- loki |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
server: | |
http_listen_port: 3100 | |
http_server_read_timeout: 10m | |
http_server_write_timeout: 10m | |
http_server_idle_timeout: 10m | |
memberlist: | |
join_members: | |
- loki:7946 | |
limits_config: | |
per_stream_rate_limit: 0 | |
query_range: | |
split_queries_by_interval: 10m | |
cache_results: true | |
schema_config: | |
configs: | |
- from: 2021-08-01 | |
store: boltdb-shipper | |
object_store: s3 | |
schema: v11 | |
index: | |
prefix: index_ | |
period: 24h | |
common: | |
path_prefix: /loki | |
replication_factor: 1 | |
storage: | |
s3: | |
endpoint: minio:9000 | |
insecure: true | |
bucketnames: loki-data | |
access_key_id: loki | |
secret_access_key: supersecret | |
s3forcepathstyle: true | |
ring: | |
kvstore: | |
store: memberlist | |
ruler: | |
storage: | |
s3: | |
bucketnames: loki-ruler |
Hi,
nothing work for me on swarm cluster with 2.9.1....
for a full updated official version see: https://github.com/grafana/loki/tree/main/examples/getting-started
There the new tsdb shipper is used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@wardbekker i apreciate your config for simple scalable method!
Is there any example code to setup this on multiples nodes ? just to separate READ and write instances
Thank you for helps