1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/navidrome_ynh.git synced 2024-09-03 19:46:30 +02:00

add data_dir

This commit is contained in:
Éric Gaspar 2023-02-06 22:45:22 +01:00
parent 36a0fbb038
commit d49dad8fac
11 changed files with 33 additions and 75 deletions

View file

@ -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"

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -53,6 +53,8 @@ ram.runtime = "50M"
[resources.install_dir]
[resources.data_dir]
[resources.permissions]
main.url = "/"

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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
#=================================================

View file

@ -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
#=================================================