loki: Run Grafana Loki in a container
Deploying Loki is pretty straightforward. It just needs a container unit file and a basic YAML configuration file.master
parent
45285b9c47
commit
ffe450cd30
|
@ -0,0 +1,26 @@
|
|||
package loki
|
||||
|
||||
import "du5t1n.me/cfg/base/schema/instructions"
|
||||
|
||||
templates: [...instructions.#RenderInstruction] & [
|
||||
{
|
||||
template: "loki/config.yml"
|
||||
dest: "/etc/loki/config.yml"
|
||||
hooks: {
|
||||
changed: [{run: "systemctl try-restart loki"}]
|
||||
}
|
||||
},
|
||||
{
|
||||
template: "loki/loki.container"
|
||||
dest: "/etc/containers/systemd/loki.container"
|
||||
hooks: {
|
||||
changed: [
|
||||
{
|
||||
run: "systemctl daemon-reload"
|
||||
immediate: true
|
||||
},
|
||||
{run: "systemctl restart loki"},
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
|
@ -2,10 +2,12 @@ import (
|
|||
"list"
|
||||
|
||||
"du5t1n.me/cfg/app/collectd"
|
||||
"du5t1n.me/cfg/app/loki"
|
||||
"du5t1n.me/cfg/env/prod"
|
||||
)
|
||||
|
||||
render: list.Concat([
|
||||
collectd.templates,
|
||||
loki.templates,
|
||||
prod.templates,
|
||||
])
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
auth_enabled: false
|
||||
|
||||
server:
|
||||
http_listen_port: 3100
|
||||
grpc_listen_port: 9096
|
||||
|
||||
common:
|
||||
instance_addr: 127.0.0.1
|
||||
path_prefix: /var/lib/loki
|
||||
storage:
|
||||
filesystem:
|
||||
chunks_directory: /var/lib/loki/chunks
|
||||
rules_directory: /var/lib/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: tsdb
|
||||
object_store: filesystem
|
||||
schema: v12
|
||||
index:
|
||||
prefix: index_
|
||||
period: 24h
|
||||
|
||||
query_scheduler:
|
||||
max_outstanding_requests_per_tenant: 1024
|
|
@ -0,0 +1,18 @@
|
|||
# vim: set ft=systemd :
|
||||
[Unit]
|
||||
Description=Grafana Loki
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
StateDirectory=%P
|
||||
|
||||
[Container]
|
||||
Image=docker.io/grafana/loki:2.9.4
|
||||
Exec=-config.file=/etc/loki/config.yml
|
||||
Volume=%S/%P:/var/lib/loki:rw,Z,U
|
||||
Volume=/etc/loki:/etc/loki:ro
|
||||
PublishPort=3100:3100
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue