mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Merge branch 'testing' into v2_PostgreSQL
This commit is contained in:
commit
c1d0950a6b
5 changed files with 39 additions and 31 deletions
|
@ -27,38 +27,22 @@ ynh_backup --src_path="$install_dir"
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE PHP-FPM CONFIGURATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# SPECIFIC BACKUP
|
|
||||||
#=================================================
|
|
||||||
# BACKUP LOGROTATE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP FAIL2BAN CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE CRON FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
ynh_backup --src_path="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -75,6 +75,12 @@ exec_occ maintenance:install \
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring $app..." --weight=8
|
ynh_script_progression --message="Configuring $app..." --weight=8
|
||||||
|
|
||||||
|
# Set the mysql.utf8mb4 config to true in config.php
|
||||||
|
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"
|
||||||
|
|
||||||
|
# move the logs from the data_dir to the standard /var/log
|
||||||
|
exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log"
|
||||||
|
|
||||||
# Ensure that UpdateNotification app is disabled
|
# Ensure that UpdateNotification app is disabled
|
||||||
exec_occ app:disable updatenotification
|
exec_occ app:disable updatenotification
|
||||||
|
|
||||||
|
@ -231,7 +237,7 @@ chmod 750 $install_dir
|
||||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate --logfile="$data_dir/data/nextcloud.log"
|
ynh_use_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
|
@ -239,7 +245,7 @@ ynh_use_logrotate --logfile="$data_dir/data/nextcloud.log"
|
||||||
ynh_script_progression --message="Configuring Fail2Ban..." --weight=8
|
ynh_script_progression --message="Configuring Fail2Ban..." --weight=8
|
||||||
|
|
||||||
# Create a dedicated Fail2Ban config
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
|
ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
|
@ -16,6 +16,9 @@ ynh_remove_nginx_config
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_remove_fpm_config
|
||||||
|
|
||||||
|
# remove logs
|
||||||
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_remove_logrotate
|
||||||
|
|
||||||
|
|
|
@ -52,6 +52,12 @@ ynh_script_progression --message="Restoring cron job..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE LOGS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/var/log/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE LOGROTATE CONFIGURATION
|
# BACKUP THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -108,10 +114,10 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
|
|
||||||
# Make sure a log file exists (mostly for CI tests)
|
# Make sure a log file exists (mostly for CI tests)
|
||||||
logfile="$data_dir/data/nextcloud.log"
|
logfile="/var/log/$app/nextcloud.log"
|
||||||
if [ ! -f "$logfile" ]; then
|
if [ ! -f "$logfile" ]; then
|
||||||
touch "$logfile"
|
touch "$logfile"
|
||||||
chown $app: "$logfile"
|
chown "$app:" "$logfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
|
|
|
@ -258,6 +258,15 @@ then
|
||||||
# Update all installed apps
|
# Update all installed apps
|
||||||
exec_occ app:update --all
|
exec_occ app:update --all
|
||||||
|
|
||||||
|
# move the logs from the data_dir to the standard /var/log
|
||||||
|
# it would be better in the ENSURE DOWNWARD COMPATIBILITY section
|
||||||
|
# but it must be after the exec_occ() definition, so it's here
|
||||||
|
if [ -f "$data_dir/data/nextcloud.log" ]; then
|
||||||
|
mv "$data_dir"/data/nextcloud.log* "/var/log/$app"
|
||||||
|
# adapt the nextcloud config
|
||||||
|
exec_occ config:system:set logfile --value="/var/log/$app/nextcloud.log"
|
||||||
|
fi
|
||||||
|
|
||||||
# Load the config file in nextcloud
|
# Load the config file in nextcloud
|
||||||
exec_occ config:import "$nc_conf"
|
exec_occ config:import "$nc_conf"
|
||||||
|
|
||||||
|
@ -359,9 +368,9 @@ fi
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
|
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
# CRON JOB
|
# CRON JOB
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
|
|
||||||
cron_path="/etc/cron.d/$app"
|
cron_path="/etc/cron.d/$app"
|
||||||
ynh_add_config --template="nextcloud.cron" --destination="$cron_path"
|
ynh_add_config --template="nextcloud.cron" --destination="$cron_path"
|
||||||
|
@ -370,18 +379,18 @@ chmod 644 "$cron_path"
|
||||||
|
|
||||||
exec_occ background:cron
|
exec_occ background:cron
|
||||||
|
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
# LOGROTATE
|
# LOGROTATE
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
|
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate --non-append
|
||||||
|
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
# FAIL2BAN
|
# FAIL2BAN
|
||||||
#-------------------------------------------------
|
#=================================================
|
||||||
|
|
||||||
# Create a dedicated Fail2Ban config
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
|
ynh_add_fail2ban_config --logpath="/var/log/$app/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
|
|
Loading…
Add table
Reference in a new issue