From eec1570b86976b49b77814f3ed895d9c11dead2b Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 12 Jul 2022 00:27:44 +0200 Subject: [PATCH] Apply last example_ynh --- check_process | 4 ++-- conf/nginx.conf | 2 +- doc/DESCRIPTION_fr.md | 1 + manifest.json | 12 ++++++------ scripts/_common.sh | 8 +++----- scripts/install | 23 +++++++++++------------ scripts/restore | 17 ++++++----------- scripts/upgrade | 27 +++++++++++---------------- 8 files changed, 41 insertions(+), 53 deletions(-) create mode 100644 doc/DESCRIPTION_fr.md diff --git a/check_process b/check_process index 7d93315..8d16196 100644 --- a/check_process +++ b/check_process @@ -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 diff --git a/conf/nginx.conf b/conf/nginx.conf index 245e9be..24fb9f1 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,7 +2,7 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; index index_http.php; diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..d5d6783 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -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. diff --git a/manifest.json b/manifest.json index 0ac633d..092afb6 100644 --- a/manifest.json +++ b/manifest.json @@ -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" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 2939639..225f507 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 #================================================= diff --git a/scripts/install b/scripts/install index f356a5c..a54e625 100644 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/restore b/scripts/restore index 378b773..d9f5f54 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 53db434..8bb2449 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #=================================================