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

Fix several merging

This commit is contained in:
yalh76 2021-03-31 20:57:14 +02:00
parent 667deb5d4c
commit 1c694b7288
7 changed files with 34 additions and 61 deletions

View file

@ -37,19 +37,6 @@ The admin uses the login you provided at installation. The password is the same
The admin interface is accessible at the address: `your.domain.fr/api/admin`
# State of this package
* The following have been tested with this package and work fine:
* [x] install/remove/backup/remove/upgrade with x86_64 and ARM
* [x] import file with web interface, imports from YouTube, interraction with MusicBrainz
* [x] [Subsonic API](https://docs.funkwhale.audio/users/apps.html)
* [x] [Federation](https://docs.funkwhale.audio/federation.html) tests
* [x] [CLI Import](https://docs.funkwhale.audio/importing-music.html#from-music-directory-on-the-server) Remember to `source $final_path/venv/bin/activate`, then `source $final_path/load_env` before typinh using manage.py.
* to be added:
* [ ] Store files in HOME, see https://github.com/YunoHost-Apps/funkwhale_ynh/issues/15
## Documentation
* Official documentation: https://docs.funkwhale.audio

View file

@ -31,19 +31,6 @@ L'administrateur utilise le login que vous avez fourni lors de l'installation. L
L'interface d'administration est accessible à l'adresse : votre.domaine.fr/api/admin
# État de ce paquet
* Les éléments suivants ont été testés avec ce paquet et fonctionnent :
* [x] installer/supprimer/sauvegarder/supprimer/mettre à jour avec x86_64
* [x] importation des fichiers avec linterface web, importations depuis youtube, interraction avec MusicBrainz
* [x] [API Subsonic](https://docs.funkwhale.audio/users/apps.html)
* [x] Tests de [Fédération](https://docs.funkwhale.audio/federation.html)
* [x] [Import CLI](https://docs.funkwhale.audio/importing-music.html#from-music-directory-on-the-server) N'oubliez pas de `source $final_path/venv/bin/activate`, puis `source $final_path/load_env` avant de taper en utilisant manage.py.
* à ajouter :
* [ ] Stocker les fichiers dans HOME, voir https://github.com/YunoHost-Apps/funkwhale_ynh/issues/15
## Documentation
* Documentation officielle : https://docs.funkwhale.audio

View file

@ -43,7 +43,7 @@ ynh_print_info --message="Declaring files to be backed up..."
backup_core_only=$(ynh_app_setting_get --app="$app" --key=backup_core_only)
# If backup_core_only have any value in the settings.yml file, do not backup the data directory
if [ "$backup_core_only" ]
if [ ! "$backup_core_only" ]
then
ynh_backup --src_path="$datadir"
fi
@ -55,7 +55,6 @@ ynh_backup --src_path="$final_path"
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.conf"
#=================================================
# BACKUP FAIL2BAN CONFIGURATION

View file

@ -25,8 +25,8 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin_mail=$(ynh_user_get_info --username="$admin" --key="mail")
@ -114,7 +114,7 @@ popd
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_nginx_config "datadir"
#=================================================
# CREATE DEDICATED USER
@ -148,8 +148,8 @@ ynh_script_progression --message="Modifying a config file..."
key=$(ynh_string_random --length=45 | base64)
redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --key=key --value="$key"
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
ynh_app_setting_set --app=$app --key=key --value=$key
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
ynh_add_config --template="../conf/env.prod" --destination="$final_path/config/.env"
@ -190,11 +190,13 @@ ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.servic
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R "$app": $final_path
chown -R $app: $final_path
chmod -R 755 "$final_path/front/dist/"
chown -R $app: $datadir
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
chown -R $app: "/var/log/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -220,7 +222,7 @@ ynh_systemd_action --service_name="${app}-worker" --action="start" --log_path="s
#=================================================
ynh_script_progression --message="Configuring Fail2Ban..."
# Create a dedicated fail2ban config
# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/var/log/nginx/$domain-access.log" --failregex="<HOST>.* \"POST /api/v1/token/ HTTP/1.1\" 400 68.*$" --max_retry=5
#=================================================

View file

@ -30,21 +30,21 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if yunohost service status "$app-server" >/dev/null
if ynh_exec_warn_less yunohost service status "$app-server" >/dev/null
then
ynh_script_progression --message="Remove $app-server service integration..."
ynh_script_progression --message="Removing $app-server service integration..."
yunohost service remove "$app-server"
fi
if yunohost service status "$app-worker" >/dev/null
if ynh_exec_warn_less yunohost service status "$app-worker" >/dev/null
then
ynh_script_progression --message="Remove $app-worker service integration..."
ynh_script_progression --message="Removing $app-worker service integration..."
yunohost service remove "$app-worker"
fi
if yunohost service status "$app-beat" >/dev/null
if ynh_exec_warn_less yunohost service status "$app-beat" >/dev/null
then
ynh_script_progression --message="Remove $app-beat service integration..."
ynh_script_progression --message="Removing $app-beat service integration..."
yunohost service remove "$app-beat"
fi

View file

@ -62,7 +62,7 @@ ynh_script_progression --message="Restoring the app main directory..."
backup_core_only=$(ynh_app_setting_get --app=$app --key=backup_core_only)
# If backup_core_only have any value, then restore only code
if [ "$backup_core_only" ]
if [ ! "$backup_core_only" ]
then
ynh_restore_file --origin_path="$datadir"
fi
@ -70,8 +70,9 @@ fi
ynh_restore_file --origin_path="$final_path"
# Remove the option backup_core_only if it's in the settings.yml file
ynh_app_setting_delete --app="$app" --key=backup_core_only
ynh_app_setting_delete --app=$app --key=backup_core_only
mkdir -p $datadir
pushd $datadir
mkdir -p static media music
popd
@ -91,10 +92,12 @@ ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
chmod -R 755 "$final_path/code/front/dist/"
chmod -R 755 "$final_path/front/dist/"
chown -R $app: $datadir
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
chown -R $app: "/var/log/$app"
#=================================================
# SPECIFIC RESTORATION

View file

@ -21,8 +21,8 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
port=$(ynh_app_setting_get --app=$app --key=port)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
port=$(ynh_app_setting_get --app=$app --key=port)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
key=$(ynh_app_setting_get --app=$app --key=key)
@ -33,8 +33,8 @@ ynh_script_progression --message="Ensuring downward compatibility..."
# If redis_db doesn't exist, create it
if [ -z "$redis_db" ]; then
redis_db=0
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
fi
# If db_pwd doesn't exist, create it
@ -50,20 +50,13 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Inform the backup/restore process that it should not save the data directory
ynh_app_setting_set --app="$app" --key=backup_core_only --value=1
ynh_app_setting_set --app=$app --key=backup_core_only --value=1
# Backup the current version of the app
ynh_backup_before_upgrade
@ -130,7 +123,7 @@ fi
ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_nginx_config "datadir"
#=================================================
# UPGRADE DEPENDENCIES
@ -203,7 +196,7 @@ pushd $final_path
# https://docs.funkwhale.audio/changelog.html#increased-quality-of-jpeg-thumbnails-manual-action-required
ynh_secure_remove --file="$final_path/media/__sized__"
python api/manage.py fw media generate-thumbnails
)
popd
#=================================================
# SETUP SYSTEMD
@ -225,11 +218,13 @@ ynh_add_systemd_config --service="$app-beat" --template="funkwhale-beat.servic
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R "$app": "$final_path"
chmod -R 755 "$final_path/code/front/dist/"
chown -R $app: "$final_path"
chmod -R 755 "$final_path/front/dist/"
chown -R $app: $datadir
mkdir -p "/var/log/$app"
chown -R "$app": "/var/log/$app"
chown -R $app: "/var/log/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST