diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh new file mode 100644 index 0000000..cbbb51b --- /dev/null +++ b/.github/workflows/updater.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +#================================================= +# PACKAGE UPDATING HELPER +#================================================= + +# This script is meant to be run by GitHub Actions +# The YunoHost-Apps organisation offers a template Action to run this script periodically +# Since each app is different, maintainers can adapt its contents so as to perform +# automatic actions when a new upstream release is detected. + +#================================================= +# FETCHING LATEST RELEASE AND ITS ASSETS +#================================================= + +# Fetching information +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') +repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) +version=$(curl --silent "https://api.github.com/repos/$repo/tags?page=2" | jq -r '.[] | select( .name | contains("rc") or contains("beta") or contains("alpha") or startswith("6") | not ) | .name' | sort -V | tail -1) + +# Later down the script, we assume the version has only digits and dots +# Sometimes the release name starts with a "v", so let's filter it out. +# You may need more tweaks here if the upstream repository has different naming conventions. +if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then + version=${version:1} +fi + +# Setting up the environment variables +echo "Current version: $current_version" +echo "Latest release from upstream: $version" +echo "VERSION=$version" >> $GITHUB_ENV +echo "REPO=$repo" >> $GITHUB_ENV +# For the time being, let's assume the script will fail +echo "PROCEED=false" >> $GITHUB_ENV + +# Proceed only if the retrieved version is greater than the current one +if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then + echo "::warning ::No new version available" + exit 0 +# Proceed only if a PR for this new version does not already exist +elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then + echo "::warning ::A branch already exists for this update" + exit 0 +fi + +#================================================= +# SPECIFIC UPDATE STEPS +#================================================= + +# Any action on the app's source code can be done. +# The GitHub Action workflow takes care of committing all changes after this script ends. + +#================================================= +# GENERIC FINALIZATION +#================================================= + +# Replace new version in manifest +echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json + +# No need to update the README, yunohost-bot takes care of it + +# The Action will proceed only if the PROCEED environment variable is set to true +echo "PROCEED=true" >> $GITHUB_ENV +exit 0 diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..fb72ba0 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,49 @@ +# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. +# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. +# This file should be enough by itself, but feel free to tune it to your needs. +# It calls updater.sh, which is where you should put the app-specific update steps. +name: Check for new upstream releases +on: + # Allow to manually trigger the workflow + workflow_dispatch: + # Run it every day at 6:00 UTC + schedule: + - cron: '0 6 * * *' +jobs: + updater: + runs-on: ubuntu-latest + steps: + - name: Fetch the source code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Run the updater script + id: run_updater + run: | + # Setting up Git user + git config --global user.name 'yunohost-bot' + git config --global user.email 'yunohost-bot@users.noreply.github.com' + # Run the updater script + /bin/bash .github/workflows/updater.sh + - name: Commit changes + id: commit + if: ${{ env.PROCEED == 'true' }} + run: | + git commit -am "Upgrade to v$VERSION" + - name: Create Pull Request + id: cpr + if: ${{ env.PROCEED == 'true' }} + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update to version ${{ env.VERSION }} + committer: 'yunohost-bot ' + author: 'yunohost-bot ' + signoff: false + base: testing + branch: ci-auto-update-v${{ env.VERSION }} + delete-branch: true + title: 'Upgrade to version ${{ env.VERSION }}' + body: | + Upgrade to v${{ env.VERSION }} + draft: false diff --git a/README.md b/README.md index 82551aa..cd1c13c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # 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) +[![Integration level](https://dash.yunohost.org/integration/zabbix.svg)](https://dash.yunohost.org/appci/app/zabbix) ![Working status](https://ci-apps.yunohost.org/ci/badges/zabbix.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/zabbix.maintain.svg) [![Install Zabbix with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zabbix) *[Lire ce readme en français.](./README_fr.md)* @@ -17,13 +17,11 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. -**Shipped version:** 5.0.20~ynh1 - - +**Shipped version:** 5.0.20~ynh2 ## Screenshots -![](./doc/screenshots/screenshot1.png) +![Screenshot of Zabbix](./doc/screenshots/screenshot1.png) ## Disclaimers / important information @@ -38,21 +36,22 @@ A monitoring tool for diverse IT components, including networks, servers, VMs an ## Documentation and resources -* Official app website: https://www.zabbix.com/ -* Official admin documentation: https://www.zabbix.com/manuals -* Upstream app code repository: https://github.com/zabbix/zabbix -* YunoHost documentation for this app: https://yunohost.org/app_zabbix -* Report a bug: https://github.com/YunoHost-Apps/zabbix_ynh/issues +* Official app website: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug or sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 4219ff3..59c3cb5 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,25 +1,28 @@ + + # Zabbix pour YunoHost -[![Niveau d'intégration](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) +[![Niveau d'intégration](https://dash.yunohost.org/integration/zabbix.svg)](https://dash.yunohost.org/appci/app/zabbix) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/zabbix.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/zabbix.maintain.svg) [![Installer Zabbix avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zabbix) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Zabbix rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -A monitoring tool for diverse IT components, including networks, servers, VMs and cloud services. - -**Version incluse :** 5.0.20~ynh1 +Un outil de surveillance pour divers composants informatiques, notamment les réseaux, les serveurs, les machines virtuelles et les services en nuage. +**Version incluse :** 5.0.20~ynh2 ## Captures d'écran -![](./doc/screenshots/screenshot1.png) +![Capture d'écran de Zabbix](./doc/screenshots/screenshot1.png) ## Avertissements / informations importantes @@ -33,21 +36,22 @@ A monitoring tool for diverse IT components, including networks, servers, VMs an * Un modèle YunoHost est importé et lié à l'hôte "Zabbix-server" (127.0.0.1) pour la surveillance de base de YunoHost. ## Documentations et ressources -* Site officiel de l'app : https://www.zabbix.com/ -* Documentation officielle de l'admin : https://www.zabbix.com/manuals -* Dépôt de code officiel de l'app : https://github.com/zabbix/zabbix -* Documentation YunoHost pour cette app : https://yunohost.org/app_zabbix -* Signaler un bug : https://github.com/YunoHost-Apps/zabbix_ynh/issues +* Site officiel de l'app : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug ou sudo yunohost app upgrade zabbix -u https://github.com/YunoHost-Apps/zabbix_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** 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/Template_Yunohost.xml b/conf/Template_Yunohost.xml index 50e2ff0..c9854f9 100644 --- a/conf/Template_Yunohost.xml +++ b/conf/Template_Yunohost.xml @@ -139,10 +139,10 @@ fi {last()}>={$YUNOHOST.BACKUP.MAXDAYS} - Yunhost hasn't backup since more than {$YUNOHOST.BACKUP.MAXDAYS} days + YunoHost hasn't backup since more than {$YUNOHOST.BACKUP.MAXDAYS} days {ITEM.LASTVALUE} HIGH - Please check https://yunohost.org/#/backup + Please check https://yunohost.org/en/backup YES @@ -159,9 +159,9 @@ fi {last()}=0 - Yunhost hasn't backup yet + YunoHost hasn't backup yet HIGH - Please check https://yunohost.org/#/backup + Please check https://yunohost.org/en/backup YES @@ -502,7 +502,7 @@ fi {Template Yunohost:yunohost.migrations.lastavailable.last()}<>{Template Yunohost:yunohost.migrations.lastinstalled.last()} - Yunhost has migration in pending state + YunoHost has migration in pending state INFO Check Yunohost documentation and "yunohost/admin/#/tools/migrations/ " url or "sudo yunohost tools migrations migrate" command YES 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..6804423 100644 --- a/manifest.json +++ b/manifest.json @@ -6,19 +6,18 @@ "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" }, "license": "GPL-2.0-or-later", "maintainer": { - "name": "Mickael Martin", - "email": "mickael@librement-votre.fr", - "url": "http://www.librement-votre.fr" + "name": "", + "email": "" }, "requirements": { "yunohost": ">= 4.3.0" @@ -41,10 +40,6 @@ "example": "/zabbix", "default": "/zabbix" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -63,6 +58,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 #=================================================