Add MPD docker setup
This commit is contained in:
parent
bd503eaa0d
commit
4259710626
10 changed files with 170 additions and 77 deletions
|
|
@ -1,5 +1,3 @@
|
|||
# {{ ansible_managed }}
|
||||
#
|
||||
# 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
|
||||
|
|
@ -13,7 +11,15 @@
|
|||
# be disabled and audio files will only be accepted over ipc socket (using
|
||||
# file:// protocol) or streaming files over an accepted protocol.
|
||||
#
|
||||
music_directory "{{ mpd_music_dir }}"
|
||||
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
|
||||
|
|
@ -22,8 +28,7 @@ music_directory "{{ mpd_music_dir }}"
|
|||
# MPD to accept files over ipc socket (using file:// protocol) or streaming
|
||||
# files over an accepted protocol.
|
||||
#
|
||||
# TODO: use variable for this, usable for task and this configuration
|
||||
db_file "/home/sonny/.config/mpd/db"
|
||||
db_file "/app/config/db"
|
||||
|
||||
#
|
||||
# These settings are the locations for the daemon log files for the daemon.
|
||||
|
|
@ -33,14 +38,12 @@ db_file "/home/sonny/.config/mpd/db"
|
|||
log_level "secure"
|
||||
|
||||
#
|
||||
# TODO: use variable for this, usable for task and this configuration
|
||||
state_file "/home/sonny/.config/mpd/state"
|
||||
state_file "/app/state/state"
|
||||
#
|
||||
# The location of the sticker database. This is a database which
|
||||
# manages dynamic information attached to songs.
|
||||
#
|
||||
# TODO: use variable for this, usable for task and this configuration
|
||||
sticker_file "/home/sonny/.config/mpd/sticker.sql"
|
||||
sticker_file "/app/config/sticker.sql"
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
|
|
@ -52,7 +55,7 @@ sticker_file "/home/sonny/.config/mpd/sticker.sql"
|
|||
# initialization. This setting is disabled by default and MPD is run as the
|
||||
# current user.
|
||||
#
|
||||
user "sonny"
|
||||
# user "mpd"
|
||||
|
||||
#
|
||||
# This setting sets the address for the daemon to listen on. Careful attention
|
||||
|
|
@ -62,7 +65,7 @@ user "sonny"
|
|||
# activation is in use.
|
||||
#
|
||||
# For network
|
||||
bind_to_address "{{ vpn_listen_address }}"
|
||||
bind_to_address "0.0.0.0"
|
||||
|
||||
#
|
||||
# This setting is the TCP port that is desired for the daemon to get assigned
|
||||
|
|
@ -97,7 +100,7 @@ audio_output {
|
|||
name "HTTP high quality stream"
|
||||
encoder "opus"
|
||||
port "{{ mpd_http_stream_port }}"
|
||||
bind_to_address "{{ vpn_listen_address }}"
|
||||
bind_to_address "0.0.0.0"
|
||||
bitrate "128000"
|
||||
format "192000:24:2"
|
||||
always_on "yes"
|
||||
|
|
@ -110,7 +113,7 @@ audio_output {
|
|||
name "HTTP mobile stream"
|
||||
encoder "opus"
|
||||
port "{{ mpd_http_mobile_stream_port }}"
|
||||
bind_to_address "{{ vpn_listen_address }}"
|
||||
bind_to_address "0.0.0.0"
|
||||
bitrate "96000"
|
||||
format "44100:16:2"
|
||||
always_on "yes"
|
||||
|
|
@ -118,7 +121,6 @@ audio_output {
|
|||
max_clients "1"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Character Encoding ##########################################################
|
||||
#
|
||||
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"]
|
||||
|
|
@ -9,3 +9,4 @@
|
|||
{{ syncthing_nginx_ip }} {{ syncthing_domain }}
|
||||
{{ radicale_nginx_ip }} {{ radicale_domain }}
|
||||
{{ jellyfin_nginx_ip }} {{ jellyfin_domain }}
|
||||
{{ mpd_app_ip }} {{ mpd_domain }}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,9 @@ table ip filter {
|
|||
|
||||
tcp dport 80 ip saddr {{ vpn_subnet }} ip daddr {{ radicale_nginx_ip }} accept comment "Radicale"
|
||||
|
||||
tcp dport {{ mpd_port }} ip saddr . ip daddr @vpn_set accept comment "MPD"
|
||||
tcp dport {{ mpd_http_stream_port }} ip saddr . ip daddr @vpn_set accept comment "MPD HTTP stream"
|
||||
tcp dport {{ mpd_http_mobile_stream_port }} ip saddr . ip daddr @vpn_set accept comment "MPD HTTP mobile stream"
|
||||
tcp dport {{ mpd_port }} ip saddr {{ vpn_subnet }} ip daddr {{ mpd_app_ip }} accept comment "MPD"
|
||||
tcp dport {{ mpd_http_stream_port }} ip saddr {{ vpn_subnet }} ip daddr {{ mpd_app_ip }} accept comment "MPD HTTP stream"
|
||||
tcp dport {{ mpd_http_mobile_stream_port }} ip saddr {{ vpn_subnet }} ip daddr {{ mpd_app_ip }} accept comment "MPD HTTP mobile stream"
|
||||
}
|
||||
|
||||
set vpn_media_set {
|
||||
|
|
@ -83,6 +83,7 @@ table ip filter {
|
|||
iifname {{ vpn_interface }} ip saddr {{ vpn_subnet }} ip daddr {{ transmission_nginx_ip }} accept
|
||||
iifname {{ vpn_interface }} ip saddr {{ vpn_subnet }} ip daddr {{ syncthing_nginx_ip }} accept
|
||||
iifname {{ vpn_interface }} ip saddr {{ vpn_subnet }} ip daddr {{ radicale_nginx_ip }} accept
|
||||
iifname {{ vpn_interface }} ip saddr {{ vpn_subnet }} ip daddr {{ mpd_app_ip }} accept
|
||||
|
||||
iifname {{ vpn_media_interface }} ip saddr {{ vpn_media_subnet }} ip daddr {{ jellyfin_nginx_ip }} accept
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue