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

Merge pull request #161 from YunoHost-Apps/upgrade

Full Upgrade
This commit is contained in:
yalh76 2022-01-10 21:02:29 +01:00 committed by GitHub
commit e2d88b7e8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 80 additions and 75 deletions

View file

@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Funkwhale is a community-driven project that lets you listen and share music and audio within a decentralized, open network.
**Shipped version:** 1.1.4~ynh2
**Shipped version:** 1.2.1~ynh1
**Demo:** https://demo.funkwhale.audio
@ -46,7 +46,7 @@ The files can then be added to your library from the *uploading* tab in a music
* Official app website: https://funkwhale.audio/
* Official user documentation: https://docs.funkwhale.audio/users/index.html
* Official admin documentation: https://docs.funkwhale.audio/admin/index.html
* Upstream app code repository: https://dev.funkwhale.audio/funkwhale
* Upstream app code repository: https://dev.funkwhale.audio/funkwhale/funkwhale
* YunoHost documentation for this app: https://yunohost.org/app_funkwhale
* Report a bug: https://github.com/YunoHost-Apps/funkwhale_ynh/issues

View file

@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Funkwhale est un projet communautaire qui vous permet d'écouter et de partager de la musique et de l'audio au sein d'un réseau ouvert et décentralisé.
**Version incluse :** 1.1.4~ynh2
**Version incluse :** 1.2.1~ynh1
**Démo :** https://demo.funkwhale.audio
@ -39,7 +39,7 @@ Les fichiers peuvent ensuite être ajoutés à votre bibliothèque à partir de
* Site officiel de l'app : https://funkwhale.audio/
* Documentation officielle utilisateur : https://docs.funkwhale.audio/users/index.html
* Documentation officielle de l'admin : https://docs.funkwhale.audio/admin/index.html
* Dépôt de code officiel de l'app : https://dev.funkwhale.audio/funkwhale
* Dépôt de code officiel de l'app : https://dev.funkwhale.audio/funkwhale/funkwhale
* Documentation YunoHost pour cette app : https://yunohost.org/app_funkwhale
* Signaler un bug : https://github.com/YunoHost-Apps/funkwhale_ynh/issues

View file

