1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/navidrome_ynh.git synced 2024-09-03 19:46:30 +02:00
This commit is contained in:
Éric Gaspar 2023-10-29 19:35:47 +01:00
parent 09c311662c
commit ae91cc2b20
10 changed files with 39 additions and 28 deletions

View file

@ -1,5 +1,5 @@
# Load configurations from an external config file
ConfigFile = "/var/lib/__APP__/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

@ -6,12 +6,12 @@ After=remote-fs.target network.target
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__INSTALL_DIR__/
ExecStart=__INSTALL_DIR__/__APP__ --configfile "__INSTALL_DIR__/navidrome.toml"
WorkingDirectory=__DATA_DIR__/
ExecStart=__INSTALL_DIR__/__APP__ --configfile "__DATA_DIR__/navidrome.toml"
TimeoutStopSec=20
KillMode=process
Restart=on-failure
ReadWritePaths=__INSTALL_DIR__/
ReadWritePaths=__DATA_DIR__/
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -2,4 +2,4 @@
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 `__DATA_DIR__/navidrome.toml` using the [documentation](https://www.navidrome.org/docs/usage/configuration-options/). Remember to restart Navidrome service if you change your configuration file.

View file

@ -2,4 +2,4 @@
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 `__DATA_DIR__/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.

View file

@ -64,6 +64,8 @@ ram.runtime = "50M"
[resources.install_dir]
[resources.data_dir]
[resources.ports]
[resources.permissions]

View file

@ -21,6 +21,13 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE DATA DIR
#=================================================
# Only relevant if there is a "data_dir" resource for this app
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
@ -35,12 +42,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

@ -54,7 +54,7 @@ ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Web-based music collection server and streamer"
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
#=================================================
# SPECIFIC SETUP
@ -71,10 +71,10 @@ ynh_multimedia_build_main_dir
ynh_script_progression --message="Adding a configuration file..." --weight=1
# Main config File
ynh_add_config --template="navidrome.toml" --destination="$install_dir/navidrome.toml"
ynh_add_config --template="navidrome.toml" --destination="$data_dir/navidrome.toml"
chmod 600 "$$install_dir/navidrome.toml"
chown -R $app:$app "$install_dir/navidrome.toml"
chmod 600 "$data_dir/navidrome.toml"
chown -R $app:$app "$data_dir/navidrome.toml"
#=================================================
# START SYSTEMD SERVICE

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -28,9 +29,6 @@ ynh_remove_systemd_config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
# Remove the config directory securely
ynh_secure_remove --file="/var/lib/$app"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -20,6 +20,16 @@ ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
# (Same as for install dir)
chown -R $app:www-data "$data_dir"
#=================================================
# RESTORE SYSTEMD
#=================================================
@ -30,7 +40,7 @@ systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
yunohost service add $app --description="Web-based music collection server and streamer"
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE

View file

@ -76,7 +76,7 @@ then
ynh_secure_remove --file=$install_dir
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --keep="nadidrome.toml"
ynh_setup_source --dest_dir="$install_dir"
fi
chmod -R o-rwx "$install_dir"
@ -93,7 +93,7 @@ ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="Web-based music collection server and streamer"
yunohost service add $app --description="Web-based music collection server and streamer" --log="/var/log/$app/$app.log"
#=================================================
# UPDATE A CONFIG FILE
@ -101,10 +101,10 @@ yunohost service add $app --description="Web-based music collection server and s
ynh_script_progression --message="Updating a configuration file..."
# Uncomment when there is new options added upstream
ynh_add_config --template="navidrome.toml" --destination="$install_dir/navidrome.toml"
ynh_add_config --template="navidrome.toml" --destination="$data_dir/navidrome.toml"
chmod 600 "$install_dir/navidrome.toml"
chown -R $app:$app "$install_dir/navidrome.toml"
chmod 600 "$data_dir/navidrome.toml"
chown -R $app:$app "$data_dir/navidrome.toml"
#=================================================
# START SYSTEMD SERVICE