diff --git a/check_process b/check_process deleted file mode 100644 index 6c4a3af..0000000 --- a/check_process +++ /dev/null @@ -1,29 +0,0 @@ -;; Test complet - ; Manifest - domain="domain.tld" - path="/path" - is_public=1 - language="fr_FR" - admin="john" - password="1Strong-Password" - port="10051" - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=1 - setup_nourl=0 - setup_private=1 - setup_public=1 - upgrade=1 - # 5.0.20~ynh2 - upgrade=1 from_commit=8f8961c239f890069c867e40005db98465add0c9 - backup_restore=1 - multi_instance=0 - change_url=1 -;;; Options -Email= -Notification=none -;;; Upgrade options - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=PORT& - ; commit=8f8961c239f890069c867e40005db98465add0c9 - name=5.0.20~ynh2 diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 2b7c662..876deb7 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1 +1,10 @@ -A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. \ No newline at end of file +Zabbix is a monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. + +### Known limitations or important informations + +* Only x86_64 architecture is supported +* Single sign-on is supported +* Do not change the default admin user password. The user is disabled just after the install but is used to update templates. +* The Zabbix server port is not opened by default for external monitoring (active agent). +* You can add your users in a group in Zabbix (for permissions/rights). +* A YunoHost template is imported and linked to the host "Zabbix-server" (127.0.0.1) for basic monitoring for YunoHost. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md index d5d6783..ecf4f74 100644 --- a/doc/DESCRIPTION_fr.md +++ b/doc/DESCRIPTION_fr.md @@ -1 +1,10 @@ -Un outil de surveillance pour divers composants informatiques, notamment les réseaux, les serveurs, les machines virtuelles et les services en nuage. +Zabbix est un outil de surveillance pour divers composants informatiques, notamment les réseaux, les serveurs, les machines virtuelles et les services en nuage. + +### Limitations connues et autres informations importantes + +* Seule l'architecture x86_64 est prise en charge +* L'authentification unique (SSO) fonctionne. +* Ne modifiez pas le mot de passe de l'utilisateur administrateur par défaut. L'utilisateur est désactivé juste après l'installation mais il est utilisé pour mettre à jour les modèles. +* Le port du serveur Zabbix n'est pas ouvert par défaut pour la surveillance externe (agent actif). +* Vous pouvez ajouter vos utilisateurs dans un groupe dans Zabbix (pour les autorisations/droits). +* Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost. diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md deleted file mode 100644 index a2cb871..0000000 --- a/doc/DISCLAIMER.md +++ /dev/null @@ -1,8 +0,0 @@ -#### Known limitations or important informations - -* Only x86_64 architecture is supported -* Single sign-on is supported -* Do not change the default admin user password. The user is disabled just after the install but is used to update templates. -* The Zabbix server port is not opened by default for external monitoring (active agent). -* You can add your users in a group in Zabbix (for permissions/rights). -* A YunoHost template is imported and linked to the host "Zabbix-server" (127.0.0.1) for basic monitoring for YunoHost. diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md deleted file mode 100644 index a8cc1d3..0000000 --- a/doc/DISCLAIMER_fr.md +++ /dev/null @@ -1,8 +0,0 @@ -#### Limitations connues et autres informations importantes - -* Seule l'architecture x86_64 est prise en charge -* L'authentification unique (SSO) fonctionne. -* Ne modifiez pas le mot de passe de l'utilisateur administrateur par défaut. L'utilisateur est désactivé juste après l'installation mais il est utilisé pour mettre à jour les modèles. -* Le port du serveur Zabbix n'est pas ouvert par défaut pour la surveillance externe (agent actif). -* Vous pouvez ajouter vos utilisateurs dans un groupe dans Zabbix (pour les autorisations/droits). -* Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost. \ No newline at end of file diff --git a/manifest.json b/manifest.json deleted file mode 100644 index f70559d..0000000 --- a/manifest.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "Zabbix", - "id": "zabbix", - "packaging_format": 1, - "description": { - "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": "6.4~ynh1", - "url": "https://www.zabbix.com", - "upstream": { - "license": "GPL-2.0-or-later", - "website": "https://www.zabbix.com", - "admindoc": "https://www.zabbix.com/manuals", - "code": "https://github.com/zabbix/zabbix" - }, - "license": "GPL-2.0-or-later", - "maintainer": { - "name": "", - "email": "" - }, - "requirements": { - "yunohost": ">= 11.2" - }, - "multi_instance": false, - "services": [ - "nginx", - "php7.3-fpm", - "mysql" - ], - "arguments": { - "install": [ - { - "name": "domain", - "type": "domain" - }, - { - "name": "path", - "type": "path", - "example": "/zabbix", - "default": "/zabbix" - }, - { - "name": "is_public", - "type": "boolean", - "help": { - "en": "A public app doesn't need SSO auth : the auth page is opened for everyone", - "fr": "Une application publique ne nécessite pas une authentification SSO : sa page d'authentication est ouverte à tous" - }, - "default": false - }, - { - "name": "language", - "type": "select", - "ask": { - "en": "Choose the application language", - "fr": "Choisissez la langue de l'application" - }, - "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/manifest.toml b/manifest.toml index 4cb8c77..e4c9424 100644 --- a/manifest.toml +++ b/manifest.toml @@ -14,44 +14,37 @@ license = "GPL-2.0-or-later" website = "https://www.zabbix.com" admindoc = "https://www.zabbix.com/manuals" code = "https://github.com/zabbix/zabbix" -cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. [integration] yunohost = ">= 11.2" -architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] +architectures = "all" multi_instance = false -ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials. -sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal. -disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ... -ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... -ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ... +ldap = false +sso = false +disk = "50M" +ram.build = "50M" +ram.runtime = "50M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "path" default = "/zabbix" [install.init_main_permission] - help.en = "A public app doesn't need SSO auth : the auth page is opened for everyone" - help.fr = "Une application publique ne nécessite pas une authentification SSO : sa page d'authentication est ouverte à tous" type = "group" - default = false + default = "admins" [install.language] ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" type = "select" 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" + default = "fr_FR" [install.admin] - # this is a generic question - ask strings are automatically handled by Yunohost's core type = "user" [resources] @@ -60,11 +53,13 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen [resources.install_dir] [resources.permissions] - main.url = "/" - [[resources.apt.extras]] - repo = "http://repo.zabbix.com/zabbix/6.4/debian $(lsb_release -sc) main" - key = "https://repo.zabbix.com/zabbix-official-repo.key" - packages = "#FIXME#$zabbix_pkg_dependencies" + + [resources.apt] + packages = "mariadb-server, 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, libsnmp40, snmptrapd, snmpd, libjs-prototype, jq, libssh-4, php8.2-fpm, php8.2-bcmath" + + extras.zabbix.repo = "http://repo.zabbix.com/zabbix/6.4/debian bullseye main" + extras.zabbix.key = "https://repo.zabbix.com/zabbix-official-repo.key" + extras.zabbix.packages = "zabbix-server-mysql, zabbix-frontend-php, zabbix-sql-scripts, zabbix-agent" [resources.database] type = "mysql" diff --git a/scripts/_common.sh b/scripts/_common.sh index 5e51676..4a13c85 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,19 +4,6 @@ # COMMON VARIABLES #================================================= -#REMOVEME? YNH_PHP_VERSION="7.4" - -# dependencies used by the app -if [ "$(lsb_release --codename --short)" = "bullseye" ]; then - libsnmpd_version="libsnmp40" -else - libsnmpd_version="libsnmp30" -fi - -#REMOVEME? 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" - -#REMOVEME? zabbix_pkg_dependencies="zabbix-server-mysql zabbix-frontend-php zabbix-sql-scripts zabbix-agent" - #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index c81c57d..29e3419 100644 --- a/scripts/backup +++ b/scripts/backup @@ -10,28 +10,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - true -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_print_info --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= diff --git a/scripts/change_url b/scripts/change_url index 16988ea..690b1ba 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -9,65 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS -#================================================= - -#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN -#REMOVEME? old_path=$YNH_APP_OLD_PATH - -#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN -#REMOVEME? new_path=$YNH_APP_NEW_PATH - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? # Needed for helper "ynh_add_nginx_config" -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - -# Add settings here as needed by your application -#REMOVEME? #db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#REMOVEME? #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - -#================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - #REMOVEME? ynh_clean_check_starting - # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. -#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# CHECK WHICH PARTS SHOULD BE CHANGED -#================================================= - -#REMOVEME? change_domain=0 -#REMOVEME? if [ "$old_domain" != "$new_domain" ] -then - #REMOVEME? change_domain=1 -fi - -#REMOVEME? change_path=0 -#REMOVEME? if [ "$old_path" != "$new_path" ] -then - #REMOVEME? change_path=1 -fi - #================================================= # STANDARD MODIFICATIONS #================================================= @@ -77,45 +18,6 @@ ynh_script_progression --message="Updating NGINX web server configuration..." ynh_change_url_nginx_config -#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf - -# 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 -#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for NGINX helper -#REMOVEME? domain="$old_domain" -#REMOVEME? path="$new_path" - # Create a dedicated NGINX config -#REMOVEME? ynh_add_nginx_config -fi - -# Change the domain for NGINX -if [ $change_domain -eq 1 ] -then - # Delete file checksum for the old conf file location -#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path" -#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location -#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" -fi - -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - -#================================================= -# GENERIC FINALISATION -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 425a7e0..ebfbb3d 100644 --- a/scripts/install +++ b/scripts/install @@ -9,80 +9,28 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -#REMOVEME? domain=$YNH_APP_ARG_DOMAIN -#REMOVEME? path=$YNH_APP_ARG_PATH -#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC -#REMOVEME? language=$YNH_APP_ARG_LANGUAGE -#REMOVEME? admin=$YNH_APP_ARG_ADMIN - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -#REMOVEME? ynh_script_progression --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." remove_previous_zabbix -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder" - -# Register (book) web path -#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= -#REMOVEME? ynh_script_progression --message="Storing installation settings..." - -#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain -#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path -ynh_app_setting_set --app=$app --key=language --value=$language -#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin - #================================================= # STANDARD MODIFICATIONS #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/6.4/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key" +ynh_script_progression --message="Installing dependencies..." ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen locale-gen -#================================================= -# CREATE A MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Creating a MySQL database..." - -#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? db_user=$db_name -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir ln -s "/usr/share/zabbix" "$install_dir" chmod 750 "/usr/share/zabbix" @@ -96,12 +44,6 @@ ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated PHP-FPM config ynh_add_fpm_config -#REMOVEME? 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 @@ -178,20 +120,12 @@ update_initZabbixConf #================================================= ynh_script_progression --message="Setuping application with CURL..." -# Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." -# Making the app public for curl -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" - import_template link_template disable_admin_user -# Remove the public access -#REMOVEME? ynh_permission_update --permission="main" --remove="visitors" - #================================================= # GENERIC FINALIZATION #================================================= @@ -212,26 +146,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log" ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log" -#================================================= -# SETUP SSOWAT -#================================================= -#REMOVEME? ynh_script_progression --message="Configuring permissions..." - -# Make app public if necessary -#REMOVEME? if [ $is_public -eq 1 ] -then - # Everyone can access the app. - # The "main" permission is automatically created before the install script. -#REMOVEME? ynh_permission_update --permission="main" --add="visitors" -fi - -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index 76caca9..3ee57f6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -9,18 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) - #================================================= # STANDARD REMOVE #================================================= @@ -51,14 +39,6 @@ systemctl disable zabbix-agent --quiet ynh_exec_warn_less killall zabbix_server ynh_exec_warn_less killall zabbix_agentd -#================================================= -# REMOVE THE MYSQL DATABASE -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." - -# Remove a database if it exists, along with the associated user -#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name - #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -67,33 +47,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..." # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." - # Remove the dedicated PHP-FPM config ynh_remove_fpm_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -#REMOVEME? ynh_script_progression --message="Removing dependencies..." - #Remove config file detection delete_initZabbixConf -#REMOVEME? ynh_remove_app_dependencies - ynh_remove_extra_repo --name=$app -#================================================= -# REMOVE APP MAIN DIR -#================================================= -#REMOVEME? ynh_script_progression --message="Removing app main directory..." - -# Remove the app directory securely -#REMOVEME? ynh_secure_remove --file="$install_dir" ynh_secure_remove --file="/usr/share/$app" #================================================= @@ -127,16 +88,6 @@ then fi fi -#================================================= -# GENERIC FINALIZATION -#================================================= -# REMOVE DEDICATED USER -#================================================= -#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." - -# Delete a system user -#REMOVEME? ynh_system_user_delete --username=$app - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 969dcc7..a6a87c4 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,41 +10,13 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# MANAGE SCRIPT FAILURE -#================================================= - -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - -#================================================= -# LOAD SETTINGS -#================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) - #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." remove_previous_zabbix -#REMOVEME? test ! -d $install_dir \ - || ynh_die --message="There is already a directory: $install_dir " - #================================================= # STANDARD RESTORATION STEPS #================================================= @@ -52,11 +24,7 @@ remove_previous_zabbix #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." - -# Define and install dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#REMOVEME? 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" +ynh_script_progression --message="Reinstalling dependencies..." ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen locale-gen @@ -79,20 +47,13 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -#================================================= -# 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 #================================================= -#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) -#REMOVEME? ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name" diff --git a/scripts/upgrade b/scripts/upgrade index a8c566f..633a4a7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,17 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -#REMOVEME? ynh_script_progression --message="Loading installation settings..." - -#REMOVEME? app=$YNH_APP_INSTANCE_NAME - -#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain) -#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path) -#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language) -#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir) -#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#REMOVEME? db_user=$db_name -#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_script_progression --message="Loading installation settings..." trustedversion="5.0.0-1+stretch" @@ -32,21 +22,6 @@ trustedversion="5.0.0-1+stretch" upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP -#================================================= -#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." - -# Backup the current version of the app -#REMOVEME? ynh_backup_before_upgrade -#REMOVEME? ynh_clean_setup () { - ynh_clean_check_starting - # Restore it if the upgrade fails -#REMOVEME? ynh_restore_upgradebackup -} -# Exit if an error occurs during the execution of the script -#REMOVEME? ynh_abort_if_errors - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -62,18 +37,6 @@ ynh_systemd_action --service_name=$app-agent --action="stop" --log_path="/var/lo #================================================= ynh_script_progression --message="Ensuring downward compatibility..." -# If db_name doesn't exist, create it -if [ -z "$db_name" ]; then - db_name=$(ynh_sanitize_dbid --db_name=$app) -#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name -fi - -# If install_dir doesn't exist, create it -if [ -z "$install_dir" ]; then -#REMOVEME? install_dir=/var/www/$app -#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir -fi - if [ "$language" == "fr" ] then language="fr_FR" @@ -119,14 +82,6 @@ ynh_remove_extra_repo --name=zabbix # UPGRADE DEPENDENCIES #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then -#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." - -#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies -#REMOVEME? ynh_exec_warn_less ynh_install_extra_app_dependencies --repo="http://repo.zabbix.com/zabbix/6.4/debian $(lsb_release -sc) main" --package="$zabbix_pkg_dependencies" --key="https://repo.zabbix.com/zabbix-official-repo.key" -fi - chmod 750 "/usr/share/zabbix" chmod -R o-rwx "/usr/share/zabbix" chown -R $app:www-data "/usr/share/zabbix" @@ -138,23 +93,10 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." # Create a dedicated PHP-FPM config ynh_add_fpm_config -#REMOVEME? 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 -#================================================= -# CUSTOMIZE DATABASE -#================================================= -ynh_script_progression --message="Customize the database..." - convert_ZabbixDB set_mediatype_default_yunohost @@ -191,13 +133,6 @@ ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app-server --action="restart" --log_path="/var/log/$app/${app}_server.log" --line_match="server #0 started" ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var/log/$app/${app}_agent.log" -#================================================= -# RELOAD NGINX -#================================================= -#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." - -#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload - #================================================= # END OF SCRIPT #================================================= diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..91daf17 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file