From cdbac5d96483a3411eacb52f996b06d76511a1d7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Thu, 10 May 2018 18:54:23 +0200 Subject: [PATCH] Upgrade to 0.12 --- conf/app.src | 4 +-- conf/env.prod | 29 ++++++++++++++--- conf/funkwhale-beat.service | 14 +++++++++ conf/funkwhale-server.service | 2 +- conf/funkwhale.target | 2 +- conf/nginx.conf | 14 +++++++-- manifest.json | 4 +-- scripts/_common.sh | 1 - scripts/install | 59 ++++++++++++++++++++++++++--------- scripts/remove | 2 +- sources/patches/app-001.patch | 42 +++++++++++++++++++++++++ 11 files changed, 145 insertions(+), 28 deletions(-) create mode 100644 conf/funkwhale-beat.service create mode 100644 sources/patches/app-001.patch diff --git a/conf/app.src b/conf/app.src index db0fd0c..225a7fb 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/repository/0.8/archive.tar.bz2 -SOURCE_SUM=c74287d46cd88880292fe5b5f1972a5bc393724e581bea015ff7808f13753bf4 +SOURCE_URL=https://code.eliotberriot.com/funkwhale/funkwhale/-/archive/0.12/funkwhale-0.12.tar.bz2 +SOURCE_SUM=5ef7a2cdc760f16f9fde818e1a17eff18bc59e47b985f405b85337d38f71ddaf SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.bz2 SOURCE_IN_SUBDIR=true diff --git a/conf/env.prod b/conf/env.prod index acd3fd7..d453a65 100644 --- a/conf/env.prod +++ b/conf/env.prod @@ -1,10 +1,14 @@ +# If you have any doubts about what a setting does, +# check https://docs.funkwhale.audio/configuration.html#configuration-reference + # If you're tweaking this file from the template, ensure you edit at least the # following variables: # - DJANGO_SECRET_KEY # - DJANGO_ALLOWED_HOSTS # - FUNKWHALE_URL +# - EMAIL_CONFIG and DEFAULT_FROM_EMAIL if you plan to send emails) -# Additionaly, on non-docker setup **only**, you'll also have to tweak/uncomment those variables: +# On non-docker setup **only**, you'll also have to tweak/uncomment those variables: # - DATABASE_URL # - CACHE_URL # - STATIC_ROOT @@ -20,6 +24,8 @@ # You can comment or ignore this if you're not using docker # FUNKWHALE_VERSION=latest +# In-place import, see https://code.eliotberriot.com/funkwhale/funkwhale/tags/0.10 +MUSIC_DIRECTORY_PATH=__FINALPATH__/data/music # General configuration # --------------------- @@ -34,6 +40,24 @@ FUNKWHALE_API_PORT=__PORT__ # your instance FUNKWHALE_URL=__DOMAIN__ +# Configure email sending using this variale +# By default, funkwhale will output emails 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 +# On a production instance, you'll usually want to use an external SMTP server: +# 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 + +# The email address to use to send systme emails. By default, we will +# DEFAULT_FROM_EMAIL=noreply@yourdomain + +# Depending on the reverse proxy used in front of your funkwhale instance, +# the API will use different kind of headers to serve audio files +# Allowed values: nginx, apache2 +REVERSE_PROXY_TYPE=nginx + # API/Django configuration # Database configuration @@ -76,9 +100,6 @@ DJANGO_SECRET_KEY=__KEY__ # want to # DJANGO_ADMIN_URL=^api/admin/ -# If True, unauthenticated users won't be able to query the API -API_AUTHENTICATION_REQUIRED=True - # Sentry/Raven error reporting (server side) # Enable Raven if you want to help improve funkwhale by # automatically sending error reports our Sentry instance. diff --git a/conf/funkwhale-beat.service b/conf/funkwhale-beat.service new file mode 100644 index 0000000..ce2d2db --- /dev/null +++ b/conf/funkwhale-beat.service @@ -0,0 +1,14 @@ +[Unit] +Description=Funkwhale (__APP__) celery beat process +After=redis.service postgresql.service +PartOf=__APP__.target + +[Service] +User=__APP__ +# adapt this depending on the path of your funkwhale installation +WorkingDirectory=__FINALPATH__/api +EnvironmentFile=__FINALPATH__/config/.env +ExecStart=__FINALPATH__/virtualenv/bin/celery -A funkwhale_api.taskapp beat -l INFO + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/conf/funkwhale-server.service b/conf/funkwhale-server.service index 7e2e93e..a059cd1 100644 --- a/conf/funkwhale-server.service +++ b/conf/funkwhale-server.service @@ -8,7 +8,7 @@ User=__APP__ # adapt this depending on the path of your funkwhale installation WorkingDirectory=__FINALPATH__/api EnvironmentFile=__FINALPATH__/config/.env -ExecStart=__FINALPATH__/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application +ExecStart=__FINALPATH__/virtualenv/bin/daphne -b ${FUNKWHALE_API_IP} -p ${FUNKWHALE_API_PORT} config.asgi:application --proxy-headers [Install] WantedBy=multi-user.target diff --git a/conf/funkwhale.target b/conf/funkwhale.target index f1eef7e..0a84441 100644 --- a/conf/funkwhale.target +++ b/conf/funkwhale.target @@ -1,3 +1,3 @@ [Unit] Description=Funkwhale (__APP__) -Wants=__APP__-server.service __APP__-worker.service +Wants=__APP__-server.service __APP__-worker.service __APP__-beat.service diff --git a/conf/nginx.conf b/conf/nginx.conf index a8e735f..aaec7f5 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,9 +18,9 @@ location /federation/ { proxy_pass http://127.0.0.1:__PORT__/federation/; } -location /.well-known/webfinger { +location /.well-known/ { include __FINALPATH__/deploy/funkwhale_proxy.conf; - proxy_pass http://127.0.0.1:__PORT__/.well-known/webfinger; + proxy_pass http://127.0.0.1:__PORT__/.well-known/; } location /media/ { @@ -78,3 +78,13 @@ location /staticfiles/ { # django static files alias __FINALPATH__/data/static/; } + +location /rest/ { + include __FINALPATH__/deploy/funkwhale_proxy.conf; + proxy_pass http://127.0.0.1:__PORT__/api/subsonic/rest/; +} + +location /_protected/music { + internal; + alias __FINALPATH__/data/music; +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index 18df728..3556d1d 100644 --- a/manifest.json +++ b/manifest.json @@ -3,12 +3,12 @@ "id": "funkwhale", "packaging_format": 1, "requirements": { - "yunohost": ">= 2.7.10" + "yunohost": ">= 2.7.12" }, "description": { "en": "A translation platform using Git and Python" }, - "version": "0.8.0-1", + "version": "0.12.0-1", "url": "https://funkwhale.audio", "license": "BSD-3-Clause", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 1d73c1d..97f0e5f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -217,7 +217,6 @@ ynh_psql_execute_file_as_root() { # | arg: pwd - Password of the database. If not given, a password will be generated ynh_psql_setup_db () { db_user="$1" - app="$1" db_name="$2" new_db_pwd=$(ynh_string_random) # Generate a random password # If $3 is not given, use new_db_pwd instead for db_pwd. diff --git a/scripts/install b/scripts/install index 86433a3..b84e00a 100644 --- a/scripts/install +++ b/scripts/install @@ -73,14 +73,13 @@ ynh_install_app_dependencies build-essential curl ffmpeg \ ynh_psql_test_if_first_run db_name=$(ynh_sanitize_dbid "$app") +db_user=$db_name db_user_pwd=$(ynh_string_random) # Initialize database and store postgres password for upgrade -ynh_psql_create_db "$db_name" "$app" "$db_user_pwd" +ynh_psql_create_db "$db_name" "$db_user" "$db_user_pwd" ynh_app_setting_set "$app" db_name "$db_name" ynh_app_setting_set "$app" psqlpwd "$db_user_pwd" -ynh_psql_execute_as_root "CREATE EXTENSION IF NOT EXISTS unaccent;" - systemctl reload postgresql #================================================= @@ -159,7 +158,7 @@ ynh_replace_string "__DBNAME__" "$app" "$configfile" ynh_replace_string "__FINALPATH__" "$final_path" "$configfile" ynh_replace_string "__KEY__" "$key" "$configfile" -cat > "$final_path/load_env" <<'EOL' +cat > "$final_path/load_env" <