1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00
This commit is contained in:
Éric Gaspar 2023-03-18 13:45:58 +01:00
parent 80f797be36
commit 6b6e0d8ce2
7 changed files with 37 additions and 106 deletions

View file

@ -4,12 +4,12 @@
// *** Database configuration (important!) ***
// *******************************************
putenv('TTRSS_DB_TYPE=pgsql'); // 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=5432'); // usually 5432 for PostgreSQL, 3306 for MySQL
putenv('TTRSS_DB_PORT=5432');
// ***********************************
// *** Basic settings (important!) ***

View file

@ -1,5 +1,5 @@
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.

View file

@ -30,21 +30,21 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
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
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log"
#=================================================
# SPECIFIC SETUP
#=================================================
@ -59,32 +59,15 @@ ynh_add_config --template="../conf/config.php" --destination="$install_dir/confi
chmod 400 "$install_dir/config.php"
chown $app "$install_dir/config.php"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# INITIALIZE DATABASE
#=================================================
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
#=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log"
ynh_exec_as $app php$phpversion $install_dir/update.php --update-schema=force-yes
#=================================================
# START SYSTEMD SERVICE

View file

@ -9,12 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -23,27 +23,12 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=3
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config

View file

@ -20,58 +20,37 @@ ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=50
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
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 SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
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=nginx --action=reload

View file

@ -68,21 +68,21 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
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
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log"
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -103,23 +103,6 @@ fi
chmod 400 "$install_dir/config.php"
chown $app:$app "$install_dir/config.php"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=2
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="News feed reader and aggregator" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================