diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..2729a6b --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,55 @@ +--- +name: Bug report +about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently. + +--- + +**How to post a meaningful bug report** +1. *Read this whole template first.* +2. *Determine if you are on the right place:* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* + - *When in doubt, post here and we will figure it out together.* +3. *Delete the italic comments as you write over them below, and remove this guide.* +--- + +### Describe the bug + +*A clear and concise description of what the bug is.* + +### Context + +- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* +- YunoHost version: x.x.x +- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* +- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes* + - If yes, please explain: +- Using, or trying to install package version/branch: +- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* + +### Steps to reproduce + +- *If you performed a command from the CLI, the command itself is enough. For example:* + ```sh + sudo yunohost app install the_app + ``` +- *If you used the webadmin, please perform the equivalent command from the CLI first.* +- *If the error occurs in your browser, explain what you did:* + 1. *Go to '...'* + 2. *Click on '...'* + 3. *Scroll down to '...'* + 4. *See error* + +### Expected behavior + +*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* + +### Logs + +*When an operation fails, YunoHost provides a simple way to share the logs.* +- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.* +- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.* + +*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)* + +*If applicable and useful, add screenshots to help explain your problem.* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index 5ee4f8e..c55d500 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Zabbix for YunoHost [![Integration level](https://dash.yunohost.org/integration/zabbix.svg)](https://dash.yunohost.org/appci/app/zabbix) ![](https://ci-apps.yunohost.org/ci/badges/zabbix.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zabbix.maintain.svg) -[![Install zabbix with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=zabbix) +[![Install zabbix with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zabbix) > *This package allow you to install Zabbix quickly and simply on a YunoHost server. If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* diff --git a/check_process b/check_process index 4b39161..6589238 100644 --- a/check_process +++ b/check_process @@ -26,8 +26,8 @@ port_already_use=1 change_url=1 ;;; Levels -# https://framagit.org/Mickael-Martin/zabbix_ynh/blob/master/scripts/install#L141 - Level 5=auto +# https://framagit.org/Mickael-Martin/zabbix_ynh/blob/master/scripts/install#L156 + Level 8=auto ;;; Options Email= Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index 47ce140..6074650 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,7 +18,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.3-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 1d45298..28fdf93 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -1,7 +1,7 @@ [__NAMETOCHANGE__] user = www-data group = www-data -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.3-fpm-__NAMETOCHANGE__.sock listen.owner = www-data listen.group = www-data pm = dynamic diff --git a/manifest.json b/manifest.json index 1efefd3..3ea3116 100644 --- a/manifest.json +++ b/manifest.json @@ -8,14 +8,14 @@ }, "version": "4.4~ynh1", "url": "https://www.zabbix.com", - "license": "free", + "license": " LGPL-2.0-or-later", "maintainer": { "name": "Mickael Martin", "email": "mickael@librement-votre.fr", "url": "http://www.librement-votre.fr" }, "requirements": { - "yunohost": ">= 3.6.5" + "yunohost": ">= 3.8.1" }, "multi_instance": false, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 53ef3b2..d48999c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,16 +1,10 @@ #!/bin/bash -# ============= FUTURE YUNOHOST HELPER ============= -# Delete a file checksum from the app settings -# -# $app should be defined when calling this helper -# -# usage: ynh_remove_file_checksum file -# | arg: file - The file for which the checksum will be deleted -ynh_delete_file_checksum () { - local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' - ynh_app_setting_delete $app $checksum_setting_name -} +#================================================= +# COMMON VARIABLES +#================================================= + +pkg_dependencies="libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.3 php7.3-bcmath ttf-dejavu-core php7.3-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php" #Zabbix part #===================GET GUEST DEFAULT USER STATE============== diff --git a/scripts/change_url b/scripts/change_url index f71fc77..e727aa9 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -8,6 +8,7 @@ source _common.sh source /usr/share/yunohost/helpers +ynh_abort_if_errors #================================================= # RETRIEVE ARGUMENTS diff --git a/scripts/install b/scripts/install index 2f7d074..0b56e8b 100644 --- a/scripts/install +++ b/scripts/install @@ -46,13 +46,10 @@ app="$YNH_APP_INSTANCE_NAME" final_path=/var/www/zabbix test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path "$path_url") - # Check web path availability -ynh_webpath_available "$domain" "$path_url" +ynh_webpath_available --domain="$domain" --path_url="$path_url" # Register (book) web path -ynh_webpath_register "$app" "$domain" "$path_url" +ynh_webpath_register --app="$app" --domain="$domain" --path_url="$path_url" #================================================= # STORE SETTINGS FROM MANIFEST @@ -94,16 +91,25 @@ ynh_app_setting_set "$app" language "$language" ### - Remove the section "REMOVE DEPENDENCIES" in the remove script ### - As well as the section "REINSTALL DEPENDENCIES" in the restore script ### - And the section "UPGRADE DEPENDENCIES" in the upgrade script + +pid=$(pgrep -f '/usr/bin/python3 /usr/bin/unattended-upgrade --download-only' || true) +if [ ! -z "$pid" ] ;then + ynh_script_progression --message="Check and wait end of unattended-upgrade of package_check" -w 1 + tail --pid=$pid -f /dev/null +fi + ynh_script_progression --message="Remove Zabbix if already installed" -w 1 apt-get purge zabbix* -y -ynh_secure_remove /var/cache/apt/archives/zabbix-server-mysql* +if compgen -G "/var/cache/apt/archives/zabbix-server-mysql*" > /dev/null; then + ynh_secure_remove /var/cache/apt/archives/zabbix-server-mysql* +fi ynh_script_progression --message="Install Zabbix repository" -w 3 install_zabbix_repo ynh_script_progression --message="Update and install dependencies" -w 5 #ynh_package_update no need cause ynh_install_app_dependencies after -ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php +ynh_install_app_dependencies $pkg_dependencies dpkg -i --force-confmiss /var/cache/apt/archives/zabbix-server-mysql* ynh_replace_string --match_string="# fr_FR.UTF-8 UTF-8" --replace_string="fr_FR.UTF-8 UTF-8" --target_file=/etc/locale.gen @@ -260,12 +266,6 @@ ynh_add_fpm_config ### so we're going to use curl to automatically fill the fields and submit the ### forms. -# Set right permissions for curl install -#chown -R www-data: $final_path - -# Set the app as temporarily public for curl call - - # Reload SSOwat config yunohost app ssowatconf @@ -361,16 +361,12 @@ yunohost service add snmpd -d "Management of SNMP Daemon" yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify" yunohost service add zabbix-agent -d "Management Zabbix agent daemon : send informations about this host to the server" - - - - #================================================= # RELOAD NGINX AND PHP-FPM #================================================= systemctl reload nginx -systemctl reload php7.0-fpm +systemctl reload php7.3-fpm # Reload SSOwat config yunohost app ssowatconf @@ -396,19 +392,18 @@ disable_admin_user # SETUP SSOWAT #================================================= - - # Make app public if necessary if [ "$is_public" -eq 1 ] then ynh_permission_update --permission="main" --add="visitors" fi + #================================================= # RELOAD NGINX AND PHP-FPM #================================================= systemctl reload nginx -systemctl reload php7.0-fpm +systemctl reload php7.3-fpm # Reload SSOwat config yunohost app ssowatconf diff --git a/scripts/restore b/scripts/restore index 939df04..1fb9ff3 100644 --- a/scripts/restore +++ b/scripts/restore @@ -56,8 +56,7 @@ install_zabbix_repo ynh_print_info "Update and install dependencies" ynh_package_update -ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php - +ynh_install_app_dependencies $pkg_dependencies DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php ynh_replace_string --match_string="# fr_FR.UTF-8 UTF-8" --replace_string="fr_FR.UTF-8 UTF-8" --target_file=/etc/locale.gen @@ -119,9 +118,9 @@ ynh_restore_file "/etc/apt/apt.conf.d/100update_force_init_zabbix_frontend_confi if [ ! -L /etc/zabbix/zabbix_agentd.d ];then ln -s /etc/zabbix/zabbix_agentd.conf.d /etc/zabbix/zabbix_agentd.d fi -systemctl enable zabbix-agent && systemctl restart zabbix-agent +systemctl enable --quiet zabbix-agent && systemctl restart zabbix-agent change_timeoutAgent -systemctl enable zabbix-server && systemctl restart zabbix-server +systemctl enable --quiet zabbix-server && systemctl restart zabbix-server yunohost service add snmpd -d "Management of SNMP Daemon" yunohost service add zabbix-server -d "Management Zabbix server daemon : Collect, agregate, compute and notify" diff --git a/scripts/upgrade b/scripts/upgrade index db4887e..9a14fe2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,13 +86,6 @@ disable_admin_user #================================================= disable_guest_user -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path "$path_url") - #Patch timeout too short for zabbix agent if needed change_timeoutAgent @@ -162,8 +155,7 @@ fi ynh_package_remove zabbix-server-mysql zabbix-frontend-php ynh_print_info "Update zabbix via apt package" - ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd libjs-prototype jq zabbix-server-mysql zabbix-agent zabbix-frontend-php - + ynh_install_app_dependencies $pkg_dependencies ynh_secure_remove /usr/share/zabbix/conf/zabbix.conf.php cp -rpf /tmp/zabbix /etc/ cp -pf /tmp/zabbix.conf.php /usr/share/zabbix/conf/