diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 55% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index 378db3c..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,6 +1,6 @@ --- name: Bug report -about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. --- @@ -8,15 +8,17 @@ about: Create a report to help us debug, it would be nice to fill the template a 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to Grafana or InfluxDB themselves. Refer to its documentation or repository for help.* - - *If you have a doubt, post here, we will figure it out together.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- -**Describe the bug** +### Describe the bug + *A clear and concise description of what the bug is.* -**Versions** +### Context + - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - YunoHost version: x.x.x - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* @@ -25,22 +27,29 @@ about: Create a report to help us debug, it would be nice to fill the template a - Using, or trying to install package version/branch: - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* -**To Reproduce** -*Steps to reproduce the behavior.* +### Steps to reproduce + - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install grafana + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* -**Expected behavior** +### Expected behavior + *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* -**Logs** -*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.* +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + *If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 1543466..6ebac40 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,31 @@ + + # Grafana for YunoHost [![Integration level](https://dash.yunohost.org/integration/grafana.svg)](https://dash.yunohost.org/appci/app/grafana) ![](https://ci-apps.yunohost.org/ci/badges/grafana.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/grafana.maintain.svg) -[![Install grafana with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grafana) +[![Install Grafana with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grafana) -> *This package allows you to install grafana quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install Grafana quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -**Important: This package is designed to be fed by the NetData application for monitoring measures, so please make sure the YunoHost [NetData package](https://github.com/YunoHost-Apps/netdata_ynh/) is installed before installing it!** -NetData only collects, displays and sets alarms based on data from the last hour; this packages allows to archive every metrics and put up statistics and dashboards on the long term. +Metric & analytic dashboards for monitoring -Note: You can use it without NetData, but you'll have to install a collection application (e.g. collectd) to gather data. +**Shipped version:** 8.0.6~ynh1 -**Shipped version:** 7.5.5 +**Demo:** https://play.grafana.org ## Screenshots -![](https://grafana.com/api/dashboards/1295/images/838/image) +![](./doc/screenshots/Grafana8_Kubernetes.jpg) -## Demo - -* [Official demo](https://play.grafana.org) +## Disclaimers / important information ## Configuration @@ -54,11 +58,6 @@ Note: You can use it without NetData, but you'll have to install a collection ap LDAP and HTTP auth are supported. -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/grafana%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/grafana/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/grafana%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/grafana/) - ## Limitations * The default dashboard may be updated in a further release of this package, so please make sure you create your own dashboards! @@ -68,20 +67,18 @@ LDAP and HTTP auth are supported. None. -## Links +## Documentation and resources - * Report a bug: https://github.com/YunoHost-Apps/grafana_ynh/issues - * Grafana website: https://grafana.com/ - * Grafana upstream app repository: https://github.com/grafana/ - * InfluxDB website: https://www.influxdata.com/ - * InfluxDB upstream app repository: https://github.com/influxdata/influxdb - * YunoHost website: https://yunohost.org/ +* Official app website: https://grafana.com/ +* Official user documentation: https://yunohost.org/apps +* Official admin documentation: https://yunohost.org/packaging_apps +* Upstream app code repository: https://github.com/grafana/ +* YunoHost documentation for this app: https://yunohost.org/app_grafana +* Report a bug: https://github.com/YunoHost-Apps/grafana_ynh/issues ---- +## Developer info -## Developers info - -Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/grafana_ynh/tree/testing). +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/grafana_ynh/tree/testing). To try the testing branch, please proceed like that. ``` @@ -89,3 +86,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/grafana_ynh/tree/test or sudo yunohost app upgrade grafana -u https://github.com/YunoHost-Apps/grafana_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..d0e439f --- /dev/null +++ b/README_fr.md @@ -0,0 +1,86 @@ +# Grafana pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/grafana.svg)](https://dash.yunohost.org/appci/app/grafana) ![](https://ci-apps.yunohost.org/ci/badges/grafana.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/grafana.maintain.svg) +[![Installer Grafana avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=grafana) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer Grafana rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Tableaux de bords de supervision + +**Version incluse :** 8.0.6~ynh1 + +**Démo :** https://play.grafana.org + +## Captures d'écran + +![](./doc/screenshots/Grafana8_Kubernetes.jpg) + +## Avertissements / informations importantes + +## Configuration + +**Important at first login:** + +* you have to go the Grafana Menu (Grafana icon), select your account menu and select *Switch to Main Org.* +* you can now access the default NetData dashboard via the Home menu + +**Don't hesitate to create new dashboards**: the default dashboard contains metrics from NetData, but only generic ones that are generated on every machine. NetData dynamically detects services and applications (e.g.redis, nginx, etc.) and enriches its dashboard and generated metrics. Many NetData metrics don't appear in the provided default Grafana dashboard! + +## Documentation + + * Official Grafana documentation: https://grafana.com/docs/grafana/latest/ + * Official InfluxdB documentation: https://docs.influxdata.com/influxdb/ + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +* installs InfluxDB as time series database +* if the NetData package is installed, configures NetData to feed InfluxDB every minute +* installs Grafana as dashboard server +* creates a Grafana Data Source to fetch data from InfluxDB (and hence NetData!) +* creates a default dashboard to plot some data from NetData (doesn't cover every metric, can be greatly enhanced!) + +#### General architecture + +![image](https://cloud.githubusercontent.com/assets/2662304/20649711/29f182ba-b4ce-11e6-97c8-ab2c0ab59833.png) + +#### Multi-users support + +LDAP and HTTP auth are supported. + +## Limitations + +* The default dashboard may be updated in a further release of this package, so please make sure you create your own dashboards! +* Organizations creation doesn't play well with LDAP integration; it is disabled for standard users, but can't be disabled for administrators: **please do not create organizations**! + +## Additional information + +None. + +## Documentations et ressources + +* Site officiel de l'app : https://grafana.com/ +* Documentation officielle utilisateur : https://yunohost.org/apps +* Documentation officielle de l'admin : https://yunohost.org/packaging_apps +* Dépôt de code officiel de l'app : https://github.com/grafana/ +* Documentation YunoHost pour cette app : https://yunohost.org/app_grafana +* Signaler un bug : https://github.com/YunoHost-Apps/grafana_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/grafana_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/grafana_ynh/tree/testing --debug +ou +sudo yunohost app upgrade grafana -u https://github.com/YunoHost-Apps/grafana_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 8252236..6fc1eed 100644 --- a/check_process +++ b/check_process @@ -1,11 +1,11 @@ ;; Complete test auto_remove=1 ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) - is_public=1 (PUBLIC|public=1|private=0) - port="3000" (PORT) + domain="domain.tld" + path="/path" + admin="john" + is_public=1 + port="3000" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..418ecdc --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,39 @@ +## Configuration + +**Important at first login:** + +* you have to go the Grafana Menu (Grafana icon), select your account menu and select *Switch to Main Org.* +* you can now access the default NetData dashboard via the Home menu + +**Don't hesitate to create new dashboards**: the default dashboard contains metrics from NetData, but only generic ones that are generated on every machine. NetData dynamically detects services and applications (e.g.redis, nginx, etc.) and enriches its dashboard and generated metrics. Many NetData metrics don't appear in the provided default Grafana dashboard! + +## Documentation + + * Official Grafana documentation: https://grafana.com/docs/grafana/latest/ + * Official InfluxdB documentation: https://docs.influxdata.com/influxdb/ + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +* installs InfluxDB as time series database +* if the NetData package is installed, configures NetData to feed InfluxDB every minute +* installs Grafana as dashboard server +* creates a Grafana Data Source to fetch data from InfluxDB (and hence NetData!) +* creates a default dashboard to plot some data from NetData (doesn't cover every metric, can be greatly enhanced!) + +#### General architecture + +![image](https://cloud.githubusercontent.com/assets/2662304/20649711/29f182ba-b4ce-11e6-97c8-ab2c0ab59833.png) + +#### Multi-users support + +LDAP and HTTP auth are supported. + +## Limitations + +* The default dashboard may be updated in a further release of this package, so please make sure you create your own dashboards! +* Organizations creation doesn't play well with LDAP integration; it is disabled for standard users, but can't be disabled for administrators: **please do not create organizations**! + +## Additional information + +None. diff --git a/doc/screenshots/Grafana8_Kubernetes.jpg b/doc/screenshots/Grafana8_Kubernetes.jpg new file mode 100644 index 0000000..ad0fe1b Binary files /dev/null and b/doc/screenshots/Grafana8_Kubernetes.jpg differ diff --git a/manifest.json b/manifest.json index 22e8b6a..6d9ceab 100644 --- a/manifest.json +++ b/manifest.json @@ -3,62 +3,53 @@ "id": "grafana", "packaging_format": 1, "description": { - "en": "Beautiful metric & analytic dashboards for monitoring", + "en": "Metric & analytic dashboards for monitoring", "fr": "Tableaux de bords de supervision" }, - "version": "7.5.5~ynh1", - "license": "Apache-2.0", - "url": "http://grafana.org/", + "version": "8.0.6~ynh1", + "license": "AGPL-3.0-only", + "url": "https://grafana.com/oss/grafana/", + "upstream": { + "license": "AGPL-3.0-only", + "website": "https://grafana.com/", + "demo": "https://play.grafana.org", + "admindoc": "https://yunohost.org/packaging_apps", + "userdoc": "https://yunohost.org/apps", + "code": "https://github.com/grafana/" + }, "maintainer": { "name": "JimboJoe", "email": "jimmy@monin.net", "url": "" }, "requirements": { - "yunohost": ">= 3.8.1" + "yunohost": ">= 4.2.0" }, "multi_instance": false, "services": [ - "nginx", - "php7.0-fpm" + "nginx" ], "arguments": { "install" : [ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Grafana", - "fr": "Choisissez un nom de domaine pour Grafana" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Grafana", - "fr": "Choisissez un chemin pour Grafana" - }, "example": "/grafana", "default": "/grafana" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "homer" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": false } ] diff --git a/scripts/backup b/scripts/backup index 8fda6ca..4a8ef29 100644 --- a/scripts/backup +++ b/scripts/backup @@ -63,6 +63,7 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # SPECIFIC BACKUP #================================================= ynh_print_info --message="Backing up the InfluxDB database..." + # Backup InfluxDB data # Source: http://stackoverflow.com/questions/39501416/how-to-restore-data-base-using-influxd mkdir influxdb_data diff --git a/scripts/change_url b/scripts/change_url index 6462af3..95cfd7e 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,7 @@ port=$(ynh_app_setting_get --app=$app --key=port) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=4 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=4 # Backup the current version of the app ynh_backup_before_upgrade @@ -73,7 +73,7 @@ ynh_systemd_action --service_name=grafana-server --action="stop" --log_path="/va #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -128,7 +128,7 @@ ynh_systemd_action --service_name=grafana-server --action="start" --log_path="/v #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index c553c53..c7dc5fb 100644 --- a/scripts/install +++ b/scripts/install @@ -48,7 +48,6 @@ ynh_script_progression --message="Storing installation settings..." --weight=2 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # STANDARD MODIFICATIONS @@ -88,9 +87,7 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=1 - -### `ynh_add_nginx_config` will use the file conf/nginx.conf +ynh_script_progression --message="Configuring NGINX web server..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -99,6 +96,7 @@ ynh_add_nginx_config # SPECIFIC SETUP #================================================= ynh_script_progression --message="Configuring Grafana and InfluxDB..." --weight=30 + # If NetData is installed, configure it to feed InfluxDB netdata_conf="/opt/netdata/etc/netdata/exporting.conf" if [ -f "$netdata_conf" ] ; then @@ -227,19 +225,18 @@ ynh_systemd_action --service_name=grafana-server --action="restart" --log_path=" #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Configuring SSOwat..." --weight=1 +ynh_script_progression --message="Configuring permissions..." --weight=1 # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index a5bed51..1108b04 100644 --- a/scripts/remove +++ b/scripts/remove @@ -54,7 +54,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=1 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 # Remove the dedicated nginx config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index fb4bfed..4ae4573 100644 --- a/scripts/restore +++ b/scripts/restore @@ -113,7 +113,7 @@ ynh_systemd_action --service_name=grafana-server --action="start" --log_path="/v #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index d283cd4..69ecbba 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) admin=$(ynh_app_setting_get --app=$app --key=admin) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) @@ -36,21 +35,19 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set --app=$app --key=is_public --value=0 - is_public=0 -fi - # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -70,7 +67,7 @@ ynh_abort_if_errors #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config @@ -163,18 +160,6 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name <<< yunohost service add influxdb --description="open source time series database" --log="/var/log/grafana/grafana.log" yunohost service add grafana-server --description="open source analytics and monitoring solution" --log="/var/log/grafana/grafana.log" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1 - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi - #================================================= # START SYSTEMD SERVICE #================================================= @@ -185,7 +170,7 @@ ynh_systemd_action --service_name=grafana-server --action="restart" --log_path=" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload