diff --git a/conf/nginx.conf b/conf/nginx.conf index 23ad529..1bc6f42 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,11 +1,6 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_redirect off; proxy_set_header Host $host; diff --git a/manifest.json b/manifest.json index 0360566..94e1850 100644 --- a/manifest.json +++ b/manifest.json @@ -7,7 +7,6 @@ "fr": "Tableaux de bords de supervision" }, "version": "8.3.3~ynh1", - "license": "AGPL-3.0-only", "url": "https://grafana.com/oss/grafana/", "upstream": { "license": "AGPL-3.0-only", @@ -15,24 +14,23 @@ "demo": "https://play.grafana.org", "code": "https://github.com/grafana/" }, + "license": "AGPL-3.0-only", "maintainer": { "name": "JimboJoe", - "email": "jimmy@monin.net", - "url": "" + "email": "jimmy@monin.net" }, "requirements": { - "yunohost": ">= 4.2.0" + "yunohost": ">= 4.3.0" }, "multi_instance": false, "services": [ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", - "type": "domain", - "example": "domain.org" + "type": "domain" }, { "name": "path", @@ -42,8 +40,7 @@ }, { "name": "admin", - "type": "user", - "example": "homer" + "type": "user" }, { "name": "is_public", diff --git a/scripts/change_url b/scripts/change_url index 9a4369a..af1e5ac 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -29,7 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 port=$(ynh_app_setting_get --app=$app --key=port) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=4 @@ -40,7 +40,7 @@ ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -78,19 +78,19 @@ ynh_script_progression --message="Updating NGINX web server configuration..." -- nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -103,8 +103,10 @@ fi #================================================= # SPECIFIC MODIFICATIONS #================================================= - +# UPDATE GRAFANA CONFIGURATION +#================================================= ynh_script_progression --message="Updating Grafana configuration..." --weight=1 + grafana_conf="/etc/grafana/grafana.ini" # Set domain sed -i "/^\[server\]$/,/^\[/ s@domain = .*@domain = $new_domain@" $grafana_conf diff --git a/scripts/remove b/scripts/remove index 15c499f..96a02d0 100644 --- a/scripts/remove +++ b/scripts/remove @@ -43,14 +43,6 @@ ynh_script_progression --message="Removing the MySQL database..." --weight=3 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=26 - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -59,6 +51,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." --weight=26 + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # SPECIFIC REMOVE #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 6062c47..29cb6a9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,6 +66,11 @@ if ynh_legacy_permissions_exists; then ynh_app_setting_delete --app=$app --key=is_public fi +# Migration: remove old repository if defined +if [ -f "/etc/apt/sources.list.d/grafana_stable.list" ] ; then + ynh_secure_remove --file="/etc/apt/sources.list.d/grafana_stable.list" +fi + #================================================= # NGINX CONFIGURATION #================================================= @@ -79,11 +84,6 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=12 -# Migration: remove old repository if defined -if [ -f "/etc/apt/sources.list.d/grafana_stable.list" ] ; then - ynh_secure_remove --file="/etc/apt/sources.list.d/grafana_stable.list" -fi - ynh_install_app_dependencies $pkg_dependencies ynh_install_extra_app_dependencies --repo="deb https://packages.grafana.com/oss/deb stable main" --package="grafana (>=$GRAFANA_VERSION)" --key="https://packages.grafana.com/gpg.key"