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:
parent
5da6317a57
commit
5f7a32108f
5 changed files with 29 additions and 35 deletions
|
@ -1,11 +1,6 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
# Force usage of https
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_redirect off;
|
proxy_redirect off;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
"fr": "Tableaux de bords de supervision"
|
"fr": "Tableaux de bords de supervision"
|
||||||
},
|
},
|
||||||
"version": "8.3.3~ynh1",
|
"version": "8.3.3~ynh1",
|
||||||
"license": "AGPL-3.0-only",
|
|
||||||
"url": "https://grafana.com/oss/grafana/",
|
"url": "https://grafana.com/oss/grafana/",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
@ -15,24 +14,23 @@
|
||||||
"demo": "https://play.grafana.org",
|
"demo": "https://play.grafana.org",
|
||||||
"code": "https://github.com/grafana/"
|
"code": "https://github.com/grafana/"
|
||||||
},
|
},
|
||||||
|
"license": "AGPL-3.0-only",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "JimboJoe",
|
"name": "JimboJoe",
|
||||||
"email": "jimmy@monin.net",
|
"email": "jimmy@monin.net"
|
||||||
"url": ""
|
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.2.0"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx"
|
"nginx"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain",
|
"type": "domain"
|
||||||
"example": "domain.org"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
|
@ -42,8 +40,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"type": "user",
|
"type": "user"
|
||||||
"example": "homer"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
|
|
|
@ -29,7 +29,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
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
|
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.
|
# 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"
|
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
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# 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
|
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 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
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"
|
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"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
|
@ -103,8 +103,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# UPDATE GRAFANA CONFIGURATION
|
||||||
|
#=================================================
|
||||||
ynh_script_progression --message="Updating Grafana configuration..." --weight=1
|
ynh_script_progression --message="Updating Grafana configuration..." --weight=1
|
||||||
|
|
||||||
grafana_conf="/etc/grafana/grafana.ini"
|
grafana_conf="/etc/grafana/grafana.ini"
|
||||||
# Set domain
|
# Set domain
|
||||||
sed -i "/^\[server\]$/,/^\[/ s@domain = .*@domain = $new_domain@" $grafana_conf
|
sed -i "/^\[server\]$/,/^\[/ s@domain = .*@domain = $new_domain@" $grafana_conf
|
||||||
|
|
|
@ -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
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
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
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -59,6 +51,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." --
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_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
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -66,6 +66,11 @@ if ynh_legacy_permissions_exists; then
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
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
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -79,11 +84,6 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=12
|
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_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"
|
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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue