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 #86 from YunoHost-Apps/testing

upgrade to 0.21
This commit is contained in:
Jean-Baptiste 2019-11-03 08:40:20 +01:00 committed by GitHub
commit 10c5c1b485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 63 additions and 115 deletions

View file

@ -11,7 +11,7 @@ A modern, convivial and free music server on YunoHost
Installation requires a dedicated domain for now. I hope subpath installation will be possible in the future. Installation requires a dedicated domain for now. I hope subpath installation will be possible in the future.
**Shipped version:** 0.19.1 (this is an Alpha version!) **Shipped version:** 0.20.1 (this is an Alpha version!)
## Screenshots ## Screenshots

View file

@ -16,23 +16,14 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
incorrect_path=0 incorrect_path=0
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels ;;; Levels
Level 1=auto
Level 2=auto
Level 3=auto
# Level 4: https://github.com/YunoHost-Apps/funkwhale_ynh/issues/21
Level 4=1
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0
;;; Options ;;; Options
Email=jean-baptiste@holcroft.fr Email=jean-baptiste@holcroft.fr
Notification=all Notification=all
@ -45,4 +36,7 @@ manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
; commit=99bae16efca321ce50ba9a98c62996169195e0ba ; commit=99bae16efca321ce50ba9a98c62996169195e0ba
name=Upgrade from 0.18.3 name=Upgrade from 0.18.3
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1
; commit=4d4bf0981e2d3a00eaae6b19bd54344fe55d6530
name=Upgrade from 0.19.1
manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1 manifest_arg=domain=DOMAIN&path=/&admin=USER&is_public=1

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.19.1/download?job=build_front SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/jobs/artifacts/0.20.1/download?job=build_front
SOURCE_SUM=5ee39dd1cca26b244c53b24539e01906d3d0b04c9df5290e0070290a38fd1c83 SOURCE_SUM=22d774590b943fa6d64f634a7175b1d100089fe33734ce9889d050063ff50ce7
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=false SOURCE_IN_SUBDIR=false

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/0.19.1/funkwhale-0.19.1.tar.gz SOURCE_URL=https://dev.funkwhale.audio/funkwhale/funkwhale/-/archive/0.20.1/funkwhale-0.20.1.tar.gz
SOURCE_SUM=a5f2b8b51f4259b0964f7adeceeaadab6b39de3417b019b4ec505d5154adff82 SOURCE_SUM=4fe4c9069957060b3ab31cbc39f01d621aed01c39fc0177628fd96777fdffc7e
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.bz2 SOURCE_FORMAT=tar.bz2
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -9,8 +9,10 @@ Group=__APP__
WorkingDirectory=__FINALPATH__/code/api WorkingDirectory=__FINALPATH__/code/api
EnvironmentFile=__FINALPATH__/code/config/.env EnvironmentFile=__FINALPATH__/code/config/.env
ExecStart=__FINALPATH__/code/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers \ ExecStart=__FINALPATH__/code/virtualenv/bin/gunicorn config.asgi:application \
--verbosity 1 --access-log=/var/log/__APP__/server.log -w ${FUNKWHALE_WEB_WORKERS} \
-k uvicorn.workers.UvicornWorker \
-b ${FUNKWHALE_API_IP}:${FUNKWHALE_API_PORT}
#NoNewPrivileges=true #NoNewPrivileges=true
#PrivateDevices=true #PrivateDevices=true

View file

@ -11,6 +11,14 @@ location /front/ {
expires 30d; expires 30d;
more_set_headers Pragma public; more_set_headers Pragma public;
more_set_headers Cache-Control "public, must-revalidate, proxy-revalidate"; more_set_headers Cache-Control "public, must-revalidate, proxy-revalidate";
more_set_headers Content-Security-Policy "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; object-src 'none'; media-src 'self' data:";
more_set_headers Referrer-Policy "strict-origin-when-cross-origin";
more_set_headers X-Frame-Options "SAMEORIGIN";
}
location /front/embed.html {
more_set_headers X-Frame-Options "ALLOW";
alias __FINALPATH__/front/dist/embed.html;
} }
location /federation/ { location /federation/ {

View file

@ -5,7 +5,7 @@
"description": { "description": {
"en": "A modern, convivial and free music server" "en": "A modern, convivial and free music server"
}, },
"version": "0.19.1~ynh2", "version": "0.20.1~ynh4",
"url": "https://funkwhale.audio", "url": "https://funkwhale.audio",
"license": "AGPL-3.0-or-later", "license": "AGPL-3.0-or-later",
"maintainer": { "maintainer": {
@ -13,7 +13,7 @@
"email": "jean-baptiste@holcroft.fr" "email": "jean-baptiste@holcroft.fr"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.5" "yunohost": ">= 3.6"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -15,40 +15,6 @@ pkg_dependencies="build-essential curl ffmpeg \
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================
# funkwhale needs edits to the domain config file
# this function removes funkwhale specifics
funkwhale_nginx_domain_cleaning() {
local line
local tempFile
local nginxConf
nginxConf="/etc/nginx/conf.d/$domain.conf"
tempFile="$nginxConf.temp"
line=$(sed -n '/server /=' "$nginxConf" | head -n 1)
tail -n +"$line" "$nginxConf" > "$tempFile"
mv "$tempFile" "$nginxConf"
}
# funkwhale needs edits to the domain config file
# this function adds funkwhale specifics
funkwhale_nginx_domain_configure() {
local tempFile
local nginxConf
nginxConf="/etc/nginx/conf.d/$domain.conf"
tempFile="$nginxConf.temp"
echo "
# required for websocket support
map \$http_upgrade \$connection_upgrade {
default upgrade;
'' close;
}
" | cat - "$nginxConf" > "$tempFile"
mv "$tempFile" "$nginxConf"
}
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS

View file

@ -106,9 +106,6 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend"
#================================================= #=================================================
ynh_print_info --message="Configuring nginx web server..." ynh_print_info --message="Configuring nginx web server..."
# add funkwhale specifics at the beginning of the domain configuration
funkwhale_nginx_domain_configure
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -160,17 +157,6 @@ ynh_replace_string --match_string="__DBNAME__" --replace_string="$app"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$configfile" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$configfile"
ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$configfile" ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$configfile"
loadfile="$final_path/code/load_env"
cat > "$loadfile" <<'EOL'
#!/bin/bash
export $(cat "__FINALPATH__/code/config/.env" | grep -v ^# | xargs)
EOL
chmod +x "$loadfile"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$loadfile"
#================================================= #=================================================
# CONFIGURE ADMIN USER # CONFIGURE ADMIN USER
#================================================= #=================================================
@ -179,7 +165,6 @@ admin_mail=$(ynh_user_get_info --username="$admin" --key="mail")
( (
set +o nounset set +o nounset
source "${final_path}/code/virtualenv/bin/activate" source "${final_path}/code/virtualenv/bin/activate"
source "$loadfile"
set -o nounset set -o nounset
cd "$final_path/code/" cd "$final_path/code/"
@ -236,9 +221,9 @@ yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --action="start" --service_name="${app}-beat" --log_path="systemd" --line_match="celery beat process" ynh_systemd_action --action="start" --service_name="${app}-beat"
ynh_systemd_action --action="start" --service_name="${app}-server" --log_path="systemd" --line_match="Listening on TCP address" ynh_systemd_action --action="start" --service_name="${app}-server"
ynh_systemd_action --action="start" --service_name="${app}-worker" --log_path="systemd" --line_match="celery worker" ynh_systemd_action --action="start" --service_name="${app}-worker"
#================================================= #=================================================
# SETUP FAIL2BAN # SETUP FAIL2BAN

View file

@ -53,9 +53,9 @@ fi
#================================================= #=================================================
ynh_print_info --message="Stopping and removing the systemd service" ynh_print_info --message="Stopping and removing the systemd service"
ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-beat"
ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-server"
ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-worker"
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config --service="$app-server" ynh_remove_systemd_config --service="$app-server"
@ -103,9 +103,6 @@ ynh_secure_remove --file="/var/log/$app"
#================================================= #=================================================
ynh_print_info --message="Removing nginx web server configuration" ynh_print_info --message="Removing nginx web server configuration"
# remove domain specific configuration
funkwhale_nginx_domain_cleaning
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config

View file

@ -148,9 +148,9 @@ yunohost service add "$app-beat" --log "/var/log/$app/beat.log"
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --action="start" --service_name="${app}-beat" --log_path="systemd" --line_match="celery beat process" ynh_systemd_action --action="start" --service_name="${app}-beat"
ynh_systemd_action --action="start" --service_name="${app}-server" --log_path="systemd" --line_match="Listening on TCP address" ynh_systemd_action --action="start" --service_name="${app}-server"
ynh_systemd_action --action="start" --service_name="${app}-worker" --log_path="systemd" --line_match="celery worker" ynh_systemd_action --action="start" --service_name="${app}-worker"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION

View file

@ -77,6 +77,16 @@ ynh_abort_if_errors
# Normalize the URL path syntax # Normalize the URL path syntax
path_url=$(ynh_normalize_url_path "$path_url") path_url=$(ynh_normalize_url_path "$path_url")
#=================================================
# CHECK THE PATH
#=================================================
# see 0.20.0: https://docs.funkwhale.audio/changelog.html#automatically-load-env-file
loadfile="$final_path/code/load_env"
if [ -e "$loadfile" ] ; then
ynh_secure_remove --file="$loadfile"
fi
#================================================= #=================================================
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
@ -94,9 +104,9 @@ fi
#================================================= #=================================================
ynh_print_info --message="Stopping a systemd service..." ynh_print_info --message="Stopping a systemd service..."
ynh_systemd_action --action="stop" --service_name="${app}-beat" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-beat"
ynh_systemd_action --action="stop" --service_name="${app}-server" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-server"
ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="systemd" --line_match="Stopped Funkwhale" ynh_systemd_action --action="stop" --service_name="${app}-worker"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -118,12 +128,6 @@ ynh_setup_source --dest_dir="$final_path/code" --source_id="app-frontend"
#================================================= #=================================================
ynh_print_info --message="Upgrading nginx web server configuration..." ynh_print_info --message="Upgrading nginx web server configuration..."
# remove domain specific configuration
funkwhale_nginx_domain_cleaning
# add funkwhale specifics at the beginning of the domain configuration
funkwhale_nginx_domain_configure
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -184,17 +188,6 @@ ynh_replace_string --match_string="__DBNAME__" --replace_string="$app"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$configfile" ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$configfile"
ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$configfile" ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$configfile"
loadfile="$final_path/code/load_env"
cat > "$loadfile" <<'EOL'
#!/bin/bash
export $(cat "__FINALPATH__/code/config/.env" | grep -v ^# | xargs)
EOL
chmod +x "$loadfile"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$loadfile"
#================================================= #=================================================
# MIGRATE # MIGRATE
#================================================= #=================================================
@ -202,7 +195,6 @@ ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path"
( (
set +o nounset set +o nounset
source "${final_path}/code/virtualenv/bin/activate" source "${final_path}/code/virtualenv/bin/activate"
source "$loadfile"
set -o nounset set -o nounset
cd "$final_path/code" cd "$final_path/code"
@ -282,9 +274,9 @@ fi
#================================================= #=================================================
ynh_print_info --message="Starting a systemd service..." ynh_print_info --message="Starting a systemd service..."
ynh_systemd_action --action="start" --service_name="${app}-beat" --log_path="systemd" --line_match="celery beat process" ynh_systemd_action --action="start" --service_name="${app}-beat"
ynh_systemd_action --action="start" --service_name="${app}-server" --log_path="systemd" --line_match="Listening on TCP address" ynh_systemd_action --action="start" --service_name="${app}-server"
ynh_systemd_action --action="start" --service_name="${app}-worker" --log_path="systemd" --line_match="celery worker" ynh_systemd_action --action="start" --service_name="${app}-worker"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -1,5 +1,5 @@
# Bleeding edge Django # Bleeding edge Django
django>=2.2.1,<2.3 django>=2.2.4,<2.3
# Configuration # Configuration
django-environ>=0.4,<0.5 django-environ>=0.4,<0.5
@ -29,7 +29,7 @@ celery>=4.3,<4.4
# Your custom requirements go here # Your custom requirements go here
django-cors-headers>=2.5.3,<2.6 django-cors-headers>=2.5.3,<2.6
musicbrainzngs==0.6 musicbrainzngs==0.6
djangorestframework>=3.9,<3.10 djangorestframework>=3.10,<3.11
djangorestframework-jwt>=1.11,<1.12 djangorestframework-jwt>=1.11,<1.12
pendulum>=2,<3 pendulum>=2,<3
persisting-theory>=0.2,<0.3 persisting-theory>=0.2,<0.3
@ -39,26 +39,30 @@ django-rest-auth>=0.9,<0.10
ipython>=7,<8 ipython>=7,<8
mutagen>=1.42,<1.43 mutagen>=1.42,<1.43
django-taggit>=0.24,<0.25
pymemoize==1.0.3 pymemoize==1.0.3
django-dynamic-preferences>=1.7,<1.8 django-dynamic-preferences>=1.7.1,<1.8
raven>=6.10,<7 raven>=6.10,<7
python-magic==0.4.15 python-magic==0.4.15
# XXX: until https://github.com/django/channels/issues/1240 is fixed # XXX: until https://github.com/django/channels/issues/1240 is fixed
channels==2.1.6 channels==2.1.6
# suggestion by Eliot Berriot, this dep will be remove in next version anyway channels_redis>=2.3,<2.4
# channels_redis>=2.3,<2.4
channels_redis==2.3.2
daphne>=2.2,<2.3 daphne>=2.2,<2.3
# uvicorn
gunicorn
# YNH specific
uvicorn==0.8.6
service_identity
# END YunoHost specific
cryptography>=2,<3 cryptography>=2,<3
# requests-http-signature==0.0.3 # requests-http-signature==0.0.3
# clone until the branch is merged and released upstream # clone until the branch is merged and released upstream
git+https://github.com/EliotBerriot/requests-http-signature.git@signature-header-support git+https://github.com/EliotBerriot/requests-http-signature.git@signature-header-support
django-cleanup==3.2.0 django-cleanup==3.2.0
requests>=2.22<2.23
pyOpenSSL>=19<20
# for LDAP authentication # for LDAP authentication
python-ldap==3.2.0 python-ldap==3.2.0