diff --git a/conf/navidrome.toml b/conf/navidrome.toml index 5441f00..3fd728f 100644 --- a/conf/navidrome.toml +++ b/conf/navidrome.toml @@ -1,5 +1,5 @@ # Load configurations from an external config file -ConfigFile = "/var/lib/navidrome/navidrome.toml" +ConfigFile = "__DATA_DIR__/navidrome.toml" # Log level. Useful for troubleshooting. Possible values: error, info, debug, trace LogLevel = "INFO" @@ -26,7 +26,7 @@ TranscodingCacheSize = "150MB" ImageCacheSize = "100MB" # Folder to store application data (DB, cache…) -DataFolder = "__CONFIG_PATH__" +DataFolder = "__DATA_DIR__" # Folder where your music library is stored. Can be read-only MusicFolder = "/home/yunohost.multimedia/share/Music" diff --git a/conf/systemd.service b/conf/systemd.service index 4021a5c..83f6352 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,18 +1,18 @@ [Unit] Description=Navidrome: music Server and Streamer After=remote-fs.target network.target -AssertPathExists=__CONFIG_PATH__ +AssertPathExists=__DATA_DIR__ [Service] Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__CONFIG_PATH__/ -ExecStart=__INSTALL_DIR__/__APP__ --configfile "__CONFIG_PATH__/navidrome.toml" +WorkingDirectory=__DATA_DIR__/ +ExecStart=__INSTALL_DIR__/__APP__ --configfile "__DATA_DIR__/navidrome.toml" TimeoutStopSec=20 KillMode=process Restart=on-failure -ReadWritePaths=__CONFIG_PATH__ +ReadWritePaths=__DATA_DIR__ # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/doc/notifications/POST_INSTALL.md b/doc/notifications/POST_INSTALL.md index d970650..8a8fc88 100644 --- a/doc/notifications/POST_INSTALL.md +++ b/doc/notifications/POST_INSTALL.md @@ -2,7 +2,7 @@ Your music files are stored by default in your shared [multimedia folder](https://github.com/YunoHost-Apps/yunohost.multimedia) `/home/yunohost.multimedia/share/Music`. This folder is accessible from Nextcloud with *External Storages* enabled. This will allow you to easily upload your music files to the server. -You can configure an alternative path to you music files by editing the path `MusicFolder = "/home/yunohost.multimedia/share/Music"` in this file `/var/lib/navidrome/navidrome.toml` using the [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Remember to restart Navidrome service if you change your configuration file. +You can configure an alternative path to you music files by editing the path `MusicFolder = "/home/yunohost.multimedia/share/Music"` in this file `/home/yunohost.app/navidrome/navidrome.toml` using the [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Remember to restart Navidrome service if you change your configuration file. ### Client player diff --git a/doc/notifications/POST_INSTALL_fr.md b/doc/notifications/POST_INSTALL_fr.md index b0fbde7..cde43e7 100644 --- a/doc/notifications/POST_INSTALL_fr.md +++ b/doc/notifications/POST_INSTALL_fr.md @@ -2,7 +2,7 @@ Votre musique est a stockée par default dans le [dossier multimédia](https://github.com/YunoHost-Apps/yunohost.multimedia) partagé `/home/yunohost.multimedia/share/Music`. Ce dossier, facilement accessible depuis Nextcloud avec *Stockages externes* activée, vous permettra d'*uploader* facilement vos fichiers de musique sur votre server. -Vous pouvez personnaliser le dossier de stockage de vos fichiers de musique en éditant le fichier de configuration `/var/lib/navidrome/navidrome.toml` et rediriger la variable `MusicFolder = "/home/yunohost.multimedia/share/Music"`. Vous pouvez également changer d'autre réglage en vous aidant de la [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Pensez à redémarrer le service de Navidrome si vous modifiez votre fichier de configuration. +Vous pouvez personnaliser le dossier de stockage de vos fichiers de musique en éditant le fichier de configuration `/home/yunohost.app/navidrome/navidrome.toml` et rediriger la variable `MusicFolder = "/home/yunohost.multimedia/share/Music"`. Vous pouvez également changer d'autre réglage en vous aidant de la [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Pensez à redémarrer le service de Navidrome si vous modifiez votre fichier de configuration. ### Utilisation d'un client diff --git a/manifest.toml b/manifest.toml index 0958004..79da34f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -53,6 +53,8 @@ ram.runtime = "50M" [resources.install_dir] + [resources.data_dir] + [resources.permissions] main.url = "/" diff --git a/scripts/backup b/scripts/backup index 39ebf6c..7189d8c 100644 --- a/scripts/backup +++ b/scripts/backup @@ -35,12 +35,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="/var/lib/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url index 68ca82d..12a9345 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -114,13 +114,12 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -config_path="/var/lib/$app" path_url="$new_path" -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="../conf/navidrome.toml" --destination="$data_dir/navidrome.toml" -chmod 600 "$config_path/navidrome.toml" -chown -R $app:$app "$config_path" +chmod 600 "$data_dir/navidrome.toml" +chown -R $app:$app "$data_dir" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 9cb3063..a254ff9 100644 --- a/scripts/install +++ b/scripts/install @@ -41,6 +41,10 @@ ynh_script_progression --message="Setting up source files..." --weight=4 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # NGINX CONFIGURATION #================================================= @@ -63,16 +67,11 @@ ynh_multimedia_build_main_dir #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=1 -config_path="/var/lib/$app" -ynh_app_setting_set --app=$app --key=config_path --value=$config_path - -mkdir -p "$config_path" - # Main config File -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="../conf/navidrome.toml" --destination="$data_dir/navidrome.toml" -chmod 600 "$config_path/navidrome.toml" -chown -R $app:$app "$config_path" +chmod 600 "$data_dir/navidrome.toml" +chown -R $app:$app "$data_dir" #================================================= # SETUP SYSTEMD @@ -99,14 +98,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/remove b/scripts/remove index cbce88c..20d6ad3 100644 --- a/scripts/remove +++ b/scripts/remove @@ -38,16 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." --weight=6 - -# Remove the config directory securely -ynh_secure_remove --file="/var/lib/$app" - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index 0e30ab5..f54248c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -17,6 +17,11 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" +# Set permissions to app files +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= @@ -24,16 +29,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." --weight=2 - -ynh_restore_file --origin_path="/var/lib/$app" - -chmod 600 "/var/lib/$app/navidrome.toml" -chown -R $app "/var/lib/$app" - #================================================= # RESTORE SYSTEMD #================================================= @@ -56,14 +51,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 0266087..fa71bf6 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -91,6 +91,11 @@ then ynh_setup_source --dest_dir="$install_dir" --source_id=$YNH_ARCH fi +# Set permissions to app files +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # NGINX CONFIGURATION #================================================= @@ -104,13 +109,11 @@ ynh_add_nginx_config #================================================= # ynh_script_progression --message="Updating a configuration file..." -config_path="/var/lib/$app" - # Uncomment when there is new options added upstream -ynh_add_config --template="../conf/navidrome.toml" --destination="$config_path/navidrome.toml" +ynh_add_config --template="../conf/navidrome.toml" --destination="$data_dir/navidrome.toml" -chmod 600 "$config_path/navidrome.toml" -chown -R $app:$app "$config_path" +chmod 600 "$data_dir/navidrome.toml" +chown -R $app:$app "$data_dir" #================================================= # SETUP SYSTEMD @@ -136,14 +139,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Version:" -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" - #================================================= # END OF SCRIPT #=================================================