Skip to content

Commit

Permalink
Update Grafana, build plugins (#607)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Kvapil <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
  - Updated Grafana to version 11.4.0
- Added new Grafana plugins: VictoriaMetrics logs datasource, Natel
Discrete Panel, and Worldmap Panel

- **Improvements**
  - Enhanced Grafana image build process
  - Dynamically manage Grafana image versioning
  - Updated plugin installation method

- **Version Update**
  - Monitoring package version bumped from 1.7.0 to 1.8.0

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Andrei Kvapil <[email protected]>
  • Loading branch information
kvaps authored Jan 27, 2025
1 parent 80b4c15 commit ef2e065
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 26 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ build:
make -C packages/apps/mysql image
make -C packages/apps/clickhouse image
make -C packages/apps/kubernetes image
make -C packages/extra/monitoring image
make -C packages/system/cozystack-api image
make -C packages/system/cozystack-controller image
make -C packages/system/cilium image
Expand Down
2 changes: 1 addition & 1 deletion packages/extra/monitoring/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: monitoring
description: Monitoring and observability stack
icon: /logos/monitoring.svg
type: application
version: 1.7.0
version: 1.8.0
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
3 changes: 2 additions & 1 deletion packages/extra/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ monitoring 1.5.3 c1ca19dc
monitoring 1.5.4 d4634797
monitoring 1.6.0 cb7b8158
monitoring 1.6.1 3bb97596
monitoring 1.7.0 HEAD
monitoring 1.7.0 749110aa
monitoring 1.8.0 HEAD
seaweedfs 0.1.0 5ca8823
seaweedfs 0.2.0 9e33dc0
seaweedfs 0.2.1 249bf35
Expand Down

0 comments on commit ef2e065

Please sign in to comment.