deployment: simplify Grafana plugins installation

rm custom scripts for downloading Grafana plugins for
VictoriaMetrics and VictoriaLogs. Use `GF_INSTALL_PLUGINS` instead.

Signed-off-by: hagen1778 <roman@victoriametrics.com>
This commit is contained in:
hagen1778 2024-06-25 13:36:34 +02:00
parent 14b9ef1e4d
commit 5f218a772b
No known key found for this signature in database
GPG key ID: 3BF75F3741CA9640
5 changed files with 3 additions and 53 deletions

View file

@ -8,8 +8,6 @@ services:
- "victorialogs"
ports:
- 3000:3000
entrypoint: [ "/bin/bash", "-c" ]
command: [ "chmod +x /download.sh && /download.sh && /run.sh" ]
volumes:
- grafanadata:/var/lib/grafana
- ./provisioning/datasources/victorialogs-datasource:/etc/grafana/provisioning/datasources
@ -17,8 +15,8 @@ services:
- ./provisioning/plugins/:/var/lib/grafana/plugins
- ./../../dashboards/victoriametrics.json:/var/lib/grafana/dashboards/vm.json
- ./../../dashboards/victorialogs.json:/var/lib/grafana/dashboards/vl.json
- ./victorialogs/download.sh:/download.sh
environment:
- "GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/v0.2.2/victorialogs-datasource-v0.2.2.zip;victorialogs-datasource"
- "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victorialogs-datasource"
networks:
- vm_net

View file

@ -1,22 +0,0 @@
#!/bin/bash
set -ex
VM_DS_PATH='/var/lib/grafana/plugins/victorialogs-datasource'
PLUGIN_PATH='/var/lib/grafana/plugins'
if [[ -f ${VM_DS_PATH}/plugin.json ]]; then
ver=$(cat ${VM_DS_PATH}/plugin.json)
if [[ ! -z "$ver" ]]; then
exit
fi
fi
echo "VictoriaLogs datasource is not installed. Installing datasource..."
rm -rf ${VM_DS_PATH}/* || true
mkdir -p ${VM_DS_PATH}
export LATEST_VERSION=$(curl https://api.github.com/repos/VictoriaMetrics/victorialogs-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1); \
curl -L https://github.com/VictoriaMetrics/victorialogs-datasource/releases/download/${LATEST_VERSION}/victorialogs-datasource-${LATEST_VERSION}.tar.gz -o ${PLUGIN_PATH}/plugin.tar.gz && \
tar -xzf ${PLUGIN_PATH}/plugin.tar.gz -C ${PLUGIN_PATH}
echo "VictoriaLogs datasource has been installed."
rm ${PLUGIN_PATH}/plugin.tar.gz

View file

@ -6,8 +6,6 @@ services:
- "vmauth"
ports:
- 3000:3000
entrypoint: ["/bin/bash", "-c"]
command: ["chmod +x /download.sh && /download.sh && /run.sh"]
volumes:
- grafanadata:/var/lib/grafana
- ./provisioning/datasources/victoriametrics-datasource:/etc/grafana/provisioning/datasources
@ -17,7 +15,7 @@ services:
- ./../../dashboards/vm/vmagent.json:/var/lib/grafana/dashboards/vmagent.json
- ./../../dashboards/vm/vmalert.json:/var/lib/grafana/dashboards/vmalert.json
- ./../../dashboards/vm/vmauth.json:/var/lib/grafana/dashboards/vmauth.json
- ./vm-datasource/download.sh:/download.sh
environment:
- "GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/grafana-datasource/releases/download/v0.8.2/victoriametrics-datasource-v0.8.2.zip;victoriametrics-datasource"
- "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victoriametrics-datasource"
restart: always

View file

@ -6,8 +6,6 @@ services:
- "victoriametrics"
ports:
- 3000:3000
entrypoint: [ "/bin/bash", "-c" ]
command: [ "chmod +x /download.sh && /download.sh && /run.sh" ]
volumes:
- grafanadata:/var/lib/grafana
- ./provisioning/datasources/victoriametrics-datasource:/etc/grafana/provisioning/datasources
@ -16,8 +14,8 @@ services:
- ./../../dashboards/vm/victoriametrics.json:/var/lib/grafana/dashboards/vm.json
- ./../../dashboards/vm/vmagent.json:/var/lib/grafana/dashboards/vmagent.json
- ./../../dashboards/vm/vmalert.json:/var/lib/grafana/dashboards/vmalert.json
- ./vm-datasource/download.sh:/download.sh
environment:
- "GF_INSTALL_PLUGINS=https://github.com/VictoriaMetrics/grafana-datasource/releases/download/v0.8.2/victoriametrics-datasource-v0.8.2.zip;victoriametrics-datasource"
- "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=victoriametrics-datasource"
networks:
- vm_net

View file

@ -1,22 +0,0 @@
#!/bin/bash
set -ex
VM_DS_PATH='/var/lib/grafana/plugins/victoriametrics-datasource'
PLUGIN_PATH='/var/lib/grafana/plugins'
if [[ -f ${VM_DS_PATH}/plugin.json ]]; then
ver=$(cat ${VM_DS_PATH}/plugin.json)
if [[ ! -z "$ver" ]]; then
exit
fi
fi
echo "VictoriaMetrics datasource is not installed. Installing datasource..."
rm -rf ${VM_DS_PATH}/* || true
mkdir -p ${VM_DS_PATH}
export LATEST_VERSION=$(curl https://api.github.com/repos/VictoriaMetrics/grafana-datasource/releases/latest | grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' | head -1); \
curl -L https://github.com/VictoriaMetrics/grafana-datasource/releases/download/${LATEST_VERSION}/victoriametrics-datasource-${LATEST_VERSION}.tar.gz -o ${PLUGIN_PATH}/plugin.tar.gz && \
tar -xzf ${PLUGIN_PATH}/plugin.tar.gz -C ${PLUGIN_PATH}
echo "VictoriaMetrics datasource has been installed."
rm ${PLUGIN_PATH}/plugin.tar.gz