Explorar o código

Apply last example_ynh

yalh76 %!s(int64=3) %!d(string=hai) anos
pai
achega
eec1570b86
Modificáronse 8 ficheiros con 41 adicións e 53 borrados
  1. 2 2
      check_process
  2. 1 1
      conf/nginx.conf
  3. 1 0
      doc/DESCRIPTION_fr.md
  4. 6 6
      manifest.json
  5. 3 5
      scripts/_common.sh
  6. 11 12
      scripts/install
  7. 6 11
      scripts/restore
  8. 11 16
      scripts/upgrade

+ 2 - 2
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

+ 1 - 1
conf/nginx.conf

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

+ 1 - 0
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.

+ 6 - 6
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"
             }
         ]
     }

+ 3 - 5
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
 #=================================================

+ 11 - 12
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,23 +89,23 @@ chmod 750 "/usr/share/zabbix"
 chmod -R o-rwx "/usr/share/zabbix"
 chown -R $app:www-data "/usr/share/zabbix"
 
-#=================================================
-# NGINX CONFIGURATION
-#=================================================
-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"
+ynh_add_fpm_config
 phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
 
+#=================================================
+# NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Configuring NGINX web server..."
+
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
 #=================================================
 # SPECIFIC SETUP
 #=================================================

+ 6 - 11
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

+ 11 - 16
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
 #=================================================