Added Navidrome configuration for my Raspberry PI 4

This commit is contained in:
Fabio Scotto di Santolo
2025-07-19 13:46:33 +02:00
parent dc910d2c58
commit 5e3f328c32
4 changed files with 70 additions and 19 deletions

View File

@@ -3,4 +3,4 @@
Useful Docker Compose to build project infrastructure on the fly.
- Kafka
- Nginx + PostgreSQL
- Navidrome + Nginx + PostgreSQL

View File

@@ -1,28 +1,77 @@
version: '2.4'
version: "3.8"
services:
web:
image: nginx:1.19
container_name: web
mem_limit: 256m
restart: on-failure
navidrome:
image: deluan/navidrome:latest
container_name: navidrome
restart: unless-stopped
expose:
- "4533"
environment:
# Navidrome's database connection URL now references the secret for the password
# The secret file content will be mounted at /run/secrets/navidrome_db_password
ND_DATABASE_URL: "postgres://navidrome:$(cat /run/secrets/navidrome_db_password)@navidromedb:5432/navidrome_db?sslmode=disable"
# Other Navidrome environment variables...
ND_SESSIONTIMEOUT: 24h
ND_ENABLETRANSCODING: "true"
# ND_SCANSCHEDULE: 1h
# ND_LOGLEVEL: info
# ND_BASEURL: ""
volumes:
- $HOME/Volumes/nginx:/usr/share/nginx/html
- "/opt/navidrome/data:/data"
- "/opt/music:/music:ro"
user: "1000:1000" # Ensure this user has proper permissions on host volumes
networks:
- web
depends_on:
- navidromedb
# --- Declare the secret for Navidrome to use ---
secrets:
- navidrome_db_password # This name refers to the secret defined at the bottom
nginx-proxy-manager:
image: jc21/nginx-proxy-manager:latest
container_name: nginx-proxy-manager
restart: unless-stopped
ports:
- "80:80"
- "443:443"
- "81:81"
volumes:
- "/opt/npm/data:/data"
- "/opt/npm/letsencrypt:/etc/letsencrypt"
networks:
- web
postgres:
navidromedb:
image: postgres:13
container_name: postgres
ports:
- "5432:5432"
container_name: navidromedb
restart: unless-stopped
mem_limit: 2048m
environment:
- POSTGRES_PASSWORD=docker
restart: on-failure
POSTGRES_DB: "navidrome_db"
POSTGRES_USER: "navidrome"
# --- Use the secret for the PostgreSQL root password ---
# The secret file content will be mounted at /run/secrets/postgres_root_password
POSTGRES_PASSWORD_FILE: "/run/secrets/postgres_root_password" # Use _FILE suffix for secret files
volumes:
- $HOME/Volumes/postgres:/var/lib/postgresql/data
- "/opt/postgres/data:/var/lib/postgresql/data"
networks:
- web
# --- Declare the secret for Postgres to use ---
secrets:
- postgres_root_password # This name refers to the secret defined at the bottom
networks:
default:
external:
name: hiyori-net
web:
external: false
# --- Docker Secrets Definition ---
secrets:
navidrome_db_password: # This name is referenced by the 'navidrome' service
file: ./navidrome_db_password.txt # Path to your secret file on the host
postgres_root_password: # This name is referenced by the 'navidromedb' service
file: ./postgres_root_password.txt # Path to your secret file on the host

View File

@@ -0,0 +1 @@
your_navidrome_db_password_here

View File

@@ -0,0 +1 @@
your_super_secret_postgres_password_here