navidrome / navidrome

🎧☁️ Modern Music Server and Streamer compatible with Subsonic/Airsonic
https://www.navidrome.org
GNU General Public License v3.0
10.48k stars 798 forks source link

Make Navidrome available in the AUR #152

Closed AlphaJack closed 3 years ago

AlphaJack commented 4 years ago

I think it would be a great idea to have Navidrome available in the AUR as navidrome-bin.
This is an example of an AUR package that provides pre-built binaries for many architectures.

deluan commented 4 years ago

Thanks for the suggestion. I'll take a look at this when I work on the release pipeline for issues #92 and #142

sumnerevans commented 4 years ago

I've packaged this for the AUR in both binary form (from releases) and a -git version for installing the latest master.

deluan commented 4 years ago

Great!! Thanks! I'll reach out to you to learn how to automate this.

sumnerevans commented 4 years ago

I've not really been able to figure out a good way of fully automating this for my projects. You basically just push to the repo to update the package in the AUR.

I have update.sh scripts in each of the repositories (https://aur.archlinux.org/cgit/aur.git/tree/update.sh?h=navidrome-bin and https://aur.archlinux.org/cgit/aur.git/tree/update.sh?h=navidrome-git) which I run whenever a new version is made, and I can add you as a maintainer on the package so that you can run that script and push to the AUR repo.

deluan commented 4 years ago

Please do. My plan is to try to use goreleaser (used for generating the other binaries) to generate and publish the AUR package

AlphaJack commented 4 years ago

@sumnerevans thank you, hower I would add two features:

[Unit]
Description=Navidrome Music Streamer
After=network.target

[Service]
Type=simple
User=navidrome
Group=navidrome
WorkingDirectory=/var/lib/navidrome
ExecStart=/usr/bin/navidrome -port 4533

[Install]
WantedBy=multi-user.target

@deluan is it possible to add a flag to Navidrome to make it parse a certain configuration file (E.G. /etc/navidrome.conf)? In this way one could write his configurations there and launch it as a daemon from systemd with

ExecStart=/usr/bin/navidrome -c /etc/navidrome.conf
jvoisin commented 4 years ago

There is already a systemd unit in the contrib folder :)

As for the configuration file, put a navidrome.toml/navidrome.json/navidrome.ini in your "datafolder" and it'll be loaded

deluan commented 4 years ago

It already does something similar! It search for a navidrome.toml file at the current folder, you have to add the options in it using the TOML format, like this:

LogLevel = "INFO"
BaseURL = "/music"
ScanInterval = "10s"
TranscodingCacheSize = "15MB"
ImageCacheSize = "10MB"
SessionTimeout = "30m"
MusicFolder = "/Users/deluan/Music/iTunes/iTunes Media/Music"

You can also pass these options to the executable itself, like:

$ navidrome --baseurl="/music" --loglevel="info"

I didn't document this yet because I'm planning to change it, but feel free to use it. If I ever change this I'll add a warning in the release notes

sumnerevans commented 4 years ago

@AlphaJack I don't know of any existing Arch Linux packages that create users automatically. That seems very anti the Arch Philosophy. Can you point me to an example?

deluan commented 4 years ago

Not sure about creating users, but seems that adding a serviced unit is common practice. Ex: https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=sonarr

AlphaJack commented 4 years ago

@sumnerevans AirSonic comes to mind (see airsonic.sysusers), but also netdata, matrix-synapse and others in the official repo.
Given the feature of searching for navidrome.toml in the working directory, is it possible (or at least common practive) to put that file in /etc/ during the installation process and symlinking it to the /var/lib/navidrome folder? This is widely used with PHP webapps such as nextcloud, moodle and privatebin which read their configuration files from /usr/share/webapps/xxx/config/config.php that is a symlink to /etc/webapps/xxx/config.php

AlphaJack commented 4 years ago

@sumnerevans Thank you, it works fine. However the environmental file can't be sourced because the folder /etc/sysconfig doesn't exist, at least on both on Arch ARM and Manjaro x64.
Also, no default configuration file is provided from the AUR, but it's not a major issue.

sumnerevans commented 4 years ago

@AlphaJack Hmm... I'm not sure what do to do there. Maybe I should remove the EnvironmentFile parameter in the config? Or I could just make it blank.

sumnerevans commented 4 years ago

@AlphaJack I added a default, blank, file in /etc/sysconfig/navidrome. Does that work?

AlphaJack commented 4 years ago

E.G. Jellyfin provides its configuration file and copies it in /etc/conf.d/ adding

install -Dm 644 jellyfin.conf "$pkgdir"/etc/conf.d/jellyfin

to the package() function of the PKGBUILD.

For Navidrome a sample configuration file could be navidrome.toml, provided by deluan in a comment above.


I just read your last comment. Yes, the blank file is created correctly. Is there a particular reason to use /etc/sysconfig instead of /etc/?

sumnerevans commented 4 years ago

So, I'll switch it to /etc instead of /etc/sysconfig.

@deluan Is there a way to point Navidrome at a specific config file? The working directory for the service is /var/lib/navidrome, but I want it to use the config in /etc/navidrome/navidrome.toml.

deluan commented 4 years ago

Not ATM, but I'll try to add something for the next release

deluan commented 4 years ago

Hey @sumnerevans , I added the --configfile option to the command line (and env var): https://www.navidrome.org/docs/usage/configuration-options/#configuration-file

After this is added to the AUR, is there anything else preventing us to close this issue? (cc @AlphaJack)

AlphaJack commented 4 years ago

Just a curiosity, why navidrome is the only program which returns static if I run systemctl is-enabled navidrome? Other services return enabled|disabled

This is my unit file:

[Unit]
Description=Navidrome Music Server
After=remote-fs.target network.target
AssertPathExists=/var/lib/navidrome

[Service]
User=navidrome
Group=navidrome
Type=simple
ExecStart=/usr/bin/navidrome
WorkingDirectory=/var/lib/navidrome
TimeoutStopSec=20
KillMode=process
Restart=on-failure
EnvironmentFile=-/etc/sysconfig/navidrome

DevicePolicy=closed
NoNewPrivileges=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap
ReadWritePaths=/var/lib/navidrome
ProtectSystem=full
ProtectHome=true
sumnerevans commented 4 years ago

Got this comment on the AUR package: https://aur.archlinux.org/packages/navidrome-bin/#comment-746589

I'm probably going to have to refactor some things with the configuration. This is kinda why I was not so keen on adding any configuration in the first place.

AlphaJack commented 4 years ago

@sumnerevans https://wiki.archlinux.org/index.php/Pacman/Pacnew_and_Pacsave This may come in handy

deluan commented 3 years ago

This is superseded by #1037

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.