navidrome: a music server on its own box, with beets in front of it
Navidrome 0.64.0 on music-box (nodito VM 8200, 1 core / 1 GB / 50 GB), public at music.contrapeso.xyz. A single Go binary with a SQLite database; the only external dependency is ffmpeg for transcoding. Plus beets, the CLI that fixes tags before Navidrome ever indexes them. ── Exposed without basic auth, on purpose ───────────────────────────────── Navidrome speaks two protocols on one port: its web UI, and the Subsonic API (/rest/*) that every mobile client actually uses. A Subsonic client authenticates with ?u=&t=md5(password+salt)&s= in the query string and has nowhere to carry a second credential, so Basic Auth in front of the site is invisible to most of them. The choice is a proxy credential or a working phone. Same call this estate already made for monerod's restricted RPC, for the same reason: proxied bare so Feather can reach it, with the service's own auth doing the authenticating. The cost is stated rather than glossed: the login page and the whole /rest/* surface are reachable by anyone who finds the hostname, and Navidrome has no rate limiting and no 2FA. A fail2ban jail on vipy reads a per-vhost Caddy access log and catches WEB UI brute force, where a bad login returns 401. It very likely does NOT catch Subsonic brute force, because that protocol answers a bad password with HTTP 200 and puts the failure in the body - which Caddy never sees. Nor can it be fixed on the music box: the request arrives from vipy over the tailnet, so the only address fail2ban could ban there is vipy's, which would take down every service behind the edge. Banning has to happen at the edge; the edge cannot see the failure. So /rest/* is protected by password strength alone, and the README carries a one-line curl to re-check that after every upgrade. ── Passwords are stored reversibly, and cannot not be ───────────────────── The Subsonic API requires the server to compute md5(password+salt) per request, so Navidrome cannot hash passwords one-way. It encrypts them at rest with PasswordEncryptionKey instead. Two real consequences, both in the README: root on that box means every Navidrome password in plaintext, so the password must be unique to this service; and changing the key invalidates every stored password, so it is set before the first account and left alone. ── beets is not a service, deliberately ─────────────────────────────────── `beet import` is interactive and it MOVES AND RENAMES FILES. A timer that reorganises a music library unattended is a way to lose one. Installed and configured, run by hand. /srv/music is counterweight:navidrome mode 2750 and the setgid bit is load-bearing: without it beets' files land in the curator's own group, Navidrome cannot read them, and the symptom is an EMPTY LIBRARY rather than a permission error. ReplayGain and lyrics are auto: no - on one core they turn a two-minute import into a twenty-minute one. ── Monitoring ───────────────────────────────────────────────────────────── Host liveness and disk (400), the systemd unit (401), a probe that fetches /app/ and greps it (403), and public reachability plus cert expiry (402). /app/ was chosen by testing all three candidates against 0.64.0: /ping returns a bare "." and proves only that something listens; /rest/ping.view identifies the server but logs two warnings per call, ~576 a day; /app/ returns <title>Navidrome</title> and logs nothing. 402 asserts 200 on /app/ and not on "/", because "/" answers 302 - checked live rather than assumed. ── Also ─────────────────────────────────────────────────────────────────── The headscale ACL grants tag:prd-vipy exactly tag:music-box:4533. Without a rule the node is invisible rather than unreachable, which surfaces as a Caddy 502 "no such host". inventory lan_ip was read off nodito's ARP table for the VM's own MAC, not guessed - and .149 had belonged to another machine, whose stale host key made SSH refuse the connection. That is the designed behaviour, not a fault. 50 GB is the LIBRARY ceiling, not just the OS: /srv/music is on the root disk, so roughly 300-450 albums in FLAC. 1 GB is fine for serving and tight for the initial scan, which is the memory peak. No backups, deliberately. The music files would swamp the age-encrypted nightly path, and navidrome.db is a rebuildable index. What is NOT rebuildable is playlists, play counts, ratings and accounts - there are none today, which is what makes the trade fair, and the README names this as the decision to revisit if that changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
7e4a7c850d
commit
d208783fbf
25 changed files with 1457 additions and 191 deletions
81
ansible/roles/navidrome/templates/beets-config.yaml.j2
Normal file
81
ansible/roles/navidrome/templates/beets-config.yaml.j2
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# beets configuration — managed by Ansible (roles/navidrome)
|
||||
# https://beets.readthedocs.io/
|
||||
#
|
||||
# Run it by hand, over SSH, when material has accumulated in {{ navidrome_incoming_dir }}:
|
||||
# beet import {{ navidrome_incoming_dir }}
|
||||
#
|
||||
# It is interactive on purpose. `beet import -q` auto-applies only strong
|
||||
# matches and leaves the rest where they are, which makes a usable review queue
|
||||
# if the batches ever get boring.
|
||||
|
||||
directory: {{ navidrome_music_dir }}
|
||||
library: {{ navidrome_beets_dir }}/library.db
|
||||
|
||||
# $albumartist, NOT $artist. This is the single most important line in the
|
||||
# file: organising by $artist scatters every compilation and every "feat."
|
||||
# track into its own phantom artist, which is how a library ends up with four
|
||||
# hundred one-album artists and Navidrome gets blamed for it.
|
||||
paths:
|
||||
default: $albumartist/$album%aunique{}/$track $title
|
||||
singleton: Non-Album/$artist/$title
|
||||
comp: Compilations/$album%aunique{}/$track $title
|
||||
albumtype:soundtrack: Soundtracks/$album/$track $title
|
||||
|
||||
import:
|
||||
# MOVES files out of {{ navidrome_incoming_dir }} into the library. Set
|
||||
# `copy: yes` and `move: no` instead if you would rather keep originals
|
||||
# until you trust it.
|
||||
move: yes
|
||||
write: yes
|
||||
languages: en es
|
||||
log: {{ navidrome_beets_dir }}/import.log
|
||||
|
||||
plugins: chroma fetchart embedart scrub duplicates mbsync missing info lastgenre replaygain lyrics permissions
|
||||
|
||||
# THE trap this library is exposed to, and the fix for it.
|
||||
#
|
||||
# beets MOVES files into place, and rename(2) preserves the original group and
|
||||
# mode - so the setgid bit on {{ navidrome_music_dir }} does NOT apply to them
|
||||
# (it only affects files CREATED there, such as the album directories beets
|
||||
# makes, which do come out group-{{ navidrome_group }}). A track that arrives
|
||||
# mode 0600 therefore lands mode 0600 owned by the curator's own group, and
|
||||
# Navidrome cannot read it. It does not error: the track is simply ABSENT from
|
||||
# the library, which is indistinguishable from never having imported it.
|
||||
#
|
||||
# Measured on this box: a 0600 file was unreadable by the navidrome user; the
|
||||
# same file at 0644 was fine. So normalise every imported file.
|
||||
# NO leading zeros. The plugin does int(str(value), 8), and YAML would parse
|
||||
# `0644` as octal -> decimal 420, which the plugin then re-reads as octal 0o420.
|
||||
# Verified on the box: `0644` silently left a 0600 file at 0600; `644` fixes it.
|
||||
permissions:
|
||||
file: 644
|
||||
dir: 755
|
||||
|
||||
# Acoustic fingerprinting: identifies a file from the audio itself when the
|
||||
# tags are too mangled to match. Needs fpcalc, installed by the role.
|
||||
chroma:
|
||||
auto: yes
|
||||
|
||||
fetchart:
|
||||
auto: yes
|
||||
embedart:
|
||||
auto: yes
|
||||
# Strip junk and stale tags before writing clean ones.
|
||||
scrub:
|
||||
auto: yes
|
||||
|
||||
lastgenre:
|
||||
auto: yes
|
||||
source: album
|
||||
|
||||
# auto: no on both of these deliberately. This box has one core; ReplayGain
|
||||
# analysis and lyrics fetching during an import turn a two-minute job into a
|
||||
# twenty-minute one. Run them separately, after the import, when nothing is
|
||||
# waiting on you:
|
||||
# beet replaygain
|
||||
# beet lyrics
|
||||
replaygain:
|
||||
auto: no
|
||||
backend: ffmpeg
|
||||
lyrics:
|
||||
auto: no
|
||||
Loading…
Add table
Add a link
Reference in a new issue