1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/streams_ynh.git synced 2024-09-03 20:26:20 +02:00

Trying to fix 403 error

This commit is contained in:
dragondaddy 2024-09-02 23:58:29 +02:00
parent c0a801acf4
commit 9e2c66fa56
2 changed files with 9 additions and 52 deletions

View file

@ -105,7 +105,8 @@ ynh_config_add --template="cronjobs" --destination="/etc/cron.d/$app"
ynh_script_progression "Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_config_add_logrotate "$install_dir/php.log"
ynh_config_add_logrotate "/var/log/$app/php.log"
ynh_exec_as_app touch "/var/log/$app/php.log"
#=================================================
# SETUP FAIL2BAN
@ -114,11 +115,9 @@ ynh_script_progression "Configuring Fail2Ban..."
# Create a dedicated Fail2Ban config
ynh_config_add_fail2ban --logpath="/var/log/$app/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$"
ynh_exec_as_app touch "/var/log/$app/php.log"
#=================================================
# END OF SCRIPT
#=================================================
ls -ld /var/www/$app
namei -l /var/www/streams/index.php
ynh_script_progression "Installation of $app completed"

View file

@ -15,21 +15,6 @@ email=$(ynh_user_get_info --username=$admin --key=mail)
#=================================================
ynh_script_progression "Ensuring downward compatibility..."
# Make sure that git_branch_mode exists with relevant value
git_branch_mode_status="$(cd "$install_dir" && ynh_exec_as_app git branch --show-current)" 2> /dev/null
if echo $git_branch_mode_status | grep -q "release"
then
git_branch_mode="0"
ynh_app_setting_set --key=git_branch_mode --value="$git_branch_mode"
elif echo $git_branch_mode_status | grep -q "dev"
then
git_branch_mode="1"
ynh_app_setting_set --key=git_branch_mode --value="$git_branch_mode"
else
ynh_print_warn "You need to use \"release\" or \"dev\" branch, please handle this in command line"
exit 0
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -42,30 +27,18 @@ then
# First we save what we need to keep
mv $install_dir/store $data_dir/
mv $install_dir/cache $data_dir/
mv $install_dir/php.log $data_dir/
# Then we remove the previous install
ynh_safe_rm $install_dir
# We make the install cloning the repo
mkdir -p "$install_dir"
chown -R $app:www-data "$install_dir"
ynh_exec_as_app git clone https://codeberg.org/streams/streams.git "$install_dir" --quiet
git config --system --add safe.directory $install_dir
ynh_app_setting_get --key=git_branch_mode
if [[ -n $git_branch_mode ]] && [ "$git_branch_mode" -eq "1" ]
then
ynh_print_info "Switching to \"dev\" branch"
(cd "$install_dir" && ynh_exec_as_app git checkout dev)
fi
ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons"
# We restore what we previously saved
mv $data_dir/store $install_dir/
mv $data_dir/cache $install_dir/
mv $data_dir/php.log $install_dir/
chmod -R 775 $install_dir/store $install_dir/cache
ynh_exec_as_app chmod -R 775 $install_dir/store $install_dir/cache
fi
#=================================================
@ -87,18 +60,6 @@ ynh_script_progression "Pulling in external libraries with Composer..."
ynh_composer_install
ynh_composer_exec install --no-dev
#=================================================
# ADDONS
#=================================================
ynh_script_progression "Installing addons..."
pushd $install_dir
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
cd /var/www/$app/extend/addon/zaddons
ynh_exec_as_app git config pull.rebase false
popd
#=================================================
# UPDATE A CONFIG FILE
#=================================================
@ -122,20 +83,17 @@ ynh_script_progression "Setuping cron job..."
# Set up cron job
ynh_config_add --template="cronjobs" --destination="/etc/cron.d/$app"
# Add daily update script
ynh_config_add --template="daily-update.sh" --destination="/home/yunohost.app/$app/daily-update.sh"
chown root: "/home/yunohost.app/$app/daily-update.sh"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression "Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_config_add_logrotate "$install_dir/php.log"
ynh_config_add_logrotate "/var/log/$app/php.log"
ynh_exec_as_app touch "/var/log/$app/php.log"
# Create a dedicated Fail2Ban config
ynh_config_add_fail2ban --logpath="$install_dir/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$"
ynh_config_add_fail2ban --logpath="/var/log/$app/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP <HOST>.*$"
#=================================================
# END OF SCRIPT