From f2e0828e7afba26cbb6551edb722310621c1ef69 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Fri, 31 Mar 2023 13:19:41 +0200 Subject: [PATCH] apply Aleks suggestions --- conf/env.prod | 8 ++++---- conf/nginx.conf | 10 +++++----- manifest.toml | 3 +-- scripts/install | 4 ++-- scripts/restore | 1 + 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/conf/env.prod b/conf/env.prod index 0ea9385..ae37480 100644 --- a/conf/env.prod +++ b/conf/env.prod @@ -110,12 +110,12 @@ CACHE_URL=redis://127.0.0.1:6379/__REDIS_DB__ # Where media files (such as album covers or audio tracks) should be stored # on your system? # (Ensure this directory actually exists) -MEDIA_ROOT=__DATA_DIR__/media +MEDIA_ROOT=__DATA_DIR__/data/media # Where static files (such as API css or icons) should be compiled # on your system? # (Ensure this directory actually exists) -STATIC_ROOT=__DATA_DIR__/static +STATIC_ROOT=__DATA_DIR__/data/static # which settings module should django use? # You don't have to touch this unless you really know what you're doing @@ -138,8 +138,8 @@ DJANGO_SECRET_KEY=__KEY__ # MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music # # MUSIC_DIRECTORY_SERVE_PATH= # stays commented, not needed -MUSIC_DIRECTORY_PATH=__DATA_DIR__/music -#MUSIC_DIRECTORY_SERVE_PATH=__DATA_DIR__/import +MUSIC_DIRECTORY_PATH=__DATA_DIR__/data/music +#MUSIC_DIRECTORY_SERVE_PATH=__DATA_DIR__/data/import # LDAP settings # Use the following options to allow authentication on your Funkwhale instance diff --git a/conf/nginx.conf b/conf/nginx.conf index d1db0de..e01ed0f 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -102,11 +102,11 @@ location /.well-known/ { } location /media/__sized__/ { - alias __DATA_DIR__/media/__sized__/; + alias __DATA_DIR__/data/media/__sized__/; } location /media/attachments/ { - alias __DATA_DIR__/media/attachments/; + alias __DATA_DIR__/data/media/attachments/; } location /_protected/media/ { @@ -114,7 +114,7 @@ location /_protected/media/ { # audio files once correct permission / authentication # has been checked on API side internal; - alias __DATA_DIR__/media/; + alias __DATA_DIR__/data/media/; } # Comment the previous location and uncomment this one if you're storing @@ -132,10 +132,10 @@ location /_protected/music/ { # has been checked on API side # Set this to the same value as your MUSIC_DIRECTORY_PATH setting internal; - alias __DATA_DIR__/music/; + alias __DATA_DIR__/data/music/; } location /staticfiles/ { # django static files - alias __DATA_DIR__/static/; + alias __DATA_DIR__/data/static/; } diff --git a/manifest.toml b/manifest.toml index 5a54e7d..1e82b33 100644 --- a/manifest.toml +++ b/manifest.toml @@ -64,8 +64,7 @@ ram.runtime = "50M" [resources.install_dir] [resources.data_dir] - dir = "/home/yunohost.app/__APP__/data" - owner = "__APP__:www-data" + group = "www-data:rx" [resources.permissions] main.url = "/" diff --git a/scripts/install b/scripts/install index 1b6b08a..b267235 100644 --- a/scripts/install +++ b/scripts/install @@ -45,10 +45,10 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Creating a data directory..." --weight=1 -mkdir -p $data_dir/ +mkdir -p $data_dir/data mkdir -p $data_dir/{static,media,music} -chmod 750 "$data_dir/" +chmod 750 "$data_dir" chmod -R o-rwx "$data_dir/" chown -R $app:www-data "$data_dir/" diff --git a/scripts/restore b/scripts/restore index 6563e9d..66c9940 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir/" --not_mandatory +mkdir -p $data_dir/data mkdir -p $data_dir/{static,media,music} chmod 750 "$data_dir/"