mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Manifestv2
This commit is contained in:
parent
85d80a5f97
commit
61e7103b59
16 changed files with 243 additions and 476 deletions
71
.github/workflows/updater.sh
vendored
71
.github/workflows/updater.sh
vendored
|
@ -1,71 +0,0 @@
|
||||||
#!/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)
|
|
||||||
i=1
|
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/tags?page=$i" | jq -r '.[] | select( .name | contains("rc") or contains("beta") or contains("alpha") or startswith("6") or startswith("7") | not ) | .name' | sort -V | tail -1)
|
|
||||||
while [ -z $version ] ; do
|
|
||||||
sleep 10
|
|
||||||
i=$(($i + 1))
|
|
||||||
version=$(curl --silent "https://api.github.com/repos/$repo/tags?page=$i" | jq -r '.[] | select( .name | contains("rc") or contains("beta") or contains("alpha") or startswith("6") or startswith("7") | not ) | .name' | sort -V | tail -1)
|
|
||||||
done
|
|
||||||
|
|
||||||
# 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
49
.github/workflows/updater.yml
vendored
|
@ -1,49 +0,0 @@
|
||||||
# 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@v3
|
|
||||||
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@v4
|
|
||||||
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
|
|
|
@ -2,7 +2,7 @@
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
|
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/;
|
alias __INSTALL_DIR__/;
|
||||||
|
|
||||||
index index_http.php;
|
index index_http.php;
|
||||||
|
|
||||||
|
|
|
@ -358,7 +358,7 @@ request_terminate_timeout = 1d
|
||||||
; Chdir to this directory at the start.
|
; Chdir to this directory at the start.
|
||||||
; Note: relative path can be used.
|
; Note: relative path can be used.
|
||||||
; Default Value: current directory or / when chroot
|
; Default Value: current directory or / when chroot
|
||||||
chdir = __FINALPATH__
|
chdir = __INSTALL_DIR__
|
||||||
|
|
||||||
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
; Redirect worker stdout and stderr into main error log. If not set, stdout and
|
||||||
; stderr will be redirected to /dev/null according to FastCGI specs.
|
; stderr will be redirected to /dev/null according to FastCGI specs.
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#### Known limitations or important informations
|
#### 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.
|
* 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).
|
* 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).
|
* You can add your users in a group in Zabbix (for permissions/rights).
|
|
@ -1,7 +1,5 @@
|
||||||
#### Limitations connues et autres informations importantes
|
#### 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.
|
* 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).
|
* 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).
|
* Vous pouvez ajouter vos utilisateurs dans un groupe dans Zabbix (pour les autorisations/droits).
|
|
@ -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": "5.0.41~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.4-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"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
101
manifest.toml
Normal file
101
manifest.toml
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
|
||||||
|
|
||||||
|
packaging_format = 2
|
||||||
|
|
||||||
|
id = "zabbix"
|
||||||
|
name = "Zabbix"
|
||||||
|
description.en = "Monitoring tool for diverse IT components, including networks, servers, VMs and cloud services"
|
||||||
|
description.fr = "Outil pour monitorer des réseaux, des serveurs, des VMs et autres services en ligne"
|
||||||
|
|
||||||
|
version = "5.0.41~ynh1"
|
||||||
|
|
||||||
|
maintainers = []
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "GPL-2.0-or-later"
|
||||||
|
website = "https://www.zabbix.com"
|
||||||
|
admindoc = "https://www.zabbix.com/manuals"
|
||||||
|
code = "https://github.com/zabbix/zabbix"
|
||||||
|
cpe = "cpe:2.3:a:zabbix:zabbix"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = ["amd64"]
|
||||||
|
multi_instance = false
|
||||||
|
ldap = true
|
||||||
|
sso = true
|
||||||
|
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, ...
|
||||||
|
|
||||||
|
[install]
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.path]
|
||||||
|
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
|
||||||
|
|
||||||
|
[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"
|
||||||
|
|
||||||
|
[install.admin]
|
||||||
|
type = "user"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
[resources.system_user]
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = [
|
||||||
|
"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",
|
||||||
|
"php7.4-fpm",
|
||||||
|
"php7.4-bcmath",
|
||||||
|
]
|
||||||
|
|
||||||
|
[resources.apt.extras.zabbix]
|
||||||
|
repo = "http://repo.zabbix.com/zabbix/5.0/debian bullseye main"
|
||||||
|
key = "https://repo.zabbix.com/zabbix-official-repo.key"
|
||||||
|
packages = [
|
||||||
|
"zabbix-agent",
|
||||||
|
"zabbix-frontend-php",
|
||||||
|
"zabbix-server-mysql",
|
||||||
|
]
|
||||||
|
|
||||||
|
[resources.database]
|
||||||
|
type = "mysql"
|
|
@ -4,19 +4,6 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -97,7 +84,7 @@ enable_admin_user () {
|
||||||
#
|
#
|
||||||
import_template () {
|
import_template () {
|
||||||
ynh_print_info --message="Import YunoHost template in the agent"
|
ynh_print_info --message="Import YunoHost template in the agent"
|
||||||
zabbixFullpath=https://$domain$path_url
|
zabbixFullpath=https://$domain$path
|
||||||
localpath="../conf/Template_Yunohost.xml"
|
localpath="../conf/Template_Yunohost.xml"
|
||||||
sudoUserPpath="../conf/etc_sudoers.d_zabbix"
|
sudoUserPpath="../conf/etc_sudoers.d_zabbix"
|
||||||
confUserPpath="../conf/etc_zabbix_zabbix_agentd.d_userP_yunohost.conf"
|
confUserPpath="../conf/etc_zabbix_zabbix_agentd.d_userP_yunohost.conf"
|
||||||
|
@ -217,14 +204,6 @@ check_proc_zabbixagent () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove previous Zabbix installation
|
|
||||||
#
|
|
||||||
remove_previous_zabbix () {
|
|
||||||
ynh_print_info --message="Previous Zabbix installation will be purged !"
|
|
||||||
apt-get purge zabbix* -y
|
|
||||||
ynh_secure_remove --file="/var/cache/apt/archives/zabbix-server-mysql*"
|
|
||||||
ynh_print_info --message="Previous Zabbix installation purged !"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Update Zabbix configuration initialisation
|
# Update Zabbix configuration initialisation
|
||||||
#
|
#
|
||||||
|
|
|
@ -14,23 +14,23 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Loading installation settings..."
|
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
|
|
@ -13,59 +13,59 @@ source /usr/share/yunohost/helpers
|
||||||
# RETRIEVE ARGUMENTS
|
# RETRIEVE ARGUMENTS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
old_domain=$YNH_APP_OLD_DOMAIN
|
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
|
||||||
old_path=$YNH_APP_OLD_PATH
|
#REMOVEME? old_path=$YNH_APP_OLD_PATH
|
||||||
|
|
||||||
new_domain=$YNH_APP_NEW_DOMAIN
|
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
|
||||||
new_path=$YNH_APP_NEW_PATH
|
#REMOVEME? new_path=$YNH_APP_NEW_PATH
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
#REMOVEME? # Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#REMOVEME? #db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
#db_user=$db_name
|
#db_user=$db_name
|
||||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
#REMOVEME? #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
#REMOVEME? ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
#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.
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
#REMOVEME? ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
change_domain=0
|
#REMOVEME? change_domain=0
|
||||||
if [ "$old_domain" != "$new_domain" ]
|
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
|
||||||
then
|
then
|
||||||
change_domain=1
|
#REMOVEME? change_domain=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
change_path=0
|
#REMOVEME? change_path=0
|
||||||
if [ "$old_path" != "$new_path" ]
|
#REMOVEME? if [ "$old_path" != "$new_path" ]
|
||||||
then
|
then
|
||||||
change_path=1
|
#REMOVEME? change_path=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -75,28 +75,30 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
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
|
# Change the path in the NGINX config file
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original NGINX config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
#REMOVEME? ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for NGINX helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
#REMOVEME? domain="$old_domain"
|
||||||
path_url="$new_path"
|
#REMOVEME? path="$new_path"
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
#REMOVEME? ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for NGINX
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
ynh_delete_file_checksum --file="$nginx_conf_path"
|
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
|
||||||
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
# Store file checksum for the new config file location
|
# Store file checksum for the new config file location
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -110,9 +112,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
158
scripts/install
158
scripts/install
|
@ -1,7 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -9,105 +7,16 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# MANAGE SCRIPT FAILURE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
ynh_clean_check_starting
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
|
||||||
ynh_abort_if_errors
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
|
||||||
path_url=$YNH_APP_ARG_PATH
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
||||||
language=$YNH_APP_ARG_LANGUAGE
|
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Validating installation parameters..."
|
|
||||||
|
|
||||||
remove_previous_zabbix
|
|
||||||
|
|
||||||
final_path=/var/www/$app
|
|
||||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
|
||||||
|
|
||||||
# Register (book) web path
|
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE SETTINGS FROM MANIFEST
|
|
||||||
#=================================================
|
|
||||||
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=language --value=$language
|
|
||||||
ynh_app_setting_set --app=$app --key=admin --value=$admin
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
|
||||||
# INSTALL DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Installing dependencies..."
|
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
||||||
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_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
|
|
||||||
#=================================================
|
|
||||||
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_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
ln -s "/usr/share/zabbix" "$install_dir"
|
||||||
ln -s "/usr/share/zabbix" "$final_path"
|
|
||||||
|
|
||||||
chmod 750 "/usr/share/zabbix"
|
|
||||||
chmod -R o-rwx "/usr/share/zabbix"
|
chmod -R o-rwx "/usr/share/zabbix"
|
||||||
chown -R $app:www-data "/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
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT DEFAULT DATA
|
# IMPORT DEFAULT DATA
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -155,33 +64,40 @@ ynh_script_progression --message="Adding a configuration file..."
|
||||||
ynh_add_config --template="../conf/etc_zabbix_web_zabbix.conf.php" --destination="/etc/zabbix/web/zabbix.conf.php"
|
ynh_add_config --template="../conf/etc_zabbix_web_zabbix.conf.php" --destination="/etc/zabbix/web/zabbix.conf.php"
|
||||||
|
|
||||||
chmod 400 "/etc/zabbix/web/zabbix.conf.php"
|
chmod 400 "/etc/zabbix/web/zabbix.conf.php"
|
||||||
chown $app:www-data "/etc/zabbix/web/zabbix.conf.php"
|
chown "$app:www-data" "/etc/zabbix/web/zabbix.conf.php"
|
||||||
|
|
||||||
ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --target_file=/etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="DBName=zabbix" --replace_string="DBName=$db_name" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="DBUser=zabbix" --replace_string="DBUser=$db_user" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
|
ynh_replace_string --match_string="# DBPassword=" --replace_string="# DBPassword=\nDBPassword=$db_pwd" --target_file=/etc/zabbix/zabbix_server.conf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
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 dedicated PHP-FPM config
|
||||||
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
change_timeoutAgent
|
change_timeoutAgent
|
||||||
|
|
||||||
systemctl enable zabbix-agent --quiet
|
systemctl enable zabbix-agent --quiet
|
||||||
systemctl enable zabbix-server --quiet
|
systemctl enable zabbix-server --quiet
|
||||||
|
yunohost service add snmpd --description="Management of SNMP Daemon"
|
||||||
|
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
||||||
|
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
||||||
|
|
||||||
update_initZabbixConf
|
update_initZabbixConf
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP APPLICATION WITH CURL
|
# SETUP APPLICATION WITH CURL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setuping application with CURL..."
|
ynh_script_progression --message="Setting up application with CURL..."
|
||||||
|
|
||||||
# Set the app as temporarily public for curl call
|
|
||||||
ynh_script_progression --message="Configuring SSOwat..."
|
|
||||||
# Making the app public for curl
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
|
|
||||||
import_template
|
import_template
|
||||||
|
|
||||||
|
@ -189,48 +105,14 @@ link_template
|
||||||
|
|
||||||
disable_admin_user
|
disable_admin_user
|
||||||
|
|
||||||
# Remove the public access
|
|
||||||
ynh_permission_update --permission="main" --remove="visitors"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
|
||||||
|
|
||||||
yunohost service add snmpd --description="Management of SNMP Daemon"
|
|
||||||
yunohost service add zabbix-server --description="Management Zabbix server daemon : collect, agregate, compute and notify" --log="/var/log/$app/${app}_server.log"
|
|
||||||
yunohost service add zabbix-agent --description="Management Zabbix agent daemon : send informations about this host to the server" --log="/var/log/$app/${app}_agent.log"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression --message="Starting a systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
# Start 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-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"
|
ynh_systemd_action --service_name="$app-agent" --action="restart" --log_path="/var/log/$app/${app}_agent.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SETUP SSOWAT
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring permissions..."
|
|
||||||
|
|
||||||
# Make app public if necessary
|
|
||||||
if [ $is_public -eq 1 ]
|
|
||||||
then
|
|
||||||
# Everyone can access the app.
|
|
||||||
# The "main" permission is automatically created before the install script.
|
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RELOAD NGINX
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -12,14 +12,14 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
#REMOVEME? db_user=$db_name
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
|
@ -54,10 +54,10 @@ ynh_exec_warn_less killall zabbix_agentd
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MYSQL DATABASE
|
# REMOVE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the MySQL database..."
|
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..."
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
|
@ -78,22 +78,22 @@ ynh_remove_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
#REMOVEME? ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
#Remove config file detection
|
#Remove config file detection
|
||||||
delete_initZabbixConf
|
delete_initZabbixConf
|
||||||
|
|
||||||
ynh_remove_app_dependencies
|
#REMOVEME? ynh_remove_app_dependencies
|
||||||
|
|
||||||
ynh_remove_extra_repo --name=$app
|
ynh_remove_extra_repo --name=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing app main directory..."
|
#REMOVEME? ynh_script_progression --message="Removing app main directory..."
|
||||||
|
|
||||||
# Remove the app directory securely
|
# Remove the app directory securely
|
||||||
ynh_secure_remove --file="$final_path"
|
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||||
ynh_secure_remove --file="/usr/share/$app"
|
ynh_secure_remove --file="/usr/share/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -132,10 +132,10 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEDICATED USER
|
# REMOVE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the dedicated system user..."
|
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..."
|
||||||
|
|
||||||
# Delete a system user
|
# Delete a system user
|
||||||
ynh_system_user_delete --username=$app
|
#REMOVEME? ynh_system_user_delete --username=$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -14,36 +14,36 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
#REMOVEME? db_user=$db_name
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Validating restoration parameters..."
|
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..."
|
||||||
|
|
||||||
remove_previous_zabbix
|
remove_previous_zabbix
|
||||||
|
|
||||||
test ! -d $final_path \
|
#REMOVEME? test ! -d $install_dir \
|
||||||
|| ynh_die --message="There is already a directory: $final_path "
|
|| ynh_die --message="There is already a directory: $install_dir "
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD RESTORATION STEPS
|
# STANDARD RESTORATION STEPS
|
||||||
|
@ -52,11 +52,11 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..."
|
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
# Define and install dependencies
|
# Define and install dependencies
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
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"
|
#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_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
ynh_replace_string --match_string="# $language.UTF-8 UTF-8" --replace_string="$language.UTF-8 UTF-8" --target_file=/etc/locale.gen
|
||||||
locale-gen
|
locale-gen
|
||||||
|
@ -66,7 +66,7 @@ locale-gen
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression --message="Restoring the app main directory..."
|
||||||
|
|
||||||
ln -s /usr/share/zabbix "$final_path"
|
ln -s /usr/share/zabbix "$install_dir"
|
||||||
|
|
||||||
chmod 750 "/usr/share/zabbix"
|
chmod 750 "/usr/share/zabbix"
|
||||||
chmod -R o-rwx "/usr/share/zabbix"
|
chmod -R o-rwx "/usr/share/zabbix"
|
||||||
|
@ -89,10 +89,10 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..."
|
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
#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
|
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"
|
export mysqlconn="mysql --user=$db_user --password=$db_pwd --database=$db_name"
|
||||||
|
|
|
@ -12,17 +12,17 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..."
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
#REMOVEME? db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||||
|
|
||||||
trustedversion="5.0.0-1+stretch"
|
trustedversion="5.0.0-1+stretch"
|
||||||
|
|
||||||
|
@ -36,17 +36,17 @@ upgrade_type=$(ynh_check_app_version_changed)
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
#REMOVEME? ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
#REMOVEME? ynh_clean_setup () {
|
||||||
ynh_clean_check_starting
|
ynh_clean_check_starting
|
||||||
# Restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
#REMOVEME? ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
#REMOVEME? ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# STANDARD UPGRADE STEPS
|
||||||
|
@ -66,13 +66,13 @@ ynh_script_progression --message="Ensuring downward compatibility..."
|
||||||
# If db_name doesn't exist, create it
|
# If db_name doesn't exist, create it
|
||||||
if [ -z "$db_name" ]; then
|
if [ -z "$db_name" ]; then
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If final_path doesn't exist, create it
|
# If install_dir doesn't exist, create it
|
||||||
if [ -z "$final_path" ]; then
|
if [ -z "$install_dir" ]; then
|
||||||
final_path=/var/www/$app
|
#REMOVEME? install_dir=/var/www/$app
|
||||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$language" == "fr" ]
|
if [ "$language" == "fr" ]
|
||||||
|
@ -122,10 +122,10 @@ ynh_remove_extra_repo --name=zabbix
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
#REMOVEME? ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
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"
|
#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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chmod 750 "/usr/share/zabbix"
|
chmod 750 "/usr/share/zabbix"
|
||||||
|
@ -139,7 +139,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -195,9 +195,9 @@ ynh_systemd_action --service_name=$app-agent --action="restart" --log_path="/var
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
11
tests.toml
Normal file
11
tests.toml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
|
||||||
|
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
||||||
|
|
||||||
|
test_upgrade_from.8f8961c239f890069c867e40005db98465add0c9.name = "5.0.20~ynh2"
|
Loading…
Add table
Reference in a new issue