Migrate to manifestv2 and other changes:

* Move app install dir from /opt to /var/www
* Revamp the way binaries are downloaded thanks to manifestv2 (no need to check for arch, etc)
* Remove custom helpers (exec_as, ynh_handle_app_migration)
* Rename LFS_KEY as LFS_JWT_SECRET and KEY as SECRET_KEY as named in app.ini
* Add JWT_SECRET for oauth and INTERNAL_TOKEN in app.ini
* update upstream sample app.ini URL
* Disable actions for now.
* Automatically add ssh permissions to the system user
* Remove support for upgrade before 1.6.4. Edit test_upgrade_from accordingly.
This commit is contained in:
Félix Piédallu
2023-09-09 11:17:52 +02:00
committed by Félix Piédallu
parent b51febc0f9
commit 60cb5e5ae4
128 changed files with 474 additions and 1648 deletions

View File

@ -5,47 +5,44 @@
#=================================================
# Load common variables and helpers
source ../settings/scripts/experimental_helper.sh
source ../settings/scripts/_common.sh
# IMPORT GENERIC HELPERS
source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
# Retrieve app settings
ynh_print_info --message="Loading installation settings..."
domain=$(ynh_app_setting_get --app $app --key domain)
if [[ ! "$(systemctl status $app.service)" =~ "Active: inactive (dead)" ]]; then
ynh_print_warn --message="It's hightly recommended to make your backup when the service is stopped. Please stop $app service and with this command before to run the backup 'systemctl stop $app.service'"
fi
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
# Copy the app source files
ynh_print_info --message="Backing up code..."
ynh_backup --src_path "$final_path"
ynh_backup --src_path "$install_dir"
# Copy the data files
ynh_print_info --message="Backing up user data..."
ynh_backup --src_path "$datadir" --is_big=1
ynh_print_info --message="Backing up configuration..."
ynh_backup --src_path "$data_dir" --is_big=1
# Copy the conf files
ynh_backup --src_path "/etc/nginx/conf.d/${domain}.d/${app}.conf"
ynh_backup --src_path "/etc/systemd/system/${app}.service"
ynh_backup --src_path "/etc/nginx/conf.d/$domain.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/logrotate.d/$app"
ynh_backup --src_path "/etc/systemd/system/$app.service"
# Backup logs
ynh_print_info --message="Backing up logs..."
ynh_backup --src_path "/var/log/$app"
# Dump the database
ynh_print_info --message="Backing up database"
ynh_mysql_dump_db "$dbname" > ./db.sql
ynh_print_info --message="Backing up the MySQL database"
ynh_mysql_dump_db "$db_name" > ./db.sql
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."