1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/drupal_ynh.git synced 2024-09-03 18:35:53 +02:00

various corrections

This commit is contained in:
yalh76 2020-05-24 03:00:28 +02:00
parent 18974a6afe
commit af3617921d
8 changed files with 31 additions and 36 deletions

View file

@ -58,7 +58,7 @@ location __PATH__/ {
location ~ '[^/]\.php$|^/update.php' { location ~ '[^/]\.php$|^/update.php' {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
@ -90,4 +90,4 @@ location __PATH__/ {
location @rewrite { location @rewrite {
rewrite ^/(.*)$ /index.php?q=$1; rewrite ^/(.*)$ /index.php?q=$1;
} }

View file

@ -7,6 +7,8 @@
# dependencies used by the app # dependencies used by the app
pkg_dependencies="curl" pkg_dependencies="curl"
swap_needed=512
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-simplexml php${YNH_PHP_VERSION}-curl" extra_php_dependencies="php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-simplexml php${YNH_PHP_VERSION}-curl"

View file

@ -53,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_print_info --message="Backing up php-fpm configuration..." ynh_print_info --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE

View file

@ -86,7 +86,7 @@ then
domain="$old_domain" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for nginx

View file

@ -95,7 +95,7 @@ ynh_setup_source --dest_dir="$final_path"
ynh_print_info --message="Configuring nginx web server..." ynh_print_info --message="Configuring nginx web server..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -111,7 +111,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_print_info --message="Configuring php-fpm..." ynh_print_info --message="Configuring php-fpm..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
@ -120,7 +120,7 @@ ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_depende
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
ynh_add_swap --size=512 ynh_add_swap --size=$swap_needed
#================================================= #=================================================
# CREATE DRUSH ALIAS # CREATE DRUSH ALIAS
@ -146,7 +146,7 @@ mkdir -p "$final_path/.composer"
cp -f "../conf/composer.json" "$final_path/composer.json" cp -f "../conf/composer.json" "$final_path/composer.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/composer.json" ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/composer.json"
ynh_install_composer --phpversion="$YNH_PHP_VERSION" --workdir="$final_path" ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path"
export PATH="$final_path/vendor/bin:$PATH" export PATH="$final_path/vendor/bin:$PATH"
@ -157,13 +157,13 @@ ynh_print_info --message="Installing Drupal..."
chown -R $app: $final_path chown -R $app: $final_path
update-alternatives --set php /usr/bin/php$YNH_PHP_VERSION update-alternatives --set php /usr/bin/php${YNH_PHP_VERSION}
pushd "$final_path" pushd "$final_path"
sudo -u $app env PATH=$PATH drush site:install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes sudo -u $app env PATH=$PATH drush site:install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes
popd popd
update-alternatives --set php /usr/bin/php7.0 update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
#================================================= #=================================================
# SETUP THE CRON FILE # SETUP THE CRON FILE

View file

@ -32,15 +32,6 @@ ynh_print_info --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE PHP
#=================================================
if [ "$(lsb_release --codename --short)" != "buster" ]; then
ynh_print_info --message="Removing php..."
ynh_remove_php
fi
#================================================= #=================================================
# REMOVE DEPENDENCIES # REMOVE DEPENDENCIES
#================================================= #=================================================

View file

@ -77,6 +77,17 @@ ynh_print_info --message="Restoring user rights..."
# Restore permissions on app files # Restore permissions on app files
chown -R $app: $final_path chown -R $app: $final_path
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Restoring PHP-FPM configuration..."
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/${YNH_PHP_VERSION}/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
#================================================= #=================================================
@ -96,15 +107,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_print_info --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_dependencies"
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
#================================================= #=================================================
@ -116,7 +118,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
ynh_add_swap --size=512 ynh_add_swap --size=$swap_needed
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -81,7 +81,7 @@ ynh_abort_if_errors
ynh_print_info --message="Upgrading nginx web server configuration..." ynh_print_info --message="Upgrading nginx web server configuration..."
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config YNH_PHP_VERSION ynh_add_nginx_config
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -104,7 +104,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
ynh_print_info --message="Upgrading php-fpm configuration..." ynh_print_info --message="Upgrading php-fpm configuration..."
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_dependencies" ynh_add_fpm_config --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -113,14 +113,14 @@ ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_depende
#================================================= #=================================================
ynh_print_info --message="Adding swap..." ynh_print_info --message="Adding swap..."
ynh_add_swap --size=512 ynh_add_swap --size=$swap_needed
#================================================= #=================================================
# UPGRADE COMPOSER # UPGRADE COMPOSER
#================================================= #=================================================
ynh_print_info --message="Upgrading Composer..." ynh_print_info --message="Upgrading Composer..."
ynh_install_composer --phpversion="$YNH_PHP_VERSION" --workdir="$final_path" ynh_install_composer --phpversion="${YNH_PHP_VERSION}" --workdir="$final_path"
export PATH="$final_path/vendor/bin:$PATH" export PATH="$final_path/vendor/bin:$PATH"
@ -131,7 +131,7 @@ ynh_print_info --message="Upgrading Drupal..."
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php"
update-alternatives --set php /usr/bin/php$YNH_PHP_VERSION update-alternatives --set php /usr/bin/php${YNH_PHP_VERSION}
pushd "$final_path" pushd "$final_path"
sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 1 --input-format=integer sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 1 --input-format=integer
@ -142,7 +142,7 @@ pushd "$final_path"
sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 0 --input-format=integer sudo -u $app env PATH=$PATH drush @$app.prod state:set system.maintenance_mode 0 --input-format=integer
popd popd
update-alternatives --set php /usr/bin/php7.0 update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # STORE THE CONFIG FILE CHECKSUM
@ -182,7 +182,7 @@ ynh_print_info --message="Upgrading SSOwat configuration..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway # unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi fi