Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Add multiple bind to address support #357

Closed
vari opened this issue Dec 9, 2023 · 6 comments · Fixed by #364
Closed

[Enhancement] Add multiple bind to address support #357

vari opened this issue Dec 9, 2023 · 6 comments · Fixed by #364
Labels
enhancement New feature or request feature coverage Coverage for a feature from the upstream project

Comments

@vari
Copy link

vari commented Dec 9, 2023

It would be nice to be able to specify multiple bind to address values for MPD.

Context: I'd like to have MPD listen via the standard 0.0.0.0 address as well as via unix file socket. The unix file socket is necessary for adding music files to MPD's queue using absolute file paths (e.g. if I wanted to play files that are not in the /music directory). While I could switch to exclusively using the unix file socket via the existing MPD_BIND_ADDRESS var, I'd like to have MPD also listen via TCP at 0.0.0.0 so that my phone MPD client can connect to it as well.

@GioF71 GioF71 added enhancement New feature or request feature coverage Coverage for a feature from the upstream project labels Dec 9, 2023
@GioF71
Copy link
Owner

GioF71 commented Dec 10, 2023

Hello, sure, will do that, maybe today but I cannot guarantee.
Can you explain me the use case? For my own understading.
On my desktop I used to use Cantata (unfortunately discontinued) which could create an http server for streaming local files.
Thank you

@vari
Copy link
Author

vari commented Dec 11, 2023

My setup is a little complicated but basically, I have a separate mount point (lets call it /tmpMusic) in addition to the standard /music mount attached to the MPD container. In /tmpMusic, I like to add some temporary music that I don't necessarily want in my normal library yet, but I would still like to have MPD play music in that directory sometimes. I don't want MPD to index those files since its not part of my normal /music library. This is part of a larger setup which is beyond the scope of this issue but basically I have a MPD client that connects to MPD via UNIX socket to issue the commands to play /tmpMusic files (due to MPD's requirement of using UNIX sockets when specifying filepaths outside of the /music directory). This works fine but I can no longer use a MPD client on my phone to listen to music if MPD is not also listening on 0.0.0.0.

I think a simpler and likely more common use case would be something like wanting to use one bind_to_address to listen to requests from localhost and one bind_to_address to listen on a specific IP (perhaps the IP via which a reverse proxy forwards traffic to MPD). The default listen to 0.0.0.0 address would work in this scenario, but having two separate bind addresses might provide better security since you only accept connections from localhost and on that one IP used for the reverse proxy.

maybe today but I cannot guarantee.

Thanks for being so responsive and resolving this and the other issues I filed so quickly 😄

@GioF71
Copy link
Owner

GioF71 commented Dec 11, 2023

Hello, so did the change work for you?
Would you share your compose file or docker run command?

Thank you!

@vari
Copy link
Author

vari commented Dec 12, 2023

Yep, the changes worked perfectly.

Here's a simplified version of my compose file:

services:
  mpd:
    container_name: 'mpd'
    image: 'giof71/mpd-alsa:vanilla-latest'
    restart: unless-stopped
    environment:
      RESTORE_PAUSED: "yes"
      DEFAULT_PERMISSIONS: "read"
      PASSWORD: "REDACTED"
      MPD_BIND_ADDRESS: "/var/run/mpd/socket"
      MPD_BIND_ADDRESS_1: "0.0.0.0"
      
      # Icecast streaming
      SHOUT_OUTPUT_CREATE: "yes"
      SHOUT_OUTPUT_ENABLED: "yes"
      SHOUT_OUTPUT_HOST: icecast
      SHOUT_OUTPUT_PORT: 8000
      SHOUT_OUTPUT_MOUNT: "/icecast"
      SHOUT_OUTPUT_USER: "REDACTED"
      SHOUT_OUTPUT_PASSWORD: "REDACTED"
      SHOUT_OUTPUT_ALWAYS_ON: "yes"
    ports:
      - '6600:6600'
    volumes:
      - ./mpd/db:/db
      - ./playlists:/playlists
      - ./mpd/log:/log
      - ./mpd/config:/user/config
      - ./mpd/socket:/var/run/mpd/
      # Music dir - path to normal music library
      - ./music:/music
      # Temp music dir for adhoc playing of music not in the regular /music library. Client must use socket for this
      - ./tmpMusic:/tmpMusic

@GioF71
Copy link
Owner

GioF71 commented Dec 12, 2023

Hello, thank you for sharing your configuration.
May I ask which client do you use? Just curious.
For a scenario very similar to yours, I tend to stick with upnp: I have a MiniDlna instance (also running docker image here) on that "tmpMusic", and then use any control point to play from that library.

In any case I am happy that you can use my container in your setup!

@vari
Copy link
Author

vari commented Dec 13, 2023

My setup is in flux (mostly just playing around with MPD and trying to get more familiar with it). Currently using mympd but looking into other clients. Will take a look at MiniDLNA as well - thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request feature coverage Coverage for a feature from the upstream project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants