From 9b6f21173872ffb5be3298c3bba033dd863a54d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 26 Feb 2023 09:43:28 +0100 Subject: [PATCH] Fix --- doc/POST_INSTALL.md | 2 -- doc/POST_INSTALL_fr.md | 2 -- scripts/install | 45 +++++++++++++------------------------- scripts/remove | 32 +++------------------------ scripts/restore | 49 ++++++++++++------------------------------ scripts/upgrade | 31 ++++++-------------------- 6 files changed, 39 insertions(+), 122 deletions(-) diff --git a/doc/POST_INSTALL.md b/doc/POST_INSTALL.md index 61c005e..c286b1c 100644 --- a/doc/POST_INSTALL.md +++ b/doc/POST_INSTALL.md @@ -1,5 +1,3 @@ -## Configuration - BookStack uses LDAP authentication by default. You can switch to standard authentication in the webadmin -> bookstack -> config panel setting. diff --git a/doc/POST_INSTALL_fr.md b/doc/POST_INSTALL_fr.md index aa11cd0..6751601 100644 --- a/doc/POST_INSTALL_fr.md +++ b/doc/POST_INSTALL_fr.md @@ -1,5 +1,3 @@ -## Configuration - BookStack utilise l'authentification LDAP par défaut. Vous pouvez passer à l'authentification standard dans le webadmin -> Bookstack -> paramètre du panneau de configuration. diff --git a/scripts/install b/scripts/install index 1136371..3f60ac3 100644 --- a/scripts/install +++ b/scripts/install @@ -36,22 +36,27 @@ ynh_script_progression --message="Setting up source files..." --weight=7 ynh_setup_source --dest_dir="$install_dir" +# Set permissions to app files +chmod 750 $install_dir +chmod -R o-rwx $install_dir +chown -R $app:www-data $install_dir + #================================================= -# PHP-FPM CONFIGURATION +# SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 +ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 - # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log" + #================================================= # INSTALL LYCHEE WITH COMPOSER #================================================= @@ -69,6 +74,9 @@ app_url_domain="https://$domain${path%/}" ynh_add_config --template=../conf/.env.example --destination=$install_dir/.env +chmod 600 $install_dir/.env +chown $app:$app $install_dir/.env + #================================================= # FINAL BOOKSTACK INSTALL #================================================= @@ -80,29 +88,6 @@ pushd $install_dir php$phpversion artisan bookstack:create-admin --email="$email" --name="$admin" --external-auth-id="$admin" popd -# Set permissions to app files -chmod 755 $install_dir -chmod -R o-rwx $install_dir -chown -R $app:www-data $install_dir - -chmod 600 $install_dir/.env -chown $app:$app $install_dir/.env - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index 5d7f8ae..38872bb 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,17 +10,11 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# LOAD SETTINGS +# REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 - -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) - -#================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null @@ -29,34 +23,14 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE THE REDIS DATABASE -#================================================= -ynh_script_progression --message="Removing the redis database..." - ynh_redis_remove_db "$redis_db" -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2 - # Remove the dedicated PHP-FPM config ynh_remove_fpm_config diff --git a/scripts/restore b/scripts/restore index ca8798a..dca5514 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,28 +17,11 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" # Restore permissions on app files -chmod 755 $install_dir -chown -R $app:www-data $install_dir +chmod 750 $install_dir chmod -R o-rwx $install_dir +chown -R $app:www-data $install_dir chmod 600 $install_dir/.env -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5 - -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" - -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion - -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -47,37 +30,33 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=2 ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= -# RESTORE SYSTEMD +# RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log" -#================================================= -# START SYSTEMD SERVICE -#================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 - -ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" - #================================================= # GENERIC FINALIZATION #================================================= -# RELOAD NGINX AND PHP-FPM +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 47fffe0..99b6691 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -14,9 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Loading installation settings..." --weight=1 -phpversion=$YNH_PHP_VERSION timezone="$(cat /etc/timezone)" -redis_db=$(ynh_app_setting_get --app=$app --key=redis_db) #================================================= # CHECK VERSION @@ -66,21 +64,21 @@ then fi #================================================= -# PHP-FPM CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3 - # Create a dedicated NGINX config ynh_add_nginx_config +# Create a dedicated systemd config +ynh_add_systemd_config + +yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log" + #================================================= # INSTALL LYCHEE WITH COMPOSER #================================================= @@ -118,21 +116,6 @@ chown -R $app:www-data $install_dir chmod 600 $install_dir/.env chown $app:$app $install_dir/.env -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #=================================================