mirror of
https://github.com/YunoHost-Apps/zabbix_ynh.git
synced 2024-09-03 20:36:14 +02:00
Merge branch 'master-testing' into 'master'
Merge Master testing See merge request Mickael-Martin/zabbix_ynh!22
This commit is contained in:
commit
5613cdfdca
1 changed files with 53 additions and 38 deletions
|
@ -72,7 +72,7 @@ ynh_app_setting_set $app language $language
|
||||||
### Use these lines if you have to open a port for the application
|
### Use these lines if you have to open a port for the application
|
||||||
### `ynh_find_port` will find the first available port starting from the given port.
|
### `ynh_find_port` will find the first available port starting from the given port.
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - Remove the section "CLOSE A PORT" in the remove script
|
### - Remove the section "CLOSE A PORT" in the remove script
|
||||||
|
|
||||||
# Find a free port
|
# Find a free port
|
||||||
#port=$(ynh_find_port 8095)
|
#port=$(ynh_find_port 8095)
|
||||||
|
@ -87,13 +87,18 @@ ynh_app_setting_set $app language $language
|
||||||
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
### `ynh_install_app_dependencies` allows you to add any "apt" dependencies to the package.
|
||||||
### Those deb packages will be installed as dependencies of this package.
|
### Those deb packages will be installed as dependencies of this package.
|
||||||
### If you're not using this helper:
|
### If you're not using this helper:
|
||||||
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
### - Remove the section "REMOVE DEPENDENCIES" in the remove script
|
||||||
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
### - As well as the section "REINSTALL DEPENDENCIES" in the restore script
|
||||||
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
### - And the section "UPGRADE DEPENDENCIES" in the upgrade script
|
||||||
|
|
||||||
wget "https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb"
|
wget "https://repo.zabbix.com/zabbix/4.0/debian/pool/main/z/zabbix-release/zabbix-release_4.0-2+stretch_all.deb"
|
||||||
dpkg -i zabbix-release_*.deb
|
dpkg -i zabbix-release_*.deb
|
||||||
rm zabbix-release_*.deb
|
rm zabbix-release_*.deb
|
||||||
|
echo '
|
||||||
|
Package: zabbix*
|
||||||
|
Pin: origin "repo.zabbix.com"
|
||||||
|
Pin-Priority: 999'>/etc/apt/preferences.d/zabbix-pin-999
|
||||||
|
|
||||||
echo "deb http://deb.debian.org/debian stretch non-free" >/etc/apt/sources.list.d/non-free.list
|
echo "deb http://deb.debian.org/debian stretch non-free" >/etc/apt/sources.list.d/non-free.list
|
||||||
ynh_package_update
|
ynh_package_update
|
||||||
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd snmp-mibs-downloader libjs-prototype zabbix-server-mysql zabbix-agent
|
ynh_install_app_dependencies libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.0 php-bcmath php7.0-bcmath ttf-dejavu-core php7.0-bcmath patch smistrip unzip wget fping libcap2-bin libiksemel3 libopenipmi0 libpam-cap libsnmp-base libsnmp30 snmptrapd snmpd snmp-mibs-downloader libjs-prototype zabbix-server-mysql zabbix-agent
|
||||||
|
@ -102,10 +107,10 @@ DEBIAN_FRONTEND=noninteractive apt-get -y download zabbix-frontend-php
|
||||||
ar x *.deb
|
ar x *.deb
|
||||||
tar xzf control.tar.gz
|
tar xzf control.tar.gz
|
||||||
sed -i 's/apache2 | httpd, //' control
|
sed -i 's/apache2 | httpd, //' control
|
||||||
tar --ignore-failed-read -cvzf control.tar.gz {post,pre}{inst,rm} md5sums control
|
tar --ignore-failed-read -cvzf control.tar.gz {post,pre}rm md5sums control
|
||||||
ar rcs zabbix-frontend-php+stretch_all-noapache2.deb debian-binary control.tar.gz data.tar.xz
|
ar rcs zabbix-frontend-php+stretch_all-noapache2.deb debian-binary control.tar.gz data.tar.xz
|
||||||
|
|
||||||
dpkg -i zabbix-frontend-php+stretch_all-noapache2.deb
|
dpkg -i --force-confmiss zabbix-frontend-php+stretch_all-noapache2.deb
|
||||||
|
|
||||||
rm -fr zabbix-*.deb
|
rm -fr zabbix-*.deb
|
||||||
DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php
|
DEBIAN_FRONTEND=noninteractive apt-mark hold zabbix-server-mysql zabbix-frontend-php
|
||||||
|
@ -114,7 +119,6 @@ sed -i "s/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g" /etc/locale.gen
|
||||||
locale-gen
|
locale-gen
|
||||||
|
|
||||||
ln -s /usr/share/zabbix $final_path
|
ln -s /usr/share/zabbix $final_path
|
||||||
rm $final_path/conf/zabbix.conf.php
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MYSQL DATABASE
|
# CREATE A MYSQL DATABASE
|
||||||
|
@ -125,9 +129,9 @@ rm $final_path/conf/zabbix.conf.php
|
||||||
### The password will be stored as 'mysqlpwd' into the app settings,
|
### The password will be stored as 'mysqlpwd' into the app settings,
|
||||||
### and will be available as $db_pwd
|
### and will be available as $db_pwd
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
|
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
|
||||||
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
|
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
|
||||||
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
|
@ -211,12 +215,12 @@ ynh_add_nginx_config
|
||||||
### You can remove it if your app doesn't use PHP.
|
### You can remove it if your app doesn't use PHP.
|
||||||
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini
|
### `ynh_add_fpm_config` will use the files conf/php-fpm.conf and conf/php-fpm.ini
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - You can remove these files in conf/.
|
### - You can remove these files in conf/.
|
||||||
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
|
||||||
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
|
||||||
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
|
||||||
### With the reload at the end of the script.
|
### With the reload at the end of the script.
|
||||||
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
|
||||||
|
|
||||||
# Create a dedicated php-fpm config
|
# Create a dedicated php-fpm config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
@ -236,11 +240,11 @@ ynh_add_fpm_config
|
||||||
### Have a look at the app to be sure this app needs a systemd script.
|
### Have a look at the app to be sure this app needs a systemd script.
|
||||||
### `ynh_systemd_config` will use the file conf/systemd.service
|
### `ynh_systemd_config` will use the file conf/systemd.service
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - You can remove those files in conf/.
|
### - You can remove those files in conf/.
|
||||||
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
### - Remove the section "BACKUP SYSTEMD" in the backup script
|
||||||
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
|
||||||
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
### - As well as the section "RESTORE SYSTEMD" in the restore script
|
||||||
### - And the section "SETUP SYSTEMD" in the upgrade script
|
### - And the section "SETUP SYSTEMD" in the upgrade script
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
#ynh_add_systemd_config
|
#ynh_add_systemd_config
|
||||||
|
@ -272,7 +276,7 @@ systemctl reload nginx
|
||||||
# Remove the public access
|
# Remove the public access
|
||||||
if [ $is_public -eq 0 ]
|
if [ $is_public -eq 0 ]
|
||||||
then
|
then
|
||||||
ynh_app_setting_delete $app skipped_uris
|
ynh_app_setting_delete $app skipped_uris
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -282,6 +286,17 @@ fi
|
||||||
### `ynh_replace_string` is used to replace a string in a file.
|
### `ynh_replace_string` is used to replace a string in a file.
|
||||||
### (It's compatible with sed regular expressions syntax)
|
### (It's compatible with sed regular expressions syntax)
|
||||||
|
|
||||||
|
if [ -L '/var/www/zabbix/conf/zabbix.conf.php' ];then
|
||||||
|
unlink /var/www/zabbix/conf/zabbix.conf.php
|
||||||
|
echo "delete link /var/www/zabbix/conf/zabbix.conf.php"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e '/etc/zabbix/web/zabbix.conf.php' ];then
|
||||||
|
rm -f /etc/zabbix/web/zabbix.conf.php
|
||||||
|
echo "delete file /etc/zabbix/web/zabbix.conf.php"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
echo "<?php
|
echo "<?php
|
||||||
// Zabbix GUI configuration file.
|
// Zabbix GUI configuration file.
|
||||||
global \$DB;
|
global \$DB;
|
||||||
|
@ -300,8 +315,8 @@ global \$DB;
|
||||||
\$ZBX_SERVER_PORT = '10051';
|
\$ZBX_SERVER_PORT = '10051';
|
||||||
\$ZBX_SERVER_NAME = 'zabbix-server';
|
\$ZBX_SERVER_NAME = 'zabbix-server';
|
||||||
|
|
||||||
\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;">/usr/share/zabbix/conf/zabbix.conf.php
|
\$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;">/var/www/zabbix/conf/zabbix.conf.php
|
||||||
|
chown www-data. /var/www/zabbix/conf/zabbix.conf.php
|
||||||
chown -R www-data. /usr/share/zabbix
|
chown -R www-data. /usr/share/zabbix
|
||||||
|
|
||||||
sed -i "s/DBName=zabbix/DBName=$db_name/g" /etc/zabbix/zabbix_server.conf
|
sed -i "s/DBName=zabbix/DBName=$db_name/g" /etc/zabbix/zabbix_server.conf
|
||||||
|
@ -341,10 +356,10 @@ systemctl enable zabbix-server && systemctl start zabbix-server
|
||||||
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
|
||||||
### Use this helper only if there is effectively a log file for this app.
|
### Use this helper only if there is effectively a log file for this app.
|
||||||
### If you're not using this helper:
|
### If you're not using this helper:
|
||||||
### - Remove the section "BACKUP LOGROTATE" in the backup script
|
### - Remove the section "BACKUP LOGROTATE" in the backup script
|
||||||
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
|
### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
|
||||||
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
|
### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
|
||||||
### - And the section "SETUP LOGROTATE" in the upgrade script
|
### - And the section "SETUP LOGROTATE" in the upgrade script
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
#native logrotate because install officials packages.
|
#native logrotate because install officials packages.
|
||||||
|
@ -358,9 +373,9 @@ systemctl enable zabbix-server && systemctl start zabbix-server
|
||||||
### You'll find the service in the 'services' section of YunoHost admin panel.
|
### You'll find the service in the 'services' section of YunoHost admin panel.
|
||||||
### This CLI command would be useless if the app does not have any services (systemd or sysvinit)
|
### This CLI command would be useless if the app does not have any services (systemd or sysvinit)
|
||||||
### If you're not using these lines:
|
### If you're not using these lines:
|
||||||
### - You can remove these files in conf/.
|
### - You can remove these files in conf/.
|
||||||
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script
|
||||||
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
### - As well as the section ADVERTISE SERVICE IN ADMIN PANEL" in the restore script
|
||||||
|
|
||||||
#yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
|
#yunohost service add NAME_INIT.D --log "/var/log/FILE.log"
|
||||||
|
|
||||||
|
@ -371,8 +386,8 @@ systemctl enable zabbix-server && systemctl start zabbix-server
|
||||||
# Make app public if necessary
|
# Make app public if necessary
|
||||||
if [ $is_public -eq 1 ]
|
if [ $is_public -eq 1 ]
|
||||||
then
|
then
|
||||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||||
ynh_app_setting_set $app unprotected_uris "/"
|
ynh_app_setting_set $app unprotected_uris "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue