1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/grafana_ynh.git synced 2024-09-03 20:36:29 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-01-27 00:30:36 +01:00
parent 5da6317a57
commit 5f7a32108f
5 changed files with 29 additions and 35 deletions

View file

@ -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;

View file

@ -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,13 +14,13 @@
"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": [
@ -31,8 +30,7 @@
"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",

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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"