simojenki/bonob

Bonob via Docker on Synology NAS issue

hakimh02 opened this issue · 25 comments

Hi,
I seem to have an issue here with Bonob not finding my Sonos device.
This is the message I'm getting when launching Bonob:

bonob (246) Expected config {"name":"bonob","sid":246,"uri":"http://simojenki-bonob1:4534/ws/sonos","secureUri":"http://simojenki-bonob1:4534/ws/sonos","strings":{"uri":"http://simojenki-bonob1:4534/sonos/strings.xml","version":"18"},"presentation":{"uri":"http://simojenki-bonob1:4534/sonos/presentationMap.xml","version":"18"},"pollInterval":1200,"authType":"AppLink"} No existing service registration Re-register Devices Services 0

Screenshot: https://www.screenpresso.com/=T4BZb

My settings are:

NAS and Sonos connected to the same network.
Bonob has been installed via the official Docker image. Bnob using custom Ports:
Local: 4000
Container Port: 4534

Are you using docker host network, or the default docker bridge network? (https://docs.docker.com/engine/reference/run/#network-settings)

bonob will not find your sonos devices if you are using bridge, as they are on a separate network. In that case you need to specify the IP address of one of your sonos devices using the BONOB_SONOS_SEED_HOST env var

Thanks @simojenki! That worked. I can see my Sonos devices now.
However, when trying to add the new Services through the Sonos app, I can see Bonob.
When hitten "Add to Sonos" it says "Check your network connection" within the Sonos application.
Is there something wrong?

Here's a screenshot of the Environment settings of the image in Docker, if that's of any help:

https://www.screenpresso.com/=7ZcGb

These URLs look a bit strange "http://simojenki-bonob1:4534/ws/sonos"

I suspect that you may need to specify BONOB_URL=http://[INSERT YOUR NAS HOSTNAME HERE]:4534

we getting there.
Now it redirects and lets meeting authenticate.
However, when entering my credentials, the following error is displayed:

Login failed!
Error:
connect
ECONNREFUSED
172.17.0.05:4533!

Can you pls send a screenshot similar to this one https://www.screenpresso.com/=T4BZb since you have made your changes?

sure:

https://www.screenpresso.com/=Sx75g

When I click on "Re-register" it says "Successfully registered"

Clicking "Re-register" re-registers the service definition with the sonos device. You then need to complete service sign in via the app on your phone.
I suspect that your BONOB_URL is still incorrect. xyz.synology.me looks like a public facing DNS name, for that to work you would need to allow port 4534 through your firewall and onto your NAS. Unless you absolutely need to do that I would highly recommend you do not expose you NAS to the internet. Also, bonob does not support https, you need to use something else to put https infront of bonob.
For bonob to work you do not need to expose it to the internet, you can run it on your local network, however you need the local NAS IP address or NAS hostname on your local network. For example the IP addresses of your sonos devices are in the 192.168.86.* network, if you NAS is also on that same network its' IP address will be 192.168.86.??. The NAS will also have a hostname on your network. When you configure the NAS you presumably do that via an admin UI in the browser, http://192.168.86.?? . Whatever that IP address is you can use in the BONOB_URL, ie. http://192.168.86.??:4534

too bad, it doesn't work.
I'm using a SSL certificate to use the URL instead of the IP for my NAS. It's not exposed outside of the local network.
I'm also using HTTPS not http, that doesn't work anymore since switching to https.

I've changed the URL to the IP etc, nothing worked. It only works until the last step of the authorization when using the DNS synology.me:4534 but doesn't let me authenticate with the above error.

Too bad!

What is doing the SSL/HTTPS offloading? bonob will not do that for you.

I do have a reverse proxy configured in the NAS to do that for Bonob and any other docker image.
and have also opened ports in my network.

If you are using https, then you need to use the port of the reverse proxy in the BONOB_URL env var, not the port of bonob itself.
ie. BONOB_PORT=4534 & BONOB_URL=https://my-secure-server.com
The reverse proxy then can map the https port (443) to the bonob port 4534

that didn't work either... really too bad! :(

jicho commented

@hakimh02 I've got Navidrome and bonob running on my Synology NAS without any issues...

Navidrome is started like this:

docker run -d \
    --name navidrome \
    --restart=unless-stopped \
    -m 256m \
    -v /volume1/music:/music:ro \
    -v /volume1/docker/navidrome:/data \
    -p 4533:4533 \
    -e PUID=1026 \
    -e PGID=100 \
    -e ND_LOGLEVEL=info \
    -e ND_LASTFM_ENABLED=false \
    -e ND_ENABLEDOWNLOADS=false \
    -e ND_COVERARTPRIORITY="folder.*, cover.*, embedded” \
    -e ND_SCANSCHEDULE=0 \
    -e TZ=Europe/Amsterdam \
    deluan/navidrome:latest

And bonob like this:

docker run -d \
    --name bonob \
    --restart=unless-stopped \
    -p 4534:4534 \
    -m 256m \
    -e TZ=Europe/Amsterdam \
    -e BONOB_SCROBBLE_TRACKS=true \
    -e BONOB_SONOS_SERVICE_NAME=musicbox \
    --network host \
    simojenki/bonob:latest

When both are running bonob is getting the hostname of my NAS, after that a click on the Register button on the bonob page and the bonob service can be connected in the Sonos App.

Key, in my case, is using --network host or in the GUI use the option Use the same network as Docker host.

Hopefully this helps you.

@hakimh02 do you have ND_BASEURL set to something in your Navidrome docker config?
Can you post your docker config for Bonob and Navidrome? That will help.

Hi @idolpx no, I did not setup ND_Baseurl for Navidrome:

Here's an image of the Navidrome container config: https://www.screenpresso.com/=VWaEf

Here's the config of Bonob: https://www.screenpresso.com/cloud/7ZcGb/

You need to set BONOB_NAVIDROME_URL to something so that bonob can find Navidrome.

Your ND_PORT is 4533, so you could try;

BONOB_NAVIDROME_URL=http://[IP OF YOUR NAS]:4533
or
BONOB_NAVIDROME_URL=http://[NETWORK NAME OF YOUR NAME]:4533

Thank you guys for your support.
So, I've tried out the above and I could register the devices and was able to go through the configuration, except for the last step.
When I enter my Navidrome credentials through the SONOS app, the following error is being displayed:

Login failed! Error: write EPROTO 140480537623880:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:332: !

Here's my config:

BONOB:
https://www.screenpresso.com/=nQPUd

NAVIDROME:
https://www.screenpresso.com/=gkA9g

jicho commented

Looking at your bonob config you opened up bonob to the world, I don't think that is smart.

Besides that... When I go to https://hakimnas.synology.me:4533 don't get a reply, so it looks like you need to open the port in your router/firewall or when it's okay to only use everything inside your network you can change hakimnas.synology.me into the internal IP address of your NAS.

I'm assuming your NAS has a static IP.

In my case I'm using everything internally:

Setting name Value
BONOB_URL http://192.168.1.2:4534
BONOB_NAVIDROME_URL http://192.168.1.2:4533

In case you go for this, the IP need to match your NAS IP.

Nah, it's not open to the world, I'm just using an SSL certificate for the hostname, internally.
I believe the issue is because I'm using HTTPS instead of HTTP.

I JUST GOT IT TO WORK!

In the BONOB URL, I just had to change the internal port, to the external port (they're different).
All works now! Thank you guys @jicho @idolpx @simojenki

jicho commented

Problem solved, congrats and enjoy bonob/listening!

Great! Can we consider this issue resolved then?

I also found this thread on sonos forums that talks about how to set up bonob, navidrome on synology;
https://en.community.sonos.com/music-services-and-sources-228994/another-smb1-track-limit-workaround-on-synology-6861233

I am going to paste the text here verbatim for reference in the event that the original post goes away..

I am using Navidrome & Bonob to self-host my music library for the Sonos from Synology. No SMB1 but you do need Docker.
https://www.navidrome.org
https://github.com/simojenki/bonob

The below instructions assume Docker is already installed and running on your Synology NAS. I am on DSM 7. Hopefully this helps some folks. BTW - This works on S2 but doesn’t work with S1.

Download deluan/navidrome:latest (https://hub.docker.com/r/deluan/navidrome)

  • Create container, click advanced settings
  • Check enable auto-restart
  • Choose Volume tab
  • Add a couple of folders:
    Folder: “path to your music/” Mount path: “/music” (Check read-only)
    Folder: “/path for container data” Mount path: “/data”
    (I just created a “navidrome” folder inside of the docker folder in file station) so mine looks like:
    Folder: “docker/navidrome” Mount path: “data”
  • Choose Network tab
  • Check Use same network as Docker Host
  • Choose Environment Tab
  • Environment – default settings are all good
  • Apply then next, check “Run this container after the wizard is finished”

Open another browser tab and go to http://ip address of syno:4533 it will ask you to create a user name and password and then you’ll see the library syncing

Back to the Synology

Download simojenki/bonob

  • Create container, click advanced settings
  • Check enable auto-restart
  • Choose Network tab
  • Check Use same network as Docker Host
  • Choose Environment Tab
  • Add four environment variables:
    Variable: Value:
    BONOB_SONOS_AUTO_REGISTER true
    BONOB_SONOS_SERVICE_NAME Home Server (You can use anything you like)
    BONOB_NAVIDROME_URL http://ip address of syno:4533
    BONOB_URL http://ip address of syno:4534
  • Apply then next, check “Run this container after the wizard is finished”

Getting it working with Sonos (Direct from https://github.com/simojenki/bonob)

Initialising service within sonos app

  • Configure bonob, make sure to set BONOB_URL. bonob must be accessible from your sonos devices on BONOB_URL, otherwise it will fail to initialise within the sonos app, so make sure you test this in your browser by putting BONOB_URL in the address bar and seeing the bonob information page
  • Start bonob,
  • Open sonos app on your device
  • Settings -> Services & Voice -> + Add a Service
  • Select your Music Service, default name is 'bonob', can be overriden with configuration BONOB_SONOS_SERVICE_NAME
  • Press 'Add to Sonos' -> 'Linking sonos with bonob' -> Authorize
  • Your device should open a browser and you should now see a login screen, enter your navidrome credentials
  • You should get 'Login successful!'
  • Go back into the sonos app and complete the process
  • You should now be able to play music from navidrome
  • Within navidrome a new player will be created, 'bonob (username)', so you can configure transcoding specifically for sonos
guyjr commented

A couple of notes on how I set mine up on Synology - followed mainly these instructions, but for the Navidrome container, I use Bridge instead of Host networking (better security), and in my case I have multiple music folders. My /music volume has symlinks on the Synology box pointing to my actual music folders, and the root of those folders is mounted into the Navidrome container like so:

example symlinks:

  • /volume1/MyMusic/FLAC
  • /volume1/MyMusic/MP3 No FLAC

Docker volume mapping:

  • Folder /volume1/MyMusicSymLinks -> /music
  • Folder /volume1/MyMusic -> /volume1/MyMusic

I also set PGID and PUID in each container to point to a new /sbin/nologin user set up for each container - again better security.

All works great, thank you @simojenki for this great project!