1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bookstack_ynh.git synced 2024-09-03 18:16:02 +02:00
bookstack_ynh/scripts/upgrade
Éric Gaspar 3731b7ad50 cleaning
2024-06-21 08:42:46 +02:00

104 lines
3.3 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# If fpm_footprint doesn't exist, create it
if [ -z "${fpm_footprint:-}" ]; then
#REMOVEME? fpm_footprint=low
ynh_app_setting_set --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "${fpm_free_footprint:-}" ]; then
#REMOVEME? fpm_free_footprint=0
ynh_app_setting_set --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "${fpm_usage:-}" ]; then
#REMOVEME? fpm_usage=low
ynh_app_setting_set --key=fpm_usage --value=$fpm_usage
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env public/uploads storage/uploads"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Upgrading system configurations related to $app..."
# Create a dedicated PHP-FPM config
ynh_config_add_phpfpm
# Create a dedicated NGINX config
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# INSTALL LYCHEE WITH COMPOSER
#=================================================
ynh_script_progression "Installing BookStack with Composer..."
# Install composer
ynh_composer_install
ynh_composer_exec install --no-dev
#=================================================
# MODIFY A CONFIG FILE
#=================================================
#ynh_script_progression "Adding $app's configuration..."
#timezone="$(cat /etc/timezone)"
#app_url_domain="https://$domain${path%/}"
#ynh_config_add --template=.env --destination=$install_dir/.env
#=================================================
# FINAL BOOKSTACK INSTALL
#=================================================
ynh_script_progression "Install BookStack"
pushd $install_dir
php$php_version artisan migrate --force
php$php_version artisan key:generate --force
php$php_version artisan cache:clear
php$php_version artisan config:clear
php$php_version artisan view:clear
popd
#=================================================
# SET PERMISSIONS
#=================================================
chmod -R o-rwx $install_dir
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
chown -R $app:www-data $install_dir
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"