mirror of
https://github.com/YunoHost-Apps/ulogger_ynh.git
synced 2024-10-01 13:34:45 +02:00
Dedicated php-fpm for upgrade,retore,backup
This commit is contained in:
parent
236f84c848
commit
13d0d4b88e
3 changed files with 39 additions and 12 deletions
|
@ -45,6 +45,13 @@ ynh_backup "$final_path"
|
|||
|
||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
|
|
|
@ -71,11 +71,11 @@ ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
|||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root: $final_path
|
||||
ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf"
|
||||
ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini"
|
||||
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -41,7 +41,6 @@ if [ -z $db_name ]; then
|
|||
ynh_app_setting_set $app db_name $db_name
|
||||
fi
|
||||
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z $final_path ]; then
|
||||
final_path=/var/www/$app
|
||||
|
@ -75,17 +74,30 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
# Create a temporary directory
|
||||
tmpdir="$(mktemp -d)"
|
||||
|
||||
# Backup the config file in the temp dir
|
||||
cp -a "$final_path/config.php" "$tmpdir/config.php"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
# If final_path doesn't exist, create it
|
||||
if [ -z $final_path ]; then
|
||||
final_path=/var/www/$app
|
||||
ynh_app_setting_set $app final_path $final_path
|
||||
fi
|
||||
|
||||
#ynh_setup_source "$final_path"
|
||||
#move the final_path to final_path.old
|
||||
sudo mv ${final_path} ${final_path}.old
|
||||
sudo mkdir -p $final_path
|
||||
ynh_setup_source "$final_path"
|
||||
|
||||
#copy cofig.php from final_path.old to final_path
|
||||
sudo cp -a ${final_path}.old/config.php ${final_path}
|
||||
|
||||
#remove final_path.old
|
||||
sudo rm -Rf ${final_path}.old
|
||||
#copy cofig.php from tmp to final_path
|
||||
sudo cp -a "$tmpdir/config.php" "${final_path}"
|
||||
|
||||
#remove tmp dir
|
||||
sudo rm -Rf "$tmpdir"
|
||||
|
||||
|
||||
#=================================================
|
||||
|
@ -95,6 +107,7 @@ sudo rm -Rf ${final_path}.old
|
|||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -102,6 +115,13 @@ ynh_add_nginx_config
|
|||
# Create a system user
|
||||
ynh_system_user_create $app
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
|
@ -123,7 +143,7 @@ ynh_store_file_checksum "$final_path/config.php"
|
|||
#=================================================
|
||||
|
||||
# Set right permissions for curl installation
|
||||
chown -R root: $final_path
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
|
Loading…
Add table
Reference in a new issue