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

Apply example_ynh

This commit is contained in:
yalh76 2022-07-05 01:33:57 +02:00
parent f3f2e9dd58
commit 5cbdb55fca
12 changed files with 137 additions and 96 deletions

View file

@ -11,15 +11,13 @@
setup_private=1
setup_public=1
upgrade=1
#upgrade=1 from_commit=20435c4d005d7abffc45db4eac3d3e9492302c21
# 20200916~ynh5
upgrade=1 from_commit=20435c4d005d7abffc45db4eac3d3e9492302c21
# 20220606~ynh1
upgrade=1 from_commit=009f956487d1580b71a2bd250418854d8e094185
backup_restore=1
multi_instance=1
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=20435c4d005d7abffc45db4eac3d3e9492302c21
name=Testing (#105)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -2,7 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/ ;
alias __FINALPATH__/;
index index.php;

View file

@ -8,4 +8,4 @@ Tiny Tiny RSS is a free and open source web-based news feed (RSS/Atom) reader an
- sharing arbitrary content through tt-rss,
- Plugins and themes,
- podcasts,
- flexible article filtering
- flexible article filtering

View file

@ -1 +1,11 @@
Tiny Tiny RSS est un lecteur et agrégateur de flux d'actualités (RSS/Atom) en ligne gratuit et open source.
Tiny Tiny RSS est un lecteur et agrégateur de flux de nouvelles (RSS/Atom) basé sur le web, gratuit et à code source ouvert.
## Caractéristiques
- agrégation / syndication de flux,
- importation/exportation OPML,
- plusieurs façons de partager du contenu : exportation de flux RSS, plugins pour divers sites sociaux, partage par URL, etc,
- partage de contenu arbitraire via tt-rss,
- plugins et thèmes,
- podcasts,
- filtrage flexible des articles

4
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,4 @@
### Default login credentials
- Username: `admin`
- password: `password`

View file

@ -1,51 +1,51 @@
{
"name": "Tiny Tiny RSS",
"id": "ttrss",
"packaging_format": 1,
"description": {
"en": "News feed (RSS/Atom) reader and aggregator",
"fr": "Lecteur de flux dactualité utilisant les protocoles RSS et Atom"
},
"version": "20220626~ynh1",
"url": "http://tt-rss.org",
"upstream": {
"name": "Tiny Tiny RSS",
"id": "ttrss",
"packaging_format": 1,
"description": {
"en": "News feed (RSS/Atom) reader and aggregator",
"fr": "Lecteur de flux dactualité utilisant les protocoles RSS et Atom"
},
"version": "20220626~ynh1",
"url": "http://tt-rss.org",
"upstream": {
"license": "GPL-3.0-only",
"website": "http://tt-rss.org",
"website": "https://tt-rss.org",
"demo": "https://srv.tt-rss.org/tt-rss/",
"admindoc": "https://git.tt-rss.org/git/tt-rss/wiki",
"admindoc": "https://tt-rss.org/wiki.php",
"code": "https://git-gitea.tt-rss.org/fox/tt-rss"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx",
"php8.0-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/ttrss",
"default": "/ttrss"
},
{
"name": "is_public",
"type": "boolean",
"default": true
}
]
}
"license": "GPL-3.0-only",
"maintainer": {
"name": "",
"email": ""
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
"nginx",
"php8.0-fpm",
"mysql"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/ttrss",
"default": "/ttrss"
},
{
"name": "is_public",
"type": "boolean",
"default": true
}
]
}
}

View file

@ -6,10 +6,17 @@
YNH_PHP_VERSION="8.0"
pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-opcache \
php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml"
# dependencies used by the app
pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-fileinfo php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -26,19 +26,23 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Add settings here as needed by your application
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
@ -66,6 +70,13 @@ fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop"
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
@ -98,7 +109,9 @@ fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=1
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
domain_path="https://${new_domain}${new_path}"
domain="$new_domain"
@ -108,7 +121,15 @@ chmod 400 "$final_path/config.php"
chown $app "$final_path/config.php"
#=================================================
# GENERIC FINALIZATION
# 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"
#=================================================
# RELOAD NGINX
#=================================================

View file

@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
@ -23,7 +26,6 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
phpversion=$YNH_PHP_VERSION
app=$YNH_APP_INSTANCE_NAME
@ -46,6 +48,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# INSTALL DEPENDENCIES
#=================================================
@ -53,15 +57,13 @@ ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
@ -86,14 +88,6 @@ chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -103,6 +97,14 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
ynh_add_fpm_config
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
@ -133,7 +135,7 @@ ynh_script_progression --message="Initializing database..." --weight=6
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" \
< "$final_path/schema/ttrss_schema_mysql.sql"
sudo -u $app php${phpversion} ${final_path}/update.php --update-schema=force-yes
ynh_exec_as $app php${phpversion} ${final_path}/update.php --update-schema=force-yes
#=================================================
# GENERIC FINALIZATION
@ -157,8 +159,11 @@ ynh_systemd_action --service_name=$app --action="start"
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi

View file

@ -53,7 +53,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing the app main directory..." --weight=4
ynh_script_progression --message="Removing app main directory..." --weight=4
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -82,14 +82,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a cron file
ynh_exec_warn_less ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -14,13 +14,16 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -36,24 +39,18 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
@ -81,7 +78,12 @@ ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weig
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config
#=================================================
# 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 MYSQL DATABASE

View file

@ -27,18 +27,20 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=7
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=7
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
@ -92,7 +94,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -147,7 +149,7 @@ then
ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php"
ynh_script_progression --message="Upgrading ttrss database..." --weight=2
sudo -u $app php${phpversion} ${final_path}/update.php --update-schema=force-yes
ynh_exec_as $app php${phpversion} ${final_path}/update.php --update-schema=force-yes
fi
chmod 400 "$final_path/config.php"