Improve Grafana installation script

This commit is contained in:
Pascal Zarrad 2021-07-06 20:52:06 +02:00
parent 4c88dcc007
commit f1027d6cc0
No known key found for this signature in database
GPG Key ID: 1F93B3388171379B

View File

@ -4,7 +4,7 @@
"version": "PTDL_v1",
"update_url": null
},
"exported_at": "2021-07-06T11:05:00+02:00",
"exported_at": "2021-07-06T23:52:45+02:00",
"name": "Grafana",
"author": "p.zarrad@outlook.de",
"description": "The open and composable observability and data visualization platform.\r\nVisualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.",
@ -22,7 +22,7 @@
},
"scripts": {
"installation": {
"script": "#!\/bin\/sh\r\nshopt -s extglob\r\n# Switch to mounted directory\r\ncd \/mnt\/server\r\n# Update installation system and install curl\r\napt-get update && apt-get upgrade -y\r\napt-get install -y curl\r\n# Cleanup previous install if available\r\nrm -rfv !(conf|data)\r\n# Download and extract Grafana\r\nversion=${GRAFANA_VERSION}\r\nif [ \"$version\" = \"latest\" ]; then version=$(curl --silent \"https:\/\/api.github.com\/repos\/grafana\/grafana\/releases\/latest\" | grep '\"tag_name\":' | sed -E 's\/.*\"([^\"]+)\".*\/\\1\/' | cut -c2-); fi\r\ncurl https:\/\/dl.grafana.com\/oss\/release\/grafana-${version}.linux-amd64.tar.gz --output grafana.tar.gz\r\ntar -zxvf grafana.tar.gz\r\nmv -n grafana-*\/* .\/\r\nrm -rf grafana.tar.gz grafana-*\/\r\n# Update existing plugins and install Grafana plugins\r\nif [ \"${GRAFANA_PLUGINS}\" != \"none\" ]; then\r\nfor v in $(tr ',' '\\n' <<< \"${GRAFANA_PLUGINS}\") ; do .\/bin\/grafana-cli --pluginsDir=\"\/mnt\/server\/data\/plugins\" plugins install \"$v\" ; done\r\nfi",
"script": "#!\/bin\/sh\r\nshopt -s extglob\r\n# Switch to mounted directory\r\ncd \/mnt\/server\r\n# Update installation system and install curl\r\napt-get update\r\napt-get install -y curl\r\n# Cleanup previous install if available\r\nif [ -d \"conf\" ]; then mv conf conf.bak; fi\r\nrm -rfv !(conf.bak|data)\r\n# Download and extract Grafana\r\nversion=${GRAFANA_VERSION}\r\nif [ \"$version\" = \"latest\" ]; then version=$(curl --silent \"https:\/\/api.github.com\/repos\/grafana\/grafana\/releases\/latest\" | grep '\"tag_name\":' | sed -E 's\/.*\"([^\"]+)\".*\/\\1\/' | cut -c2-); fi\r\ncurl https:\/\/dl.grafana.com\/oss\/release\/grafana-${version}.linux-amd64.tar.gz --output grafana.tar.gz\r\ntar -zxvf grafana.tar.gz\r\nmv -n grafana-*\/* .\/\r\nrm -rf grafana.tar.gz grafana-*\/\r\n# Restore configuration if necessary\r\nif [ -d \"conf.bak\" ]; then rm -rf conf && mv conf.bak conf && rm -rf conf.bak; fi\r\n# Update existing plugins and install Grafana plugins\r\nif [ ! -z \"${GRAFANA_PLUGINS}\" ]; then\r\nfor v in $(tr ',' '\\n' <<< \"${GRAFANA_PLUGINS}\") ; do .\/bin\/grafana-cli --pluginsDir=\"\/mnt\/server\/data\/plugins\" plugins install \"$v\" ; done\r\nfi",
"container": "debian:buster-slim",
"entrypoint": "bash"
}
@ -39,12 +39,12 @@
},
{
"name": "Grafana Plugins",
"description": "A list of Grafana plugins that should be installed. Enter the plugins comma separated (e. g. a,b,c).\r\nYou can enter none if you don't want to install any plugins.",
"description": "A list of Grafana plugins that should be installed. Enter the plugins comma separated (e. g. a,b,c).",
"env_variable": "grafana_plugins",
"default_value": "none",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "required|string"
"rules": "nullable|string"
}
]
}