This script validates Navidrome is running, by downloading a certain song and validating its MD5 checksum.
Last active
April 20, 2024 09:36
-
-
Save David-Lor/1792b2b04d54c62b094e27eb024ef66a to your computer and use it in GitHub Desktop.
Navidrome Docker Healthcheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
USER="healthcheck" | |
PASSWORD="abc123.." | |
SONG_ID="9bd84601b155f2ffea51f3340e63886d" | |
EXPECTED_MD5="1525ba8e3a84c7a87ad4c6ee3998bcd5" | |
CLIENT_ID="healthcheck.sh" | |
set -e | |
URL="http://localhost:4533/rest/download?u=$USER&p=$PASSWORD&f=json&v=1.8.0&c=$CLIENT_ID&id=$SONG_ID&format=raw&bitrate=0" | |
output=$(/usr/bin/curl -fsS "$URL" | md5sum) | |
test "$output" == "$EXPECTED_MD5 -" || (echo "Healthcheck failed. Output: \"$output\"; expected hash: $EXPECTED_MD5"; exit 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment