1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

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 1aea23fb52.

* 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 <yunohost@yunohost.org>
This commit is contained in:
eric_G 2023-12-03 13:01:47 +01:00 committed by GitHub
parent 81be997ce0
commit db32b207b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 64 additions and 92 deletions

View file

@ -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: <https://tt-rss.org>
* Official admin documentation: <https://tt-rss.org/wiki.php>
* Upstream app code repository: <https://git-gitea.tt-rss.org/fox/tt-rss>
* Upstream app code repository: <https://gitlab.tt-rss.org/tt-rss/tt-rss>
* YunoHost Store: <https://apps.yunohost.org/app/ttrss>
* Report a bug: <https://github.com/YunoHost-Apps/ttrss_ynh/issues>

View file

@ -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 lapp : <https://tt-rss.org>
* Documentation officielle de ladmin : <https://tt-rss.org/wiki.php>
* Dépôt de code officiel de lapp : <https://git-gitea.tt-rss.org/fox/tt-rss>
* Dépôt de code officiel de lapp : <https://gitlab.tt-rss.org/tt-rss/tt-rss>
* YunoHost Store: <https://apps.yunohost.org/app/ttrss>
* Signaler un bug : <https://github.com/YunoHost-Apps/ttrss_ynh/issues>

View file

@ -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!) ***

30
conf/migration Normal file
View file

@ -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

View file

@ -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

1
doc/PRE_UPGRADE.md Normal file
View file

@ -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.

1
doc/PRE_UPGRADE_fr.md Normal file
View file

@ -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.

View file

@ -5,7 +5,7 @@ name = "Tiny Tiny RSS"
description.en = "News feed (RSS/Atom) reader and aggregator"
description.fr = "Lecteur de flux dactualité 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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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