Include backup- and change-URL-scripts

This commit is contained in:
Boudewijn 2025-03-02 21:27:39 +01:00
parent 960cf6e0c0
commit d41c3be841
2 changed files with 6 additions and 43 deletions

View file

@ -21,47 +21,16 @@ ynh_print_info "Declaring files to be backed up..."
ynh_backup "$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
# Only relevant if there is a "data_dir" resource for this app
# NB: $data_dir is not backuped during safety-backup-before-upgrades,
# because the data dir may be huge and we don't want to just yolo-create a 10+ GB archive just for upgrades.
# On the other hand, $data_dir is also *not* removed by default in the "app remove" step unless --purge is used
# This means that even if the upgrade fails and the backup is restored, the data are still there.
ynh_backup "$data_dir"
#=================================================
# BACKUP SYSTEM CONFIGURATION
#=================================================
# Backup the PHP-FPM configuration
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
# Backup the NGINX configuration
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
# Backup the systemd service unit
ynh_backup "/etc/systemd/system/$app.service"
# Backup the logrotate configuration
ynh_backup "/etc/logrotate.d/$app"
# Backup the Fail2Ban config
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP VARIOUS FILES
#=================================================
ynh_backup "/etc/cron.d/$app"
ynh_backup "/etc/$app/"
# NB: /var/log is not backuped during safety-backup-before-upgrades, same as $data_dir
ynh_backup "/var/log/$app/"
#ynh_backup "/etc/fail2ban/jail.d/$app.conf"
#ynh_backup "/etc/fail2ban/filter.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE

View file

@ -14,9 +14,8 @@ source /usr/share/yunohost/helpers
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression "Stopping $app's systemd service..."
ynh_systemctl --service="$app" --action="stop"
## My Idlers runs as a Laravel app on nginx; keep that running.
#=================================================
# MODIFY URL IN NGINX CONF
@ -30,14 +29,9 @@ ynh_config_change_url_nginx
# SPECIFIC MODIFICATIONS
#=================================================
## do any changes to files that reference specific installation domain/path, i.e. regenerate configs etc
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action="start"
## Only the app_url in .env needs to change
sed -i -e 's/$old_doman/new_domain/g' __INSTALL_DIR__/.env
sed -i -e 's/$old_path/new_path/g' __INSTALL_DIR__/.env
#=================================================
# END OF SCRIPT