1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zabbix_ynh.git synced 2024-09-03 20:36:14 +02:00

Merge pull request #37 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-07-12 20:53:48 +02:00 committed by GitHub
commit fcab88a6f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 190 additions and 86 deletions

65
.github/workflows/updater.sh vendored Normal file
View file

@ -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

49
.github/workflows/updater.yml vendored Normal file
View file

@ -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 <yunohost-bot@users.noreply.github.com>'
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
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

View file

@ -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: <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>
## 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
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,25 +1,28 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# 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 : <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>
## 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
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -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

View file

@ -139,10 +139,10 @@ fi</description>
<triggers>
<trigger>
<expression>{last()}&gt;={$YUNOHOST.BACKUP.MAXDAYS}</expression>
<name>Yunhost hasn't backup since more than {$YUNOHOST.BACKUP.MAXDAYS} days</name>
<name>YunoHost hasn't backup since more than {$YUNOHOST.BACKUP.MAXDAYS} days</name>
<opdata>{ITEM.LASTVALUE}</opdata>
<priority>HIGH</priority>
<description>Please check https://yunohost.org/#/backup</description>
<description>Please check https://yunohost.org/en/backup</description>
<manual_close>YES</manual_close>
</trigger>
</triggers>
@ -159,9 +159,9 @@ fi</description>
<triggers>
<trigger>
<expression>{last()}=0</expression>
<name>Yunhost hasn't backup yet</name>
<name>YunoHost hasn't backup yet</name>
<priority>HIGH</priority>
<description>Please check https://yunohost.org/#/backup</description>
<description>Please check https://yunohost.org/en/backup</description>
<manual_close>YES</manual_close>
</trigger>
</triggers>
@ -502,7 +502,7 @@ fi</description>
<triggers>
<trigger>
<expression>{Template Yunohost:yunohost.migrations.lastavailable.last()}&lt;&gt;{Template Yunohost:yunohost.migrations.lastinstalled.last()}</expression>
<name>Yunhost has migration in pending state</name>
<name>YunoHost has migration in pending state</name>
<priority>INFO</priority>
<description>Check Yunohost documentation and &quot;yunohost/admin/#/tools/migrations/ &quot; url or &quot;sudo yunohost tools migrations migrate&quot; command</description>
<manual_close>YES</manual_close>

View file

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

1
doc/DESCRIPTION_fr.md Normal file
View file

@ -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.

View file

@ -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"
}
]
}

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================