Docker Compose setup for a self-hosted music server with Navidrome, Last.fm scrobbling and private HTTPS access through Tailscale, Caddy and Cloudflare DNS.
The full story is on the blog: English / Português.
| File | Purpose |
|---|---|
docker-compose.yml |
Navidrome and Caddy |
Caddyfile |
HTTPS reverse proxy for your domain |
caddy/Dockerfile |
Builds Caddy with the Cloudflare DNS module |
.env.example |
Music folder and Last.fm keys |
.caddy.env.example |
Domain and Cloudflare token |
Your domain points to the server's Tailscale IP, so only devices on your tailnet can reach it. Caddy gets a Let's Encrypt certificate with the DNS-01 challenge through the Cloudflare API, so no ports need to be open on your router.
- A Linux server with Docker and Docker Compose
- Tailscale on the server and on the devices you will listen from
- A domain on Cloudflare
-
Install Tailscale on the server and note its IP:
curl -fsSL https://tailscale.com/install.sh | sh sudo tailscale up tailscale ip -4 -
In Cloudflare, create an API token from the Edit zone DNS template, limited to your zone. Then add an
Arecord for your hostname (for examplemusic) pointing to the Tailscale IP, set to DNS only. -
Clone this repository and create your config files:
git clone https://github.com/giomustcode/navidrome-selfhosted.git cd navidrome-selfhosted cp .env.example .env cp .caddy.env.example .caddy.env chmod 600 .env .caddy.envFill in
MUSIC_DIRin.env, andDOMAINandCF_API_TOKENin.caddy.env. -
Create the data folder for the user Navidrome runs as (UID 1000 by default):
mkdir -p data sudo chown 1000:1000 data
-
Start everything:
docker compose up -d --build
-
Open
https://your.domainfrom a device on your tailnet. The first user you create becomes the admin.
Create an API account at last.fm/api/account/create, put the API key and shared secret in .env and run docker compose up -d. Then, in Navidrome, go to Personal, switch on Scrobble to Last.fm and approve the access.
docker compose pull
docker compose up -d --build- Navidrome reads tags, not folder names, so tidy tags make a tidy library.
- Port 4533 stays open on the LAN as plain HTTP. Remove it from
docker-compose.ymlif you only want access through Caddy. - If your user is not UID 1000, change
user:indocker-compose.ymland thechownabove.