1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00
This commit is contained in:
Éric Gaspar 2024-01-10 14:08:31 +01:00
parent 98d24a9930
commit 92ca88779a
2 changed files with 21 additions and 15 deletions

View file

@ -27,7 +27,7 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
# Restore the file first, so it can have a backup if different # 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" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config # Recreate a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config
#================================================= #=================================================

View file

@ -63,13 +63,14 @@ exec_occ() {
} }
#================================================= #=================================================
# HANDLE DATABASE MIGRATION # HANDLE DATABASE MIGRATION FROM MYSL TO PSQL
#================================================= #=================================================
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
if [ -n "$mysql_db_pwd" ] if [ -n "$mysql_db_pwd" ]
then then
ynh_script_progression --message="Migrating to PostgreSQL database..." ynh_script_progression --message="Migrating to PostgreSQL database..." --weight=3
ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php" ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php"
@ -85,6 +86,10 @@ then
ynh_store_file_checksum --file="${install_dir}/config/config.php" ynh_store_file_checksum --file="${install_dir}/config/config.php"
fi fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Define a function to add an external storage # Define a function to add an external storage
# Create the external storage for the given folders and enable sharing # Create the external storage for the given folders and enable sharing
create_external_storage() { create_external_storage() {
@ -97,7 +102,6 @@ local mount_id=$(exec_occ files_external:create --output=json \
|| exec_occ files_external:option "$mount_id" enable_sharing true || exec_occ files_external:option "$mount_id" enable_sharing true
} }
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading Nextcloud..." --weight=3 ynh_script_progression --message="Upgrading Nextcloud..." --weight=3
@ -290,7 +294,7 @@ EOF
fi fi
#================================================= #=================================================
# REGEN SYSTEM CONFIGURATIONS # REGEN PERMISSIONS
#================================================= #=================================================
ynh_script_progression --message="Reapplying file permissions..." --weight=2 ynh_script_progression --message="Reapplying file permissions..." --weight=2
@ -310,15 +314,15 @@ chmod 750 $install_dir
#================================================= #=================================================
ynh_script_progression --message="Regenerating system configurations for $app..." --weight=2 ynh_script_progression --message="Regenerating system configurations for $app..." --weight=2
# ------- #-------------------------------------------------
# PHP-FPM # PHP-FPM
# ------- #-------------------------------------------------
ynh_add_fpm_config ynh_add_fpm_config
# ------- #-------------------------------------------------
# NGINX # NGINX
# ------- #-------------------------------------------------
# Delete current NGINX configuration to be able to check if .well-known is already served. # Delete current NGINX configuration to be able to check if .well-known is already served.
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -340,9 +344,10 @@ 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="../conf/nextcloud.cron" --destination="$cron_path" ynh_add_config --template="../conf/nextcloud.cron" --destination="$cron_path"
chown root: "$cron_path" chown root: "$cron_path"
@ -350,14 +355,15 @@ 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="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5