1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00
This commit is contained in:
Éric Gaspar 2023-08-21 12:34:53 +02:00
parent 8bb3c37b28
commit 747793ee72
4 changed files with 26 additions and 27 deletions

View file

@ -36,22 +36,26 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM configy
ynh_add_fpm_config --usage=low --footprint=low
# Create a dedicated nginx config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
#=================================================
# ADD A CONFIGURATION
@ -65,18 +69,6 @@ ynh_add_config --template="../conf/addon.config.php" --destination="$install_dir
mkdir -p "$install_dir/view/smarty3"
chmod -R 775 "$install_dir/view/smarty3"
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setting up the cron job..." --weight=1
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
#=================================================
# INSTALL FRIENDICA
#=================================================

View file

@ -32,10 +32,12 @@ ynh_remove_nginx_config
ynh_remove_fpm_config
# Remove the app-specific logrotate config
#ynh_remove_logrotate
ynh_remove_logrotate
ynh_remove_fail2ban_config
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -17,7 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod -R 775 "$install_dir/view/smarty3"
@ -28,10 +27,12 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_mysql_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 PHP-FPM configuration..." --weight=1
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"
@ -42,6 +43,8 @@ systemctl enable $app.service --quiet
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
ynh_systemd_action --action=restart --service_name=fail2ban

View file

@ -68,9 +68,9 @@ chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# NGINX CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
@ -78,13 +78,15 @@ ynh_add_nginx_config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
ynh_add_systemd_config
yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/$app.log"
ynh_use_logrotate --non-append
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="^.*authenticate\: failed login attempt.*\"ip\"\:\"<HOST>\".*$"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
@ -92,7 +94,7 @@ yunohost service add $app --description="Friendica daemon" --log="/var/log/$app/
# Run Composer
pushd "$install_dir"
ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet
ynh_exec_as "$app" bin/console dbstructure update
ynh_exec_as "$app" php$phpversion bin/console dbstructure update
#ynh_exec_as "$app" bin/console config system addon ldapauth
popd