1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/scripts/install

83 lines
2.9 KiB
Text
Raw Permalink Normal View History

2014-07-23 15:52:50 +02:00
#!/bin/bash
2018-07-21 12:18:50 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2016-09-01 08:31:03 +02:00
2018-07-21 12:18:50 +02:00
source _common.sh
source /usr/share/yunohost/helpers
2019-02-21 08:05:10 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2022-10-02 23:03:44 +02:00
ynh_script_progression --message="Setting up source files..." --weight=1
2019-02-21 08:05:10 +01:00
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
2019-02-21 08:05:10 +01:00
chmod -R o-rwx "$install_dir"
chown -R "$app":www-data "$install_dir"
2021-04-17 18:39:02 +02:00
2019-02-21 08:05:10 +01:00
#=================================================
# SYSTEM CONFIGURATION
2019-02-21 08:05:10 +01:00
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
2019-02-21 08:05:10 +01:00
2020-09-04 22:24:17 +02:00
# Create a dedicated PHP-FPM config
2023-09-29 18:53:41 +02:00
ynh_add_fpm_config
2022-10-02 23:03:44 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_config --template="freshrss.cron" --destination="/etc/cron.d/$app"
2021-08-28 10:54:58 +02:00
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
2019-02-21 08:05:10 +01:00
log_path="/var/log/$app"
mkdir -p "$log_path"
chown "$app":www-data "$log_path"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
2022-10-03 00:00:06 +02:00
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SETUP FAIL2BAN
#=================================================
ynh_script_progression --message="Upgrading fail2ban configuration..."
# Create the logfile, required before configuring fail2ban
touch "/var/log/${domain}-access.log"
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-access.log" --failregex="<HOST> .* \"GET /api/.*\" 401" --max_retry=5
2022-10-03 00:00:06 +02:00
#=================================================
# SPECIFIC SETUP
2019-02-21 08:05:10 +01:00
#=================================================
# SETUPING FRESHRSS
2019-02-21 08:05:10 +01:00
#=================================================
ynh_script_progression --message="$app setup..." --weight=1
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/cli/do-install.php" --default_user "$admin" --auth_type http_auth --environment production --base_url "https://$domain$path" --title FreshRSS --api_enabled --db-type mysql --db-host localhost --db-user "$db_name" --db-password "$db_pwd" --db-base "$db_name"
2019-02-21 08:05:10 +01:00
for myuser in $(ynh_user_list)
do
user_token=$(ynh_string_random)
ynh_exec_as "$app" "$install_dir/cli/create-user.php" --user "$myuser" --language "$language" --token "$user_token"
done
2019-02-21 08:05:10 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2020-09-04 22:24:17 +02:00
ynh_script_progression --message="Installation of $app completed" --last