@ -19,6 +19,8 @@
upgrade=1 from_commit=fa9587f61e4bb4f9db8667b1c6701ede37ac8e91
# 1.1.2~ynh1
upgrade=1 from_commit=74255c1c278562eb174fb13ce538d4754f01186c
# 1.1.4~ynh2
upgrade=1 from_commit=313335d5aa851a497fa92cd7ac264f989e1052d9
backup_restore=1
multi_instance=1
port_already_use=0
@ -36,3 +38,5 @@ Notification=all
name=1.1.1~ynh1
; commit=74255c1c278562eb174fb13ce538d4754f01186c
name=1.1.2~ynh1
; commit=313335d5aa851a497fa92cd7ac264f989e1052d9
name=1.1.4~ynh2

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/1.1.4/download?job=build_api
SOURCE_SUM=c3ea7013ffcbeb4e2832cc596cdccb2e2034b4250a25130aa4dc0d648fe03463
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/1.2.1/download?job=build_api
SOURCE_SUM=d370dd548102be5477a8d6632ea58e6de42d18bce58078e007c471cb8bb4753f
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -5,7 +5,7 @@
# following variables:
# - DJANGO_SECRET_KEY
# - FUNKWHALE_HOSTNAME
# - EMAIL_CONFIG and DEFAULT_FROM_EMAIL if you plan to send emails)
# - EMAIL_CONFIG and DEFAULT_FROM_EMAIL if you plan to send e-mails)
# On non-docker setup **only**, you'll also have to tweak/uncomment those variables:
# - DATABASE_URL
# - CACHE_URL
@ -43,21 +43,30 @@ FUNKWHALE_WEB_WORKERS=6
FUNKWHALE_HOSTNAME=__DOMAIN__
FUNKWHALE_PROTOCOL=https
# Configure email sending using this variale
# By default, funkwhale will output emails sent to stdout
# Log level (debug, info, warning, error, critical)
LOGLEVEL=error
# Configure e-mail sending using this variale
# By default, funkwhale will output e-mails sent to stdout
# here are a few examples for this setting
# EMAIL_CONFIG=consolemail:// # output emails to console (the default)
# EMAIL_CONFIG=dummymail:// # disable email sending completely
# EMAIL_CONFIG=consolemail:// # output e-mails to console (the default)
# EMAIL_CONFIG=dummymail:// # disable e-mail sending completely
# On a production instance, you'll usually want to use an external SMTP server:
# If `user` or `password` contain special characters (eg.
# `noreply@youremail.host` as `user`), be sure to urlencode them, using
# for example the command:
# `python3 -c 'import urllib.parse; print(urllib.parse.quote_plus
# ("noreply@youremail.host"))'`
# (returns `noreply%40youremail.host`)
# EMAIL_CONFIG=smtp://user@:password@youremail.host:25
# EMAIL_CONFIG=smtp+ssl://user@:password@youremail.host:465
# EMAIL_CONFIG=smtp+tls://user@:password@youremail.host:587
# Make email verification mandatory before using the service
# Make e-mail verification mandatory before using the service
# Doesn't apply to admins.
# ACCOUNT_EMAIL_VERIFICATION_ENFORCE=false
# The email address to use to send system emails.
# The e-mail address to use to send system e-mails.
# DEFAULT_FROM_EMAIL=noreply@yourdomain
# Depending on the reverse proxy used in front of your funkwhale instance,
@ -119,13 +128,6 @@ DJANGO_SECRET_KEY=__KEY__
# want to
# DJANGO_ADMIN_URL=^api/admin/
# Sentry/Raven error reporting (server side)
# Enable Raven if you want to help improve funkwhale by
# automatically sending error reports our Sentry instance.
# This will help us detect and correct bugs
RAVEN_ENABLED=false
RAVEN_DSN=https://44332e9fdd3d42879c7d35bf8562c6a4:0062dc16a22b41679cd5765e5342f716@sentry.eliotberriot.com/5
# In-place import settings
# You can safely leave those settings uncommented if you don't plan to use
# in place imports.
@ -178,7 +180,7 @@ NGINX_MAX_BODY_SIZE=100M
# AWS_S3_ENDPOINT_URL=
# If you want to serve media directly from your S3 bucket rather than through a proxy,
# set this to true
# set this to false
# PROXY_MEDIA=false
# If you are using Amazon S3 to serve media directly, you will need to specify your region

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/builds/artifacts/1.1.4/download?job=build_front
SOURCE_SUM=83e11273159dd617d16483168300768583b14ffb93cbceec5c4dccdfe2d3fb44
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/builds/artifacts/1.2.1/download?job=build_front
SOURCE_SUM=3725d2aa8563dd8989042a1ee4a57cac2d396b5ad20820815775ae724aa8ff0c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -2,11 +2,6 @@ root __FINALPATH__/front/dist;
location / {
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
# global proxy conf
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@ -110,12 +105,12 @@ location /media/ {
alias __DATADIR__/media/;
}
location /_protected/media {
location /_protected/media/ {
# this is an internal location that is used to serve
# audio files once correct permission / authentication
# has been checked on API side
internal;
alias __DATADIR__/media;
alias __DATADIR__/media/;
}
# Comment the previous location and uncomment this one if you're storing
@ -127,13 +122,13 @@ location /_protected/media {
# proxy_pass $1;
# }
location /_protected/music {
location /_protected/music/ {
# this is an internal location that is used to serve
# audio files once correct permission / authentication
# has been checked on API side
# Set this to the same value as your MUSIC_DIRECTORY_PATH setting
internal;
alias __DATADIR__/music;
alias __DATADIR__/music/;
}
location /staticfiles/ {

View file

@ -6,7 +6,7 @@
"en": "Modern, convivial and free music server",
"fr": "Serveur de musique moderne, convivial et gratuit"
},
"version": "1.1.4~ynh2",
"version": "1.2.1~ynh1",
"url": "https://funkwhale.audio",
"upstream": {
"license": "AGPL-3.0-or-later",
@ -14,7 +14,7 @@
"demo": "https://demo.funkwhale.audio",
"admindoc": "https://docs.funkwhale.audio/admin/index.html",
"userdoc": "https://docs.funkwhale.audio/users/index.html",
"code": "https://dev.funkwhale.audio/funkwhale"
"code": "https://dev.funkwhale.audio/funkwhale/funkwhale"
},
"license": "AGPL-3.0-or-later",
"maintainer": {
@ -26,7 +26,7 @@
"email": "jean-baptiste@holcroft.fr"
}],
"requirements": {
"yunohost": ">= 4.2.0"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
ynh_script_progression --message="Loading installation settings..."
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
@ -34,7 +34,7 @@ redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
key=$(ynh_app_setting_get --app=$app --key=key)
@ -42,7 +42,7 @@ key=$(ynh_app_setting_get --app=$app --key=key)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -77,7 +77,7 @@ fi
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name="$app-beat" --action=stop --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-server" --action=stop --log_path="/var/log/$app/$app.log"
@ -86,7 +86,7 @@ ynh_systemd_action --service_name="$app-worker" --action=stop --log_path="/var/l
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -147,7 +147,7 @@ ynh_add_fail2ban_config --logpath="/var/log/nginx/$new_domain-access.log" --fail
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -155,4 +155,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression --message="Change of URL completed for $app"

View file

@ -40,7 +40,7 @@ ynh_script_progression --message="Validating installation parameters..."
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
datadir="/home/yunohost.app/${app}/data"
datadir=/home/yunohost.app/$app/data
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -105,9 +105,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path/api" --source_id="api"
ynh_setup_source --dest_dir="$final_path/front" --source_id="front"
pushd $final_path
mkdir -p config
popd
mkdir -p $final_path/config
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
@ -131,10 +129,7 @@ ynh_script_progression --message="Creating a data directory..."
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $datadir
pushd $datadir
mkdir -p static media music
popd
mkdir -p $datadir/{static,media,music}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
@ -178,8 +173,8 @@ pushd $final_path
source $final_path/virtualenv/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel
pip install -r api/requirements.txt
ynh_exec_warn_less pip install wheel
ynh_exec_warn_less pip install -r api/requirements.txt
popd
#=================================================
@ -192,10 +187,10 @@ pushd $final_path
# needed for enabling the 'unaccent' extension
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
python api/manage.py migrate
ynh_exec_warn_less python api/manage.py migrate
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | python api/manage.py shell
echo "yes" | python api/manage.py collectstatic
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('$admin', '$admin_mail', 'funkwhale') " | ynh_exec_warn_less python api/manage.py shell
echo "yes" | ynh_exec_warn_less python api/manage.py collectstatic
popd
chmod 750 "$final_path"

View file

@ -21,6 +21,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
@ -72,14 +73,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -88,6 +81,17 @@ ynh_script_progression --message="Removing app main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
@ -96,6 +100,14 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================

View file

@ -39,7 +39,8 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -78,9 +79,7 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
pushd $datadir
mkdir -p static media music
popd
mkdir -p $datadir/{static,media,music}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"

View file

@ -97,9 +97,7 @@ if [ -z "$datadir" ]; then
ynh_script_progression --message="Moving datas to $datadir..."
mkdir -p $datadir
pushd $datadir
mkdir -p static media music
popd
mkdir -p $datadir/{static,media,music}
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
@ -198,8 +196,8 @@ pushd $final_path
source $final_path/virtualenv/bin/activate
pip install --upgrade pip
pip install --upgrade setuptools
pip install wheel
pip install -r api/requirements.txt
ynh_exec_warn_less pip install wheel
ynh_exec_warn_less pip install -r api/requirements.txt
popd
#=================================================
@ -222,10 +220,10 @@ pushd $final_path
# needed for enabling the 'unaccent' extension
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH SUPERUSER;" --database="$db_name"
python api/manage.py migrate
ynh_exec_warn_less python api/manage.py migrate
ynh_psql_execute_as_root --sql="ALTER USER $db_user WITH NOSUPERUSER;" --database="$db_name"
echo "yes" | python api/manage.py collectstatic --clear --noinput
echo "yes" | ynh_exec_warn_less python api/manage.py collectstatic --clear --noinput
# https://code.eliotberriot.com/funkwhale/funkwhale/tags/0.16 # users-now-have-an-activitypub-actor-manual-action-required
# python api/manage.py script create_actors --no-input
@ -243,7 +241,7 @@ pushd $final_path
# higher quality images
# 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
ynh_exec_warn_less python api/manage.py fw media generate-thumbnails
popd
chmod 750 "$final_path"