mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
commit
3c2a90d702
6 changed files with 58 additions and 87 deletions
|
@ -9,8 +9,8 @@
|
|||
setup_nourl=0
|
||||
setup_private=0
|
||||
setup_public=0
|
||||
upgrade=0
|
||||
backup_restore=0
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
incorrect_path=0
|
||||
port_already_use=0
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "ActivityPub Federated Image Sharing"
|
||||
},
|
||||
"version": "0.8.4~ynh1",
|
||||
"version": "0.8.4~ynh3",
|
||||
"url": "https://pixelfed.org/",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"maintainer": {
|
||||
|
|
|
@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -56,34 +52,12 @@ ynh_print_info "Backing up php-fpm configuration..."
|
|||
ynh_backup "/etc/php/7.2/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PostgreSQL DATABASE
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db "$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Backing up logrotate configuration..."
|
||||
|
||||
ynh_backup "/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Backing up systemd configuration..."
|
||||
|
||||
ynh_backup "/etc/systemd/system/$app.service"
|
||||
|
||||
#=================================================
|
||||
# BACKUP A CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -82,6 +82,14 @@ ynh_print_info "Removing the dedicated system user"
|
|||
# Delete a system user
|
||||
ynh_system_user_delete "$app"
|
||||
|
||||
#=================================================
|
||||
# START PHP-FPM 7.0 FPM
|
||||
#=================================================
|
||||
ynh_print_info "Start php7.0-fpm"
|
||||
|
||||
#Sometimes with package_check php7.0-fpm fail to reload and stop. So starting the service, just in case.
|
||||
systemctl start php7.0-fpm
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -14,10 +14,6 @@ source /usr/share/yunohost/helpers
|
|||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
#### Remove this function if there's nothing to clean before calling the remove script.
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
@ -72,13 +68,7 @@ ynh_system_user_create "$app"
|
|||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf"
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -88,42 +78,24 @@ ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf"
|
|||
ynh_print_info "Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_php --phpversion="7.2"
|
||||
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PostgreSQL DATABASE
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_create_db "$db_name" "$db_name" "$db_pwd"
|
||||
ynh_psql_setup_db "$db_name" "$db_name" "$db_pwd"
|
||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Restoring the systemd configuration..."
|
||||
|
||||
ynh_restore_file "/etc/systemd/system/$app.service"
|
||||
systemctl enable "$app".service
|
||||
|
||||
#=================================================
|
||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
yunohost service add "$app" --log "/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file "/etc/logrotate.d/$app"
|
||||
ynh_restore_file "/etc/php/7.2/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -99,6 +99,8 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_print_info "Upgrading dependencies..."
|
||||
|
||||
ynh_install_php --phpversion="7.2"
|
||||
|
||||
ynh_install_app_dependencies "$pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
|
@ -114,36 +116,51 @@ ynh_system_user_create "$app"
|
|||
#=================================================
|
||||
ynh_print_info "Upgrading php-fpm configuration..."
|
||||
|
||||
#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released
|
||||
mv -f "/etc/php/7.2/fpm/pool.d/$app.conf" "/etc/php/7.0/fpm/pool.d/$app.conf"
|
||||
sleep 5
|
||||
systemctl reload php7.2-fpm
|
||||
systemctl reload php7.0-fpm
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
ynh_add_fpm_config --phpversion="7.2"
|
||||
|
||||
#Ugly move waiting 'ynh_add_fpm_config --phpversion='' released
|
||||
mv -f "/etc/php/7.0/fpm/pool.d/$app.conf" "/etc/php/7.2/fpm/pool.d/$app.conf"
|
||||
sleep 5
|
||||
systemctl reload php7.0-fpm
|
||||
systemctl reload php7.2-fpm
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# ...
|
||||
# INSTALL PHP DEPENDENCIES
|
||||
#=================================================
|
||||
|
||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
ynh_install_composer --workdir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DEPLOYMENT
|
||||
#=================================================
|
||||
|
||||
pushd "$final_path"
|
||||
php7.2 artisan config:clear
|
||||
php7.2 artisan config:cache
|
||||
php7.2 artisan route:clear
|
||||
php7.2 artisan route:cache
|
||||
php7.2 artisan storage:link
|
||||
php7.2 artisan migrate --force
|
||||
php7.2 artisan update
|
||||
php7.2 artisan horizon:purge
|
||||
popd
|
||||
|
||||
|
||||
|
||||
ynh_backup_if_checksum_is_different "$final_path/CONFIG_FILE"
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum "$final_path/CONFIG_FILE"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
ynh_store_file_checksum "$final_path/.env"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -152,7 +169,7 @@ ynh_add_systemd_config
|
|||
#=================================================
|
||||
|
||||
# Set permissions on app files
|
||||
chown -R root: "$final_path"
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Add table
Reference in a new issue