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

Apply last example_ynh

This commit is contained in:
yalh76 2022-07-12 00:27:44 +02:00
parent 5c8a0fdc9f
commit eec1570b86
8 changed files with 41 additions and 53 deletions

View file

@ -2,9 +2,9 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
language="fr_FR"
is_public=1
language="fr_FR"
admin="john"
password="1Strong-Password"
port="10051"
; Checks

View file

@ -2,7 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/ ;
alias __FINALPATH__/;
index index_http.php;

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1 @@
Un outil de surveillance pour divers composants informatiques, notamment les réseaux, les serveurs, les machines virtuelles et les services en nuage.

View file

@ -6,11 +6,11 @@
"en": "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services",
"fr": "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
},
"version": "5.0.20~ynh1",
"version": "5.0.20~ynh2",
"url": "https://www.zabbix.com",
"upstream": {
"license": "GPL-2.0-or-later",
"website": "https://www.zabbix.com/",
"website": "https://www.zabbix.com",
"admindoc": "https://www.zabbix.com/manuals",
"code": "https://github.com/zabbix/zabbix"
},
@ -41,10 +41,6 @@
"example": "/zabbix",
"default": "/zabbix"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
@ -63,6 +59,10 @@
},
"choices": ["en_GB", "en_US", "cz_CN", "cs_CZ", "fr_FR", "ko_KR", "ja_JP", "nb_NO", "pl_PL", "pt_BR", "pt_PT", "ru_RU", "sk_SK", "tr_TR", "uk_UA"],
"default": "en_US"
},
{
"name": "admin",
"type": "user"
}
]
}

View file

@ -4,6 +4,8 @@
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
# dependencies used by the app
if [ "$(lsb_release --codename --short)" = "bullseye" ]; then
libsnmpd_version="libsnmp40"
@ -11,14 +13,10 @@ else
libsnmpd_version="libsnmp30"
fi
pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4"
pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 fonts-dejavu-core patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base $libsnmpd_version snmptrapd snmpd libjs-prototype jq libssh-4 php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-bcmath"
zabbix_pkg_dependencies="zabbix-agent zabbix-frontend-php zabbix-server-mysql"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-bcmath"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -25,9 +25,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
admin=$YNH_APP_ARG_ADMIN
app=$YNH_APP_INSTANCE_NAME
@ -51,8 +51,8 @@ ynh_script_progression --message="Storing installation settings..."
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=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
#=================================================
# STANDARD MODIFICATIONS
@ -75,7 +75,6 @@ ynh_script_progression --message="Creating a MySQL database..."
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
@ -90,6 +89,15 @@ chmod 750 "/usr/share/zabbix"
chmod -R o-rwx "/usr/share/zabbix"
chown -R $app:www-data "/usr/share/zabbix"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -98,15 +106,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC SETUP
#=================================================

View file

@ -47,13 +47,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC RESTORATION
#=================================================
@ -84,12 +77,14 @@ chown -R $app:www-data "/usr/share/zabbix"
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..."
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE MYSQL DATABASE

View file

@ -18,11 +18,11 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
language=$(ynh_app_setting_get --app=$app --key=language)
trustedversion="5.0.0-1+stretch"
@ -116,14 +116,6 @@ ln -s "/etc/zabbix/web/zabbix.conf.php" "/usr/share/zabbix/conf/zabbix.conf.php"
ynh_remove_extra_repo --name=zabbix
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -136,11 +128,6 @@ then
ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/5.0/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key"
fi
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
chmod 750 "/usr/share/zabbix"
chmod -R o-rwx "/usr/share/zabbix"
chown -R $app:www-data "/usr/share/zabbix"
@ -151,9 +138,17 @@ chown -R $app:www-data "/usr/share/zabbix"
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================