1.3 KiB · text History d69022d
# Grafana dashboards (reusable fragment).
#   include = ["include/grafana.toml"]
# Listens on :3000 (host network). Pre-provisions Prometheus (:9090) and Loki
# (:3100) datasources, so including it alongside those fragments works out of
# the box.

# Ensure the mount point exists. The `:U,Z` volume flags below make podman
# chown the volume to the container's user (uid 472) *and* relabel it for
# SELinux (container_file_t) at startup — both are required on SELinux hosts.
[[directories]]
path = "/mnt/grafana"
mode = "0755"

[[files]]
path = "/etc/grafana/provisioning/datasources/devendra.yml"
mode = "0644"
content = """
apiVersion: 1
datasources:
  - name: Prometheus
    type: prometheus
    access: proxy
    url: http://localhost:9090
    isDefault: true
  - name: Loki
    type: loki
    access: proxy
    url: http://localhost:3100
"""

[[files]]
path = "/etc/containers/systemd/grafana.container"
mode = "0644"
content = """
[Unit]
Description=Grafana
Requires=network-online.target
After=network-online.target

[Container]
Image=docker.io/grafana/grafana:latest
Network=host
Volume=/etc/grafana/provisioning:/etc/grafana/provisioning:ro,Z
Volume=/mnt/grafana:/var/lib/grafana:U,Z
AutoUpdate=registry

[Service]
Restart=always
TimeoutStartSec=900

[Install]
WantedBy=multi-user.target
"""

[[services]]
name = "grafana.service"
enabled = true
state = "started"