mirror of
https://github.com/YunoHost-Apps/streams_ynh.git
synced 2024-09-03 20:26:20 +02:00
Rework of scripts
More scripts rework Can't even remember why I'm doing this Oopsie wrong filename wrong filename, again! Give up the ynh_setup_source strategy
This commit is contained in:
parent
068b643e83
commit
1740efd0a3
6 changed files with 25 additions and 24 deletions
|
@ -5,7 +5,7 @@ name = "Streams"
|
||||||
description.en = "Open source fediverse server"
|
description.en = "Open source fediverse server"
|
||||||
description.fr = "Serveur fediverse open source"
|
description.fr = "Serveur fediverse open source"
|
||||||
|
|
||||||
version = "23.11.11~ynh1"
|
version = "23.11.12~ynh1"
|
||||||
|
|
||||||
maintainers = ["Papa Dragon"]
|
maintainers = ["Papa Dragon"]
|
||||||
|
|
||||||
|
@ -37,17 +37,6 @@ ram.runtime = "50M"
|
||||||
type = "user"
|
type = "user"
|
||||||
|
|
||||||
[resources]
|
[resources]
|
||||||
<<<<<<< HEAD
|
|
||||||
[resources.sources]
|
|
||||||
[resources.sources.main]
|
|
||||||
url = "https://codeberg.org/streams/streams/archive/8fb92b522b8bff562b350070b57954a998875e58.tar.gz"
|
|
||||||
sha256 = "b06cb71508cdb166002b41d08a9385bac2bfd9ddb3301116a8cdf9b3bc026275"
|
|
||||||
|
|
||||||
[resources.sources.addons]
|
|
||||||
url = "https://codeberg.org/streams/streams-addons/archive/39b1c5af9f2b1c639b6438ac85b0ea85273fc201.tar.gz"
|
|
||||||
sha256 = "5885665bf3dfbe843387184543be17b6b2061b807a57c1d6962548af80794f75"
|
|
||||||
=======
|
|
||||||
>>>>>>> d73fcb5 (Switch from tarball download to git clone for the install)
|
|
||||||
|
|
||||||
[resources.ports]
|
[resources.ports]
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,11 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP VARIOUS FILES
|
# BACKUP CRON JOBS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
ynh_backup --src_path="/$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATABASE
|
# BACKUP THE DATABASE
|
||||||
|
|
|
@ -79,6 +79,11 @@ ynh_script_progression --message="Pulling in external libraries with Composer...
|
||||||
ynh_install_composer --workdir="$install_dir"
|
ynh_install_composer --workdir="$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADDONS
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing addons..."
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
ynh_exec_as $app git config pull.rebase false
|
ynh_exec_as $app git config pull.rebase false
|
||||||
ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons
|
ynh_exec_as $app util/add_addon_repo https://codeberg.org/streams/streams-addons.git zaddons
|
||||||
|
@ -102,17 +107,13 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$install_dir/.htconfig.php"
|
ynh_add_config --template="../conf/htconfig.sample.php" --destination="$install_dir/.htconfig.php"
|
||||||
|
|
||||||
# addon ldap config
|
|
||||||
#ynh_script_progression --message="Push LDAP configuration to .htconfig.php..."
|
|
||||||
|
|
||||||
#cat ../conf/ldap_conf.php >> $install_dir/.htconfig.php
|
|
||||||
ynh_store_file_checksum --file=$install_dir/.htconfig.php
|
ynh_store_file_checksum --file=$install_dir/.htconfig.php
|
||||||
|
|
||||||
chmod 600 "$install_dir/.htconfig.php"
|
chmod 600 "$install_dir/.htconfig.php"
|
||||||
chown $app:$app "$install_dir/.htconfig.php"
|
chown $app:$app "$install_dir/.htconfig.php"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET CRON JOB
|
# SET CRON JOBS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setuping cron job..." --weight=1
|
ynh_script_progression --message="Setuping cron job..." --weight=1
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ ynh_remove_fail2ban_config
|
||||||
# Remove a cron file
|
# Remove a cron file
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
|
# Remove daily updates logfile
|
||||||
|
ynh_secure_remove --file="$data_dir/daily-updates.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -38,12 +38,15 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
||||||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
#=================================================
|
||||||
|
# RESTORE CRON JOBS
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||||
|
ynh_restore_file --origin_path="$data_dir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE LOGROTATE
|
||||||
|
#=================================================
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -53,6 +56,10 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --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_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
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ then
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir" --keep="store/ .htconfig.php php.log"
|
ynh_setup_source --dest_dir="$install_dir" --keep="store/ .htconfig.php php.log"
|
||||||
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p "$install_dir/store"
|
mkdir -p "$install_dir/store"
|
||||||
|
@ -115,7 +115,7 @@ chmod 644 "/etc/cron.d/$app"
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||||
|
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_use_logrotate "$install_dir/php.log"
|
||||||
|
|
||||||
# Create a dedicated Fail2Ban config
|
# Create a dedicated Fail2Ban config
|
||||||
ynh_add_fail2ban_config --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
ynh_add_fail2ban_config --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$" --max_retry="5"
|
||||||
|
|
Loading…
Add table
Reference in a new issue