• Support
  • How to mount NFS volume in Docker compose?

Hello,

I'm trying to set up Funkwhale on my RaspberryPi with Docker. I have Funkwhale running as per the greatly improved documentation: https://docs.funkwhale.audio/develop/administrator_documentation/installation_docs/docker.html#before-you-begin

Now, I have a NAS which acts as NFS server, where I want to store my music. I have auto-mounted the drive on my RaspberryPi via fstab:

192.168.178.12:/music       /NAS/music       nfs   auto,nofail,x-systemd.device-timeout=30,noatime

This (NFS) folder has 2 subfolders (and a recycling bin added by the NAS itself):

pi@raspi:/srv/funkwhale $ ls -l /NAS/music
total 12
drwxrwxrwx 2 pi   users 4096 Nov  5 17:18 CC-music
drwxrwxrwx 2 pi   users 4096 Nov  5 17:17 CDs
drwxrwxrwx 2 root root  4096 Nov  5 17:15 @Recycle

My target is to create 2 libraries; one for our private CDs (which cannot be shared) and one for the CC-licensed music that I find and download from the interwebs.

Before I get into libraries, I just need to get this NFS share

I've spent all day installing Funkwhale, reading up on the necessary stuff and checked quite a few articles, questions and videos concerning NFS and Docker (e.g. this video).

I have tried several different docker-compose.yml constellations, here's one I tried, based on the Link your file directory docs:

[for celeryworker:]
    volumes:
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
      - /NAS/music:/srv/funkwhale/data/music

[for api:]
    volumes:
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
      - "${STATIC_ROOT}:${STATIC_ROOT}"
      - "${FUNKWHALE_FRONTEND_PATH}:/frontend"
      - /NAS/music:/srv/funkwhale/data/music

As you can see, I'm declaring the volume in a different way than as per the docs, because the way described in the docs caused errors. (Perhaps as it's based on an older version of Docker compose?)

Previously I also tried setting a separate volume definition, and referencing that:

[for celeryworker:]
    volumes:
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
      - musicvolume:/srv/funkwhale/data/music

[for api:]
    volumes:
      - "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro"
      - "${MEDIA_ROOT}:${MEDIA_ROOT}"
      - "${STATIC_ROOT}:${STATIC_ROOT}"
      - "${FUNKWHALE_FRONTEND_PATH}:/frontend"
      - musicvolume:/srv/funkwhale/data/music

volumes:
  musicvolume:
    driver: local
    driver_opts:
      type: "nfs"
      o: "addr=192.168.178.12,nfsvers=4"
      device: ":/music"

Different attempts didn't work, however: while I can bring up the whole package, the docker container doesn't see the content of the volume (I'd expect to see the 2 sub-folders):

pi@raspi:/srv/funkwhale $ sudo docker exec -it funkwhale-celeryworker-1 sh
/app # ls /srv/funkwhale/data/music/
/app # 

I'm a bit at a loss. I really want my music on the NAS because we have tons of CDs and they don't fit on the RasPi where Funkwhale is running. I'm thinking it's maybe a user/group problem? Any pointers more than welcome!

Side note: I'm also not entirely clear on the following points, but I guess these are irrelevant to the main issue here

  • the relation between MEDIA_ROOT and MUSIC_DIRECTORY_PATH (both in the .env file)
  • the relation between the volumes set in docker-compose.yml and the configuration (e.g. of MUSIC_DIRECTORY_PATH in the .env file and "${MUSIC_DIRECTORY_SERVE_PATH-/srv/funkwhale/data/music}:${MUSIC_DIRECTORY_PATH-/music}:ro" in docker-compose.yml)
  • why the volume definition "${MEDIA_ROOT}:${MEDIA_ROOT}" is still needed if we add the 'custom' NFS volume given that both are for storing the media files
  • if/how to make the 'watching' (docs) permanent (executing the command from the docs seems to initiate a one-time action, which wouldn't persist containers being taken down & brought up again)
3 months later

So:

  • media root is the place when funkwhale saves uploaded images and music files
  • music directory is directory which is used when you are doing in-place import

I guess you should override MUSIC_DIRECTORY_SERVE_PATH with your NFS volume in the line which mentions MUSIC_DIRECTORY_SERVE_PATH and MUSIC_DIRECTORY_PATH.