1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/funkwhale_ynh.git synced 2024-09-03 18:36:24 +02:00
This commit is contained in:
Éric Gaspar 2024-09-01 18:21:39 +02:00
parent 030dad2ec1
commit 089513effc
6 changed files with 5 additions and 48 deletions

View file

@ -21,7 +21,7 @@ code = "https://dev.funkwhale.audio/funkwhale/funkwhale"
fund = "https://next.funkwhale.audio/donate/" fund = "https://next.funkwhale.audio/donate/"
[integration] [integration]
yunohost = ">= 11.2.18" yunohost = ">= 11.2.29"
helpers_version = "2.1" helpers_version = "2.1"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true

View file

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers

View file

@ -14,7 +14,6 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key="mail")
#================================================= #=================================================
ynh_script_progression "Setting up source files..." ynh_script_progression "Setting up source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/api" --source_id="api" ynh_setup_source --dest_dir="$install_dir/api" --source_id="api"
ynh_setup_source --dest_dir="$install_dir/front" --source_id="front" ynh_setup_source --dest_dir="$install_dir/front" --source_id="front"
@ -56,9 +55,6 @@ ynh_app_setting_set --key=redis_db --value=$redis_db
ynh_config_add --template="env.prod" --destination="$install_dir/config/.env" ynh_config_add --template="env.prod" --destination="$install_dir/config/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/config/.env"
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/config/.env"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -113,9 +109,6 @@ pushd $install_dir
echo "yes" | ynh_hide_warnings ynh_exec_as_app $install_dir/venv/bin/funkwhale-manage collectstatic echo "yes" | ynh_hide_warnings ynh_exec_as_app $install_dir/venv/bin/funkwhale-manage collectstatic
popd popd
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# LOGROTATE # LOGROTATE
#================================================= #=================================================
@ -127,7 +120,6 @@ ynh_config_add_logrotate
touch /var/log/$app/${app}-server.log touch /var/log/$app/${app}-server.log
touch /var/log/$app/${app}-worker.log touch /var/log/$app/${app}-worker.log
touch /var/log/$app/${app}-beat.log touch /var/log/$app/${app}-beat.log
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app /var/log/$app/
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -153,7 +145,6 @@ ynh_systemctl --service="${app}-worker" --action="start" --log_path="systemd" --
#================================================= #=================================================
ynh_script_progression "Configuring Fail2Ban..." ynh_script_progression "Configuring Fail2Ban..."
# Create a dedicated Fail2Ban config
ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-access.log" --failregex="<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-access.log" --failregex="<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$"
#================================================= #=================================================

View file

@ -53,29 +53,10 @@ ynh_script_progression "Removing NGINX web server configuration..."
ynh_safe_rm "/etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf" ynh_safe_rm "/etc/nginx/conf.d/$domain.d/funkwhale_proxy.conf"
ynh_config_remove_nginx ynh_config_remove_nginx
#=================================================
# REMOVE LOGS
#=================================================
ynh_script_progression "Removing logs..."
ynh_config_remove_logrotate ynh_config_remove_logrotate
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression "Removing Fail2Ban configuration..."
# Remove the dedicated Fail2Ban config
ynh_config_remove_fail2ban ynh_config_remove_fail2ban
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE REDIS DATABASE
#=================================================
ynh_script_progression "Removing the Redis database..."
# Remove a database if it exists, along with the associated user
ynh_redis_remove_db $redis_db ynh_redis_remove_db $redis_db
#================================================= #=================================================

View file

@ -11,8 +11,6 @@ ynh_script_progression "Restoring the app main directory..."
ynh_restore "$install_dir" ynh_restore "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
@ -23,7 +21,6 @@ ynh_restore "$data_dir/" || true
mkdir -p $data_dir/data mkdir -p $data_dir/data
mkdir -p $data_dir/data/{static,media,music} mkdir -p $data_dir/data/{static,media,music}
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$data_dir/"
chmod -R o-rwx "$data_dir/" chmod -R o-rwx "$data_dir/"
chown -R $app:www-data "$data_dir/" chown -R $app:www-data "$data_dir/"
@ -39,7 +36,7 @@ ynh_restore "/etc/nginx/conf.d/$domain.d"
#================================================= #=================================================
ynh_script_progression "Restoring the PostgreSQL database..." ynh_script_progression "Restoring the PostgreSQL database..."
ynh_psql_db_shell < "./db.sql"" ynh_psql_db_shell < "./db.sql"
#================================================= #=================================================
# LOGROTATE # LOGROTATE
@ -52,7 +49,6 @@ ynh_config_add_logrotate
touch /var/log/$app/${app}-server.log touch /var/log/$app/${app}-server.log
touch /var/log/$app/${app}-worker.log touch /var/log/$app/${app}-worker.log
touch /var/log/$app/${app}-beat.log touch /var/log/$app/${app}-beat.log
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app /var/log/$app/
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD

View file

@ -15,16 +15,10 @@ ynh_systemctl --action="stop" --service="${app}-worker" --log_path="systemd"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression "Upgrading source files..."
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed ynh_setup_source --dest_dir="$install_dir/api" --source_id="api" --full_replace
if ynh_app_upstream_version_changed ynh_setup_source --dest_dir="$install_dir/front" --source_id="front" --full_replace
then
ynh_script_progression "Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/api" --source_id="api" --full_replace
ynh_setup_source --dest_dir="$install_dir/front" --source_id="front" --full_replace
fi
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
@ -99,9 +93,6 @@ pushd $install_dir
popd popd
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
#================================================= #=================================================
# LOGROTATE # LOGROTATE
#================================================= #=================================================
@ -113,7 +104,6 @@ ynh_config_add_logrotate
touch /var/log/$app/${app}-server.log touch /var/log/$app/${app}-server.log
touch /var/log/$app/${app}-worker.log touch /var/log/$app/${app}-worker.log
touch /var/log/$app/${app}-beat.log touch /var/log/$app/${app}-beat.log
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app /var/log/$app/
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD