From 0656f3ba5e55054e2c6cdc861306928170e5e6a0 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 5 Dec 2023 20:36:42 +0100 Subject: [PATCH] Testing (#160) * Auto-update README * Upgrade to upstream * Auto-update README * Bullseye (#141) * Fix * Fix * Auto-update README Co-authored-by: yunohost-bot * Upgrade * Auto-update README * Auto-update README * Upgrade to upstream * Auto-update README * PHP * Auto-update README * Update manifest.json * Auto-update README * Update config * Fix * Auto-update README * update * Auto-update README * Version 2 (#148) * v2 * v2 * Auto-update README * Fix * Auto-update README * fix --------- Co-authored-by: yunohost-bot * Update tests.toml * Delete check_process * Update restore * Update remove * Update install * Update upgrade * Fix * Update upgrade * Update manifest.toml * Update manifest.toml * data_migration * fix * Fix * Update manifest.toml * Auto-update README * Update manifest.toml * Update manifest.toml * Auto-update README * Update tests.toml * auto updater * Update manifest.toml * Auto-update README * remove data migration * update git repo * Auto-update README * Update manifest.toml * Update manifest.toml * Auto-update README * update to upstream * Auto-update README * fix * Auto-update README * Update manifest.toml * Update manifest.toml * Auto-update README * Update manifest.toml * Auto-update README * PostgreSQL (#150) * switch to PHP * Update install * Update _common.sh * Update _common.sh * Update app.src * Update manifest.json * Auto-update README * Fix * Update remove * Update _common.sh * Update app.src * Fix * Remove cron * Update install * Update change_url * Update systemd.service * Update install * Update DESCRIPTION.md * Auto-update README * Fix * Update manifest.json * Update restore * Update app.src * Create migration * v2 * v2 * Auto-update README * Fix * Auto-update README * fix * fix * fix * Update restore * data_migration * Revert "data_migration" This reverts commit 1aea23fb527ae3dade359d4e0b553cd87d10442a. * fix * fix * Update manifest.toml * Update manifest.toml * Update manifest.toml * Auto-update README * fix * Update manifest.toml * Update manifest.toml * Auto-update README * Create PRE_UPGRADE_fr.md * fix * Auto-update README * Auto-update README * Update manifest.toml * Auto-update README --------- Co-authored-by: Yunohost-Bot <> Co-authored-by: yunohost-bot --------- Co-authored-by: yunohost-bot --- README.md | 4 +-- README_fr.md | 4 +-- conf/config.php | 8 ++--- conf/migration | 30 ++++++++++++++++++ conf/systemd.service | 3 +- ...ig_panel.toml => config_panel.toml.example | 0 doc/PRE_UPGRADE.md | 1 + doc/PRE_UPGRADE_fr.md | 1 + manifest.toml | 14 ++++----- scripts/backup | 6 ++-- scripts/change_url | 9 ++---- scripts/install | 31 +++---------------- scripts/restore | 18 +++++------ scripts/upgrade | 27 +--------------- 14 files changed, 64 insertions(+), 92 deletions(-) create mode 100644 conf/migration rename config_panel.toml => config_panel.toml.example (100%) create mode 100644 doc/PRE_UPGRADE.md create mode 100644 doc/PRE_UPGRADE_fr.md diff --git a/README.md b/README.md index 50a88bc..2d55628 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Tiny Tiny RSS is a free and open source web-based news feed (RSS/Atom) reader an - flexible article filtering -**Shipped version:** 20231111~ynh1 +**Shipped version:** 20231202~ynh1 **Demo:** https://srv.tt-rss.org/tt-rss/ @@ -40,7 +40,7 @@ Tiny Tiny RSS is a free and open source web-based news feed (RSS/Atom) reader an * Official app website: * Official admin documentation: -* Upstream app code repository: +* Upstream app code repository: * YunoHost Store: * Report a bug: diff --git a/README_fr.md b/README_fr.md index 8e84e3c..460492a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -28,7 +28,7 @@ Tiny Tiny RSS est un lecteur et agrégateur de flux de nouvelles (RSS/Atom) bas - filtrage flexible des articles -**Version incluse :** 20231111~ynh1 +**Version incluse :** 20231202~ynh1 **Démo :** https://srv.tt-rss.org/tt-rss/ @@ -40,7 +40,7 @@ Tiny Tiny RSS est un lecteur et agrégateur de flux de nouvelles (RSS/Atom) bas * Site officiel de l’app : * Documentation officielle de l’admin : -* Dépôt de code officiel de l’app : +* Dépôt de code officiel de l’app : * YunoHost Store: * Signaler un bug : diff --git a/conf/config.php b/conf/config.php index 8098d2c..9c15695 100644 --- a/conf/config.php +++ b/conf/config.php @@ -4,16 +4,12 @@ // *** Database configuration (important!) *** // ******************************************* - putenv('TTRSS_DB_TYPE=mysql'); // or mysql + putenv('TTRSS_DB_TYPE=pgsql'); putenv('TTRSS_DB_HOST=localhost'); putenv('TTRSS_DB_USER=__DB_USER__'); putenv('TTRSS_DB_NAME=__DB_NAME__'); putenv('TTRSS_DB_PASS=__DB_PWD__'); - putenv('TTRSS_DB_PORT=3306'); // usually 5432 for PostgreSQL, 3306 for MySQL - - putenv('TTRSS_MYSQL_CHARSET=UTF8MB4'); - // Connection charset for MySQL. If you have a legacy database and/or experience - // garbage unicode characters with this option, try setting it to a blank string. + putenv('TTRSS_DB_PORT=5432'); // *********************************** // *** Basic settings (important!) *** diff --git a/conf/migration b/conf/migration new file mode 100644 index 0000000..15e836d --- /dev/null +++ b/conf/migration @@ -0,0 +1,30 @@ +# OPML import/export (including filters and some settings). Must be done before data_migration plugin if you want to keep feed categories + +# on the original machine +sudo mkdir /var/www/tt-rss/export +sudo chown -R www-data:www-data /var/www/tt-rss/export/ +sudo -u www-data php /var/www/tt-rss/update.php --opml-export "MYUSERNAME /var/www/tt-rss/export/export-2020-08-07.opml" # export feeds OPML +# on a client +rsync -avP my.original.machine.org:/var/www/tt-rss/export/export-2020-08-07.opml ./ # download opml export +# login to the new tt-rss instance from a browser, go to Preferences > Feeds, import OPML file + +# migrate all articles from mysql to postgresql +# on the original machine +git clone https://git.tt-rss.org/fox/ttrss-data-migration +sudo chown -R root:www-data ttrss-data-migration/ +sudo mv ttrss-data-migration/ /var/www/tt-rss/plugins.local/data_migration +sudo nano /var/www/tt-rss/config.php # enable data_migration in the PLUGINS array +sudo -u www-data php /var/www/tt-rss/update.php --data_user MYUSERNAME --data_export /var/www/tt-rss/export/export-2020-08-07.zip # export articles to database-agnostic format + +# on the target machine +git clone https://git.tt-rss.org/fox/ttrss-data-migration +sudo chown -R root:www-data ttrss-data-migration/ +sudo mv ttrss-data-migration/ /var/www/rss.example.org/plugins.local/data_migration +sudo nano /var/www/rss.example.org/config.php # enable data_migration in the PLUGINS array +rsync -avP my.original.machine.org:/var/www/tt-rss/export/export-2020-08-07.zip ./ +sudo mkdir /var/www/rss.example.org/export +sudo mv export-2020-08-07.zip /var/www/rss.example.org/export +sudo chown -R root:www-data /var/www/rss.example.org/export +sudo chmod -R g+rX /var/www/rss.example.org/export/ +sudo -u www-data php /var/www/rss.example.org/update.php --data_user MYUSERNAME --data_import /var/www/rss.example.org/export/export-2020-08-07.zip # it can take a while +sudo rm -r /var/www/rss.example.org/export/ # cleanup \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index abb587a..341d325 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,6 +1,5 @@ -[Unit] Description=TTRSS: News feed reader and aggregator -After=network.target mysql.service +After=network.target postgresql.service [Service] Type=simple diff --git a/config_panel.toml b/config_panel.toml.example similarity index 100% rename from config_panel.toml rename to config_panel.toml.example diff --git a/doc/PRE_UPGRADE.md b/doc/PRE_UPGRADE.md new file mode 100644 index 0000000..b43cd17 --- /dev/null +++ b/doc/PRE_UPGRADE.md @@ -0,0 +1 @@ +We are moving from MariaDB to PostgreSQL database. There is no database migration for now. It advised to export your OPML, install TTRSS and import back the OPML file. \ No newline at end of file diff --git a/doc/PRE_UPGRADE_fr.md b/doc/PRE_UPGRADE_fr.md new file mode 100644 index 0000000..bfde255 --- /dev/null +++ b/doc/PRE_UPGRADE_fr.md @@ -0,0 +1 @@ +Nous passons de MariaDB à la base de données PostgreSQL. Il n'y a pas de migration de base de données pour l'instant. Il est conseillé d'exporter votre OPML, d'installer TTRSS et de réimporter le fichier OPML. \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 2adab14..0c8468a 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "Tiny Tiny RSS" description.en = "News feed (RSS/Atom) reader and aggregator" description.fr = "Lecteur de flux d’actualité utilisant les protocoles RSS et Atom" -version = "20231111~ynh1" +version = "20231202~ynh1" maintainers = [] @@ -14,7 +14,7 @@ license = "GPL-3.0-only" website = "https://tt-rss.org" demo = "https://srv.tt-rss.org/tt-rss/" admindoc = "https://tt-rss.org/wiki.php" -code = "https://git-gitea.tt-rss.org/fox/tt-rss" +code = "https://gitlab.tt-rss.org/tt-rss/tt-rss" [integration] yunohost = ">= 11.2" @@ -26,7 +26,7 @@ ldap = false sso = false disk = "50M" -ram.build = "50M" +ram.build = "150M" ram.runtime = "50M" [install] @@ -43,8 +43,8 @@ ram.runtime = "50M" [resources] [resources.sources.main] - url = "https://gitlab.tt-rss.org/tt-rss/tt-rss/-/archive/1fe1132a1a68bd0fedc313823b942130167fad86.tar.gz" - sha256 = "9c43a9caa714c401cf5cd397397adc51fb7df01663dda81c40d1f586c25bc012" + url = "https://gitlab.tt-rss.org/tt-rss/tt-rss/-/archive/2b8e34453234b8b31ebc9e7020f8677bf3889898.tar.gz" + sha256 = "72ec560bd5ad7bac4789d7af0e5c2d7c1c394e9c540d46d5421ecae219d8f875" [resources.system_user] @@ -62,7 +62,7 @@ ram.runtime = "50M" api.protected = true [resources.apt] - packages = "mariadb-server, php8.2-mysql, php8.2-curl, php8.2-gd, php8.2-opcache, php8.2-fileinfo, php8.2-intl, php8.2-cli, php8.2-mbstring, php8.2-xml" + packages = "postgresql php8.2-pgsql php8.2-curl php8.2-gd php8.2-opcache php8.2-fileinfo php8.2-intl php8.2-cli php8.2-mbstring php8.2-xml" [resources.database] - type = "mysql" + type = "postgresql" diff --git a/scripts/backup b/scripts/backup index c5466d5..722244d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,11 +40,11 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= -# BACKUP THE MYSQL DATABASE +# BACKUP THE POSTGRESQL DATABASE #================================================= -ynh_print_info --message="Backing up the MySQL database..." +ynh_print_info --message="Backing up the PostgreSQL database..." -ynh_mysql_dump_db --database="$db_name" > db.sql +ynh_psql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT diff --git a/scripts/change_url b/scripts/change_url index 6c4c9a5..2bccdeb 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,9 +14,9 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -39,15 +39,12 @@ ynh_add_config --template="../conf/config.php" --destination="$install_dir/confi chmod 400 "$install_dir/config.php" chown $app "$install_dir/config.php" -#================================================= -# GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." -# Start a systemd service -ynh_systemd_action --service_name=$app --action="start" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index de14f56..33a910e 100644 --- a/scripts/install +++ b/scripts/install @@ -9,22 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# RETRIEVE ARGUMENTS FROM THE MANIFEST -#================================================= - -fpm_footprint="low" -fpm_free_footprint=0 -fpm_usage="low" - -#================================================= -# STORE SETTINGS FROM MANIFEST -#================================================= - -ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -38,20 +22,13 @@ echo "$(ynh_app_upstream_version)" > "$install_dir/version_static.txt" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# ALTER DATABASE -#================================================= - -ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ - <<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" - #================================================= # SYSTEM CONFIGURATION #================================================= 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 +ynh_add_fpm_config --usage=low --footprint=low # Create a dedicated NGINX config ynh_add_nginx_config @@ -80,10 +57,10 @@ chown $app "$install_dir/config.php" #================================================= ynh_script_progression --message="Initializing database..." --weight=6 -ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ - < "$install_dir/schema/ttrss_schema_mysql.sql" +ynh_psql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \ + < "$install_dir/schema/ttrss_schema_pgsql.sql" -ynh_exec_as $app php${phpversion} ${install_dir}/update.php --update-schema=force-yes +ynh_exec_as $app php$phpversion $install_dir/update.php --update-schema=force-yes #================================================= # START SYSTEMD SERVICE diff --git a/scripts/restore b/scripts/restore index 9cffa28..811a2b0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -21,18 +21,16 @@ chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# RESTORE THE MYSQL DATABASE +# RESTORE THE POSTGRESQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." --weight=5 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=50 ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" @@ -44,15 +42,13 @@ systemctl enable $app.service --quiet yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log" #================================================= -# GENERIC FINALIZATION +# START SYSTEMD SERVICE #================================================= -# 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 --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 356f564..51fd702 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -29,24 +29,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= ynh_script_progression --message="Ensuring downward compatibility..." --weight=2 -# If fpm_footprint doesn't exist, create it -if [ -z "${fpm_footprint:-}" ]; then - fpm_footprint=low - ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint -fi - -# If fpm_free_footprint doesn't exist, create it -if [ -z "${fpm_free_footprint:-}" ]; then - fpm_free_footprint=0 - ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint -fi - -# If fpm_usage doesn't exist, create it -if [ -z "${fpm_usage:-}" ]; then - fpm_usage=low - ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage -fi - # Do not remove the file before the backup, to not fail the backup. # Remove old cron job ynh_secure_remove --file="/etc/cron.d/$app" @@ -68,20 +50,13 @@ fi chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -#================================================= -# ALTER DATABASE -#================================================= - -ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \ - <<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" - #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= 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 +ynh_add_fpm_config --usage=low --footprint=low # Create a dedicated NGINX config ynh_add_nginx_config