diff --git a/ALL_README.md b/ALL_README.md index 152f2e7..df3708b 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -5,4 +5,7 @@ - [Irakurri README euskaraz](README_eu.md) - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) +- [Baca README dalam bahasa bahasa Indonesia](README_id.md) +- [Lees de README in het Nederlands](README_nl.md) +- [Прочитать README на русский](README_ru.md) - [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README_es.md b/README_es.md index 7935c38..650c885 100644 --- a/README_es.md +++ b/README_es.md @@ -40,7 +40,7 @@ Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallaba ## Información para desarrolladores -Por favor enviar sus correcciones a la [`branch testing`](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing +Por favor enviar sus correcciones a la [rama `testing`](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing). Para probar la rama `testing`, sigue asÍ: diff --git a/README_id.md b/README_id.md new file mode 100644 index 0000000..1dd1cec --- /dev/null +++ b/README_id.md @@ -0,0 +1,53 @@ + + +# Wallabag untuk YunoHost + +[![Tingkat integrasi](https://dash.yunohost.org/integration/wallabag2.svg)](https://ci-apps.yunohost.org/ci/apps/wallabag2/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/wallabag2.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/wallabag2.maintain.svg) + +[![Pasang Wallabag dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wallabag2) + +*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)* + +> *Paket ini memperbolehkan Anda untuk memasang Wallabag secara cepat dan mudah pada server YunoHost.* +> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.* + +## Ringkasan + +Wallabag is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. +It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps (Android/iOS/Windows Phone) and even on e-reader (PocketBook/Kobo). + +Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html). + + +**Versi terkirim:** 2.5.4~ynh7 + +**Demo:** + +## Tangkapan Layar + +![Tangkapan Layar pada Wallabag](./doc/screenshots/screenshot1.webp) + +## Dokumentasi dan sumber daya + +- Website aplikasi resmi: +- Dokumentasi admin resmi: +- Depot kode aplikasi hulu: +- Gudang YunoHost: +- Laporkan bug: + +## Info developer + +Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing). + +Untuk mencoba branch `testing`, silakan dilanjutkan seperti: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +atau +sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +``` + +**Info lebih lanjut mengenai pemaketan aplikasi:** diff --git a/README_nl.md b/README_nl.md new file mode 100644 index 0000000..fe579f1 --- /dev/null +++ b/README_nl.md @@ -0,0 +1,53 @@ + + +# Wallabag voor Yunohost + +[![Integratieniveau](https://dash.yunohost.org/integration/wallabag2.svg)](https://ci-apps.yunohost.org/ci/apps/wallabag2/) ![Mate van functioneren](https://ci-apps.yunohost.org/ci/badges/wallabag2.status.svg) ![Onderhoudsstatus](https://ci-apps.yunohost.org/ci/badges/wallabag2.maintain.svg) + +[![Wallabag met Yunohost installeren](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wallabag2) + +*[Deze README in een andere taal lezen.](./ALL_README.md)* + +> *Met dit pakket kun je Wallabag snel en eenvoudig op een YunoHost-server installeren.* +> *Als je nog geen YunoHost hebt, lees dan [de installatiehandleiding](https://yunohost.org/install), om te zien hoe je 'm installeert.* + +## Overzicht + +Wallabag is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. +It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps (Android/iOS/Windows Phone) and even on e-reader (PocketBook/Kobo). + +Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html). + + +**Geleverde versie:** 2.5.4~ynh7 + +**Demo:** + +## Schermafdrukken + +![Schermafdrukken van Wallabag](./doc/screenshots/screenshot1.webp) + +## Documentatie en bronnen + +- Officiele website van de app: +- Officiele beheerdersdocumentatie: +- Upstream app codedepot: +- YunoHost-store: +- Meld een bug: + +## Ontwikkelaarsinformatie + +Stuur je pull request alsjeblieft naar de [`testing`-branch](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing). + +Om de `testing`-branch uit te proberen, ga als volgt te werk: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +of +sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +``` + +**Verdere informatie over app-packaging:** diff --git a/README_ru.md b/README_ru.md new file mode 100644 index 0000000..a000145 --- /dev/null +++ b/README_ru.md @@ -0,0 +1,53 @@ + + +# Wallabag для YunoHost + +[![Уровень интеграции](https://dash.yunohost.org/integration/wallabag2.svg)](https://ci-apps.yunohost.org/ci/apps/wallabag2/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/wallabag2.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/wallabag2.maintain.svg) + +[![Установите Wallabag с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=wallabag2) + +*[Прочтите этот README на других языках.](./ALL_README.md)* + +> *Этот пакет позволяет Вам установить Wallabag быстро и просто на YunoHost-сервер.* +> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.* + +## Обзор + +Wallabag is a self hostable Read-It-Later application allowing you to not miss any content anymore. Click, save, read it when you can. +It provides a web interface, browser (Firefox/Chrome/Opera) add-ons, mobile apps (Android/iOS/Windows Phone) and even on e-reader (PocketBook/Kobo). + +Upgrade from the YunoHost [Wallabag v1](https://github.com/YunoHost-Apps/wallabag_ynh) app requires a manual operation. That's why it's provided as a new package. For the migration process, please refer to the [Wallabag official documentation](https://doc.wallabag.org/en/user/import/wallabagv1.html). + + +**Поставляемая версия:** 2.5.4~ynh7 + +**Демо-версия:** + +## Снимки экрана + +![Снимок экрана Wallabag](./doc/screenshots/screenshot1.webp) + +## Документация и ресурсы + +- Официальный веб-сайт приложения: +- Официальная документация администратора: +- Репозиторий кода главной ветки приложения: +- Магазин YunoHost: +- Сообщите об ошибке: + +## Информация для разработчиков + +Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing). + +Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +или +sudo yunohost app upgrade wallabag2 -u https://github.com/YunoHost-Apps/wallabag2_ynh/tree/testing --debug +``` + +**Больше информации о пакетировании приложений:** diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 700c37c..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M diff --git a/conf/nginx.conf b/conf/nginx.conf index 962767d..cb303de 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,7 +9,7 @@ location __PATH__/ { fastcgi_read_timeout 60m; client_max_body_size 50M; - try_files $uri @__NAME__; + try_files $uri @__APP__; location ~ ^__PATH__/app\.php(/|$) { include fastcgi_params; @@ -17,7 +17,7 @@ location __PATH__/ { fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param REMOTE_USER $remote_user; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_intercept_errors on; } @@ -31,6 +31,6 @@ location __PATH__/ { include conf.d/yunohost_panel.conf.inc; } -location @__NAME__ { +location @__APP__ { rewrite ^ __PATH__/app.php/$is_args$args; } diff --git a/manifest.toml b/manifest.toml index f2a95ca..2896b5c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -21,7 +21,8 @@ cpe = "cpe:2.3:a:wallabag:wallabag" fund = "https://liberapay.com/wallabag" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.30" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = true @@ -57,6 +58,7 @@ ram.runtime = "50M" allow_email = true [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index 89026c8..f6ce6d5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,21 +1,13 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= YNH_COMPOSER_VERSION="2.7.7" # Define a function to execute commands with `php_exec` php_exec() { - (cd "$install_dir" && ynh_exec_as "$app" \ - php${phpversion} "$install_dir/bin/console" --no-interaction --env=prod "$@") + (cd "$install_dir" && ynh_exec_as_app \ + php${php_version} "$install_dir/bin/console" --no-interaction --env=prod "$@") } - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index 5fb5b0d..0e57a25 100644 --- a/scripts/backup +++ b/scripts/backup @@ -4,46 +4,42 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= # Clean cache files before backup (saved some disk space) -ynh_secure_remove --file=$install_dir/var/cache/prod +ynh_safe_rm $install_dir/var/cache/prod -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" -ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" +ynh_backup "/etc/fail2ban/jail.d/$app.conf" +ynh_backup "/etc/fail2ban/filter.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_mysql_dump_db > db.sql #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 05e3046..885b59a 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -10,35 +10,35 @@ source /usr/share/yunohost/helpers #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # UPDATE CONFIGURATION #================================================= -ynh_script_progression --message="Updating wallabag configuration..." +ynh_script_progression "Updating wallabag configuration..." # Configure Wallabag instance URL -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ +ynh_mysql_db_shell \ <<< "UPDATE internal_setting SET value = 'https://$new_domain$new_path' WHERE name = 'wallabag_url'" # Change domain name in parameters.yml -ynh_replace_string --target_file="$install_dir/app/config/parameters.yml" --match_string="domain_name: .*" --replace_string="domain_name: https://$new_domain$new_path" +ynh_replace --file="$install_dir/app/config/parameters.yml" --match="domain_name: .*" --replace="domain_name: https://$new_domain$new_path" # If "Download images locally" option has been enabled in Internal Settings -download_images_enabled=$(ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ +download_images_enabled=$(ynh_mysql_db_shell \ <<< "SELECT value from internal_setting WHERE name='download_images_enabled '" | tail -n 1) if [ "$download_images_enabled" = "1" ]; then - ynh_print_info --message="Updating images URL; this operation may take a while..." + ynh_print_info "Updating images URL; this operation may take a while..." # Query/replace the domain/path in every entry.content in mysql database - ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ + ynh_mysql_db_shell \ <<< "UPDATE entry SET content = REPLACE(content, '$old_domain$old_path', '$new_domain$new_path');" fi # Clear assets cache -ynh_secure_remove --file="$install_dir/var/cache" +ynh_safe_rm "$install_dir/var/cache" mkdir "$install_dir/var/cache" chown "$app:www-data" "$install_dir/var/cache" @@ -46,4 +46,4 @@ chown "$app:www-data" "$install_dir/var/cache" # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index e38a5c8..8e8dfc4 100644 --- a/scripts/install +++ b/scripts/install @@ -13,23 +13,21 @@ source /usr/share/yunohost/helpers # Generate random DES key & password deskey=$(ynh_string_random --length=24) -ynh_app_setting_set --app="$app" --key="deskey" --value="$deskey" +ynh_app_setting_set --key="deskey" --value="$deskey" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=6 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" -# Create log dir/file FIXME: is it useless? +# Create log dir/file 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" @@ -50,12 +48,9 @@ chown -R "$app:www-data" "$install_dir" #================================================= # APP INITIAL CONFIGURATION #================================================= -ynh_script_progression --message="Adding $app's configuration files..." --weight=1 +ynh_script_progression "Adding $app's configuration files..." -ynh_add_config --template="parameters.yml" --destination="$install_dir/app/config/parameters.yml" - -chmod 600 "$install_dir/app/config/parameters.yml" -chown "$app:$app" "$install_dir/app/config/parameters.yml" +ynh_config_add --template="parameters.yml" --destination="$install_dir/app/config/parameters.yml" # Install dependencies and Wallabag php_exec wallabag:install @@ -72,38 +67,31 @@ done php_exec fos:user:promote --super "$admin" # 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'" - -# Set permissions to app files -chown -R "$app:www-data" "$install_dir" +ynh_mysql_db_shell <<< "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" +ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_create" +ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_delete" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." -# Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -# Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_config_add_phpfpm -# Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="$install_dir/var/logs/prod.log" +ynh_config_add_logrotate "$install_dir/var/logs/prod.log" # Create a dedicated Fail2Ban config -ynh_add_fail2ban_config --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP ""' --max_retry=5 +ynh_config_add_fail2ban --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP ""' #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index aabd88a..1cc3851 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,22 +10,18 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." -# Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate -# Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx -# Remove the dedicated PHP-FPM config -ynh_remove_fpm_config +ynh_config_remove_phpfpm -# Remove the dedicated Fail2Ban config -ynh_remove_fail2ban_config +ynh_config_remove_fail2ban #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index dd1c787..b4b5d07 100644 --- a/scripts/restore +++ b/scripts/restore @@ -4,20 +4,17 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" +ynh_restore "$install_dir" # 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" @@ -26,36 +23,36 @@ fi #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=1 +ynh_script_progression "Restoring the MySQL database..." -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql +ynh_mysql_db_shell < ./db.sql #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" -ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf" -ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf" -ynh_systemd_action --action=restart --service_name=fail2ban +ynh_restore "/etc/fail2ban/jail.d/$app.conf" +ynh_restore "/etc/fail2ban/filter.d/$app.conf" +ynh_systemctl --action=restart --service=fail2ban #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload +ynh_systemctl --service="php$php_version-fpm" --action=reload -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index e089ecf..744ff4f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,18 +23,15 @@ fi #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=6 +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=1 --keep="app/config/parameters.yml var/logs web/assets/images" +ynh_setup_source --dest_dir="$install_dir" --full_replace --keep="app/config/parameters.yml var/logs web/assets/images" -# Create log dir/file FIXME: is it useless? +# Create log dir/file 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" @@ -55,7 +52,7 @@ chown -R "$app:www-data" "$install_dir" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Reconfiguring $app..." --weight=1 +ynh_script_progression "Reconfiguring $app..." ynh_add_config --template="parameters.yml" --destination="$install_dir/app/config/parameters.yml" @@ -67,34 +64,30 @@ 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'" +ynh_mysql_db_shell <<< "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" +ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_create" +ynh_replace --match="__APP__" --replace="$app" --file="../hooks/post_user_delete" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." -# Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx -# Create a dedicated PHP-FPM config -ynh_add_fpm_config +ynh_config_add_phpfpm -ynh_use_logrotate --non-append --logfile="$install_dir/var/logs/prod.log" +ynh_config_add_logrotate "$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 ""' --max_retry=5 # same as install config +ynh_config_add_fail2ban --logpath="$install_dir/var/logs/prod.log" --failregex='app.ERROR: Authentication failure for user "([\w]+)?", from IP ""' # same as install config #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"