mirror of
https://github.com/YunoHost-Apps/wallabag2_ynh.git
synced 2024-10-01 13:35:06 +02:00
* Fix hook (#206) * Auto-update READMEs * fix hook --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Update manifest.toml (#208) * Update manifest.toml * Auto-update READMEs * Add parameters.yml (#209) * Add parameters.yml * Update upgrade * Update change_url * Function (#210) * Add parameters.yml * Update upgrade * add function --------- Co-authored-by: Kayou <pierre@kayou.io> Co-authored-by: yunohost-bot <yunohost@yunohost.org>
70 lines
2.6 KiB
Bash
70 lines
2.6 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..." --weight=6
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="app/config/parameters.yml var/logs web/assets/images"
|
|
|
|
# Create log dir/file FIXME: is it useless?
|
|
mkdir -p "$install_dir/var/logs/"
|
|
touch "$install_dir/var/logs/prod.log"
|
|
|
|
# Set permissions to app files
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
# Restrict rights to Wallabag user only
|
|
if [ -e "$install_dir/var/cache/prod/appProdProjectContainer.php" ]; then
|
|
chmod 700 "$install_dir/var/cache/prod/appProdProjectContainer.php"
|
|
fi
|
|
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Reconfiguring $app..." --weight=1
|
|
|
|
# Upgrade database and clear the cache
|
|
php_exec doctrine:migrations:migrate
|
|
php_exec cache:clear
|
|
|
|
# Configure Wallabag instance URL
|
|
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
|
|
<<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'"
|
|
|
|
#=================================================
|
|
# SETUP HOOKS
|
|
#=================================================
|
|
|
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_create"
|
|
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../hooks/post_user_delete"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
ynh_use_logrotate --non-append --logfile="$install_dir/var/logs/prod.log"
|
|
|
|
# Add fail2ban config
|
|
ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP "<HOST>"' --max_retry=5 # same as install config
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|