Skip to content

Commit

Permalink
Update Grafana, build plugins
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps committed Jan 27, 2025
1 parent 80b4c15 commit aed112f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
16 changes: 16 additions & 0 deletions packages/extra/monitoring/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
GRAFANA_TAG = $(shell awk '$$1 == "version:" {print $$2}' Chart.yaml)

NAME=monitoring

include ../../../scripts/common-envs.mk
include ../../../scripts/package.mk

generate:
Expand All @@ -8,3 +11,16 @@ generate:
jq '.properties.metricsStorages.items.type = "object" | .properties.logsStorages.items.type = "object"' \
> values.schema.json
rm -f values.schema.json.tmp

image:
docker buildx build --platform linux/amd64 images/grafana \
--provenance false \
--tag $(REGISTRY)/grafana:$(call settag,$(GRAFANA_TAG)) \
--cache-from type=registry,ref=$(REGISTRY)/grafana:latest \
--cache-to type=inline \
--metadata-file images/grafana.json \
--push=$(PUSH) \
--load=$(LOAD)
echo "$(REGISTRY)/grafana:$(call settag,$(GRAFANA_TAG))@$$(yq e '."containerimage.digest"' images/grafana.json -o json -r)" \
> images/grafana.tag
rm -f images/grafana.json
1 change: 1 addition & 0 deletions packages/extra/monitoring/images/grafana.tag
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ghcr.io/aenix-io/cozystack/grafana:latest@sha256:0377abd3cb2c6e27b12ac297f1859aa4d550f1aa14989f824f2315d0dfd1a5b2
15 changes: 15 additions & 0 deletions packages/extra/monitoring/images/grafana/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM grafana/grafana:11.4.0

USER root

RUN mkdir -p /var/lib/grafana-plugins \
&& chown -R grafana:0 /var/lib/grafana-plugins

USER grafana

ARG VLOGS_VERSION=v0.14.1
RUN curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/${VLOGS_VERSION}/victoriametrics-logs-datasource-${VLOGS_VERSION}.tar.gz | \
tar -xzf - -C /var/lib/grafana-plugins

RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install natel-discrete-panel
RUN grafana-cli --pluginsDir /var/lib/grafana-plugins plugins install grafana-worldmap-panel
29 changes: 5 additions & 24 deletions packages/extra/monitoring/templates/grafana/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,19 @@ spec:
replicas: 2
template:
spec:
initContainers:
- name: "load-vm-ds-plugin"
image: "curlimages/curl:7.85.0"
command: [ "/bin/sh" ]
workingDir: "/var/lib/grafana"
securityContext:
runAsUser: 10001
runAsNonRoot: true
runAsGroup: 10001
args:
- "-c"
- |
set -ex
mkdir -p /var/lib/grafana/plugins/
ver=$(curl -s https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v0\.13\.[0-9]+' | head -1)
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/$ver/victoriametrics-logs-datasource-$ver.tar.gz -o /var/lib/grafana/plugins/vl-plugin.tar.gz
tar -xf /var/lib/grafana/plugins/vl-plugin.tar.gz -C /var/lib/grafana/plugins/
rm /var/lib/grafana/plugins/vl-plugin.tar.gz
volumeMounts:
- name: grafana-data
mountPath: /var/lib/grafana
containers:
- name: grafana
image: grafana/grafana:11.2.0
image: "{{ $.Files.Get "images/grafana.tag" | trim }}"
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
readinessProbe:
failureThreshold: 3
env:
- name: GF_INSTALL_PLUGINS
value: grafana-worldmap-panel,natel-discrete-panel
#- name: GF_INSTALL_PLUGINS
# value: grafana-worldmap-panel,natel-discrete-panel
- name: GF_PATHS_PLUGINS
value: /var/lib/grafana-plugins
- name: ONCALL_API_URL
value: http://grafana-oncall-engine:8080
- name: GF_DATABASE_HOST
Expand Down

0 comments on commit aed112f

Please sign in to comment.