Add MPD docker setup
This commit is contained in:
parent
bd503eaa0d
commit
4259710626
10 changed files with 170 additions and 77 deletions
130
templates/mpd/config.j2
Normal file
130
templates/mpd/config.j2
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
# An example configuration file for MPD.
|
||||
# Read the user manual for documentation: http://www.musicpd.org/doc/user/
|
||||
# or /usr/share/doc/mpd/user-manual.html
|
||||
|
||||
|
||||
# Files and directories #######################################################
|
||||
#
|
||||
# This setting controls the top directory which MPD will search to discover the
|
||||
# available audio files and add them to the daemon's online database. This
|
||||
# setting defaults to the XDG directory, otherwise the music directory will be
|
||||
# be disabled and audio files will only be accepted over ipc socket (using
|
||||
# file:// protocol) or streaming files over an accepted protocol.
|
||||
#
|
||||
music_directory "/app/music"
|
||||
|
||||
#
|
||||
# This setting sets the MPD internal playlist directory. The purpose of this
|
||||
# directory is storage for playlists created by MPD. The server will use
|
||||
# playlist files not created by the server but only if they are in the MPD
|
||||
# format. This setting defaults to playlist saving being disabled.
|
||||
#
|
||||
playlist_directory "/app/playlists"
|
||||
|
||||
#
|
||||
# This setting sets the location of the MPD database. This file is used to
|
||||
# load the database at server start up and store the database while the
|
||||
# server is not up. This setting defaults to disabled which will allow
|
||||
# MPD to accept files over ipc socket (using file:// protocol) or streaming
|
||||
# files over an accepted protocol.
|
||||
#
|
||||
db_file "/app/config/db"
|
||||
|
||||
#
|
||||
# These settings are the locations for the daemon log files for the daemon.
|
||||
# These logs are great for troubleshooting, depending on your log_level
|
||||
# settings.
|
||||
#
|
||||
log_level "secure"
|
||||
|
||||
#
|
||||
state_file "/app/state/state"
|
||||
#
|
||||
# The location of the sticker database. This is a database which
|
||||
# manages dynamic information attached to songs.
|
||||
#
|
||||
sticker_file "/app/config/sticker.sql"
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
|
||||
# General music daemon options ################################################
|
||||
#
|
||||
# This setting specifies the user that MPD will run as. MPD should never run as
|
||||
# root and you may use this setting to make MPD change its user ID after
|
||||
# initialization. This setting is disabled by default and MPD is run as the
|
||||
# current user.
|
||||
#
|
||||
# user "mpd"
|
||||
|
||||
#
|
||||
# This setting sets the address for the daemon to listen on. Careful attention
|
||||
# should be paid if this is assigned to anything other then the default, any.
|
||||
# This setting can deny access to control of the daemon. Choose any if you want
|
||||
# to have mpd listen on every address. Not effective if systemd socket
|
||||
# activation is in use.
|
||||
#
|
||||
# For network
|
||||
bind_to_address "0.0.0.0"
|
||||
|
||||
#
|
||||
# This setting is the TCP port that is desired for the daemon to get assigned
|
||||
# to.
|
||||
#
|
||||
port "{{ mpd_port }}"
|
||||
|
||||
#
|
||||
# This setting enables automatic update of MPD's database when files in
|
||||
# music_directory are changed.
|
||||
#
|
||||
auto_update "yes"
|
||||
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
# Audio Output ################################################################
|
||||
#
|
||||
# MPD supports various audio output types, as well as playing through multiple
|
||||
# audio outputs at the same time, through multiple audio_output settings
|
||||
# blocks. Setting this block is optional, though the server will only attempt
|
||||
# autodetection for one sound card.
|
||||
#
|
||||
|
||||
# Use a fixed format for the HTTP stream because it cannot switch its audio
|
||||
# format on-the-fly when the song changes.
|
||||
# See https://mpd.readthedocs.io/en/latest/plugins.html#httpd.
|
||||
# See https://wiki.xiph.org/Opus_Recommended_Settings#Recommended_Bitrates for
|
||||
# recommended Opus settings.
|
||||
audio_output {
|
||||
type "httpd"
|
||||
name "HTTP high quality stream"
|
||||
encoder "opus"
|
||||
port "{{ mpd_http_stream_port }}"
|
||||
bind_to_address "0.0.0.0"
|
||||
bitrate "128000"
|
||||
format "192000:24:2"
|
||||
always_on "yes"
|
||||
tags "yes"
|
||||
max_clients "0"
|
||||
}
|
||||
|
||||
audio_output {
|
||||
type "httpd"
|
||||
name "HTTP mobile stream"
|
||||
encoder "opus"
|
||||
port "{{ mpd_http_mobile_stream_port }}"
|
||||
bind_to_address "0.0.0.0"
|
||||
bitrate "96000"
|
||||
format "44100:16:2"
|
||||
always_on "yes"
|
||||
tags "yes"
|
||||
max_clients "1"
|
||||
}
|
||||
|
||||
#
|
||||
# Character Encoding ##########################################################
|
||||
#
|
||||
# If file or directory names do not display correctly for your locale then you
|
||||
# may need to modify this setting.
|
||||
#
|
||||
filesystem_charset "UTF-8"
|
||||
22
templates/mpd/docker-compose.j2
Normal file
22
templates/mpd/docker-compose.j2
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
networks:
|
||||
mpd-net:
|
||||
ipam:
|
||||
config:
|
||||
- subnet: '{{ mpd_subnet }}'
|
||||
|
||||
services:
|
||||
mpd:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- {{ mpd_config_dir }}:/app/config
|
||||
- {{ mpd_state_dir }}:/app/state
|
||||
- {{ mpd_playlist_dir }}:/app/playlists
|
||||
- {{ mpd_music_dir }}:/app/music
|
||||
restart: always
|
||||
networks:
|
||||
mpd-net:
|
||||
ipv4_address: '{{ mpd_app_ip }}'
|
||||
25
templates/mpd/dockerfile.j2
Normal file
25
templates/mpd/dockerfile.j2
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --no-cache add \
|
||||
mpd; \
|
||||
|
||||
RUN useradd \
|
||||
--uid 1000 \
|
||||
--guid 1000 \
|
||||
--groups mpd \
|
||||
--shell /sbin/nologin \
|
||||
--no-create-home \
|
||||
--no-user-group \
|
||||
sonny
|
||||
|
||||
USER sonny
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN mkdir /app/config /app/state /app/playlists
|
||||
|
||||
EXPOSE {{ mpd_port }}/tcp {{ mpd_http_stream_port }}/tcp {{ mpd_http_mobile_stream_port }}/tcp
|
||||
|
||||
CMD ["/usr/bin/mpd", "--no-daemon", "--stdout", "/app/config/mpd.conf"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue