Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. NFS mount for Apps

NFS mount for Apps

Scheduled Pinned Locked Moved Solved Support
nfsvolumes
24 Posts 6 Posters 3.7k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • neurokrishN Offline
      neurokrishN Offline
      neurokrish
      wrote on last edited by girish
      #1

      I have a few NFS mounts on my server for videos, music, etc., which I pass on to apps (Jellyfin, Navidrome, etc.). I am curious as to how these mounts are passed to apps as they start to run. When I reboot Cloudron, these apps run but none of the mounts are available. I mean I can't see the videos or music shares. I have to reboot the app to get access to these folders. So, are the apps starting before the NFS shares get mounted? If so, is there a way to delay app start until the shares are available?

      girishG 1 Reply Last reply
      0
      • nebulonN Offline
        nebulonN Offline
        nebulon
        Staff
        wrote on last edited by
        #2

        Are you using the volume feature of Cloudron for the NFS mounts and have you connected those volumes to that app?

        neurokrishN 1 Reply Last reply
        0
        • nebulonN nebulon

          Are you using the volume feature of Cloudron for the NFS mounts and have you connected those volumes to that app?

          neurokrishN Offline
          neurokrishN Offline
          neurokrish
          wrote on last edited by
          #3

          @nebulon yes, I am using the volumes feature. I then, simply pass these mounts to apps in the Storage area as read only.

          1 Reply Last reply
          0
          • nebulonN Offline
            nebulonN Offline
            nebulon
            Staff
            wrote on last edited by
            #4

            Hm then possibly we have a race at server bootup. Have to check if and how I can reproduce this.

            1 Reply Last reply
            0
            • neurokrishN neurokrish

              I have a few NFS mounts on my server for videos, music, etc., which I pass on to apps (Jellyfin, Navidrome, etc.). I am curious as to how these mounts are passed to apps as they start to run. When I reboot Cloudron, these apps run but none of the mounts are available. I mean I can't see the videos or music shares. I have to reboot the app to get access to these folders. So, are the apps starting before the NFS shares get mounted? If so, is there a way to delay app start until the shares are available?

              girishG Offline
              girishG Offline
              girish
              Staff
              wrote on last edited by
              #5

              @neurokrish next time you hit this, can you also check if the files are not visible in the volume's file manager as well (there is a file manager button next to the right of the volume in the Volumes UI) ? If it's visible, it indicates that there is a race between the mounting and the container getting created.

              As an idea, the systemd mount points are created under /etc/systemd/system/ . Can you try editing the unit files there to have Before=docker.service and see if that helps?

              (Maybe we need to create "wait for" unit files like this - https://serverfault.com/questions/904421/docker-service-starts-before-zfs )

              neurokrishN 3 Replies Last reply
              0
              • M Offline
                M Offline
                msbt
                App Dev
                wrote on last edited by
                #6

                I have a similar issue with my sshfs mount for my Nextcloud instances (setup described here). On every reboot, I have to manually remove both subfolders from the where the mount should be (empty directories) and run mount -a manually to get the correct content online.

                So the sshfs mount is at /mnt/cloud and there are 2 volumes set up like this:
                e20e13ed-b965-4bcd-981c-a512080c2d03-grafik.png

                After reboot, there are those two empty mount points in there that block the actual mounting (/mnt/cloud/cloud1 and /mnt/cloud/cloud2). Those two I have to rm -r in order to get the mounts back. Hope that makes sense.

                1 Reply Last reply
                0
                • girishG girish

                  @neurokrish next time you hit this, can you also check if the files are not visible in the volume's file manager as well (there is a file manager button next to the right of the volume in the Volumes UI) ? If it's visible, it indicates that there is a race between the mounting and the container getting created.

                  As an idea, the systemd mount points are created under /etc/systemd/system/ . Can you try editing the unit files there to have Before=docker.service and see if that helps?

                  (Maybe we need to create "wait for" unit files like this - https://serverfault.com/questions/904421/docker-service-starts-before-zfs )

                  neurokrishN Offline
                  neurokrishN Offline
                  neurokrish
                  wrote on last edited by neurokrish
                  #7

                  @girish sorry, as I mentioned in my other post "Can't access Cloudron", it appears that my ISP started blocking ports 80 and 443. So, I can't troubleshoot the NFS mount issue. I am, however, pretty sure that this problem exists!

                  Let me know if I can do anything to troubleshoot without access to my Cloudron dashboard, and I will.

                  1 Reply Last reply
                  0
                  • girishG girish

                    @neurokrish next time you hit this, can you also check if the files are not visible in the volume's file manager as well (there is a file manager button next to the right of the volume in the Volumes UI) ? If it's visible, it indicates that there is a race between the mounting and the container getting created.

                    As an idea, the systemd mount points are created under /etc/systemd/system/ . Can you try editing the unit files there to have Before=docker.service and see if that helps?

                    (Maybe we need to create "wait for" unit files like this - https://serverfault.com/questions/904421/docker-service-starts-before-zfs )

                    neurokrishN Offline
                    neurokrishN Offline
                    neurokrish
                    wrote on last edited by
                    #8

                    @girish I am back online with Cloudron. Looks like I am caught in a bit of a crossfire with my ISP meddling with things. I checked in the file manager near the mounts in Volumes UI. There are no files over there. Have a look,

                    f5186d65-f37b-4d19-8ae7-4d48d7a5e325-image.png

                    I will edit the files you suggested and report back!

                    1 Reply Last reply
                    0
                    • girishG girish

                      @neurokrish next time you hit this, can you also check if the files are not visible in the volume's file manager as well (there is a file manager button next to the right of the volume in the Volumes UI) ? If it's visible, it indicates that there is a race between the mounting and the container getting created.

                      As an idea, the systemd mount points are created under /etc/systemd/system/ . Can you try editing the unit files there to have Before=docker.service and see if that helps?

                      (Maybe we need to create "wait for" unit files like this - https://serverfault.com/questions/904421/docker-service-starts-before-zfs )

                      neurokrishN Offline
                      neurokrishN Offline
                      neurokrish
                      wrote on last edited by neurokrish
                      #9

                      @girish editing the unit files to add Before=docker.service did not work for me. I can't see any of my files. However, if I try to mount these shares in the host system by editing fstab file, they are available on boot.

                      I can also confirm @msbt 's observations. If after boot, I go to the Volumes UI and delete, re-add shares, all these files become available. I then have to go the app (Jellyfin, Navidrome, etc.) and reboot the app to see the shares..

                      neurokrishN 1 Reply Last reply
                      0
                      • neurokrishN neurokrish

                        @girish editing the unit files to add Before=docker.service did not work for me. I can't see any of my files. However, if I try to mount these shares in the host system by editing fstab file, they are available on boot.

                        I can also confirm @msbt 's observations. If after boot, I go to the Volumes UI and delete, re-add shares, all these files become available. I then have to go the app (Jellyfin, Navidrome, etc.) and reboot the app to see the shares..

                        neurokrishN Offline
                        neurokrishN Offline
                        neurokrish
                        wrote on last edited by neurokrish
                        #10

                        I am just putting this information out here for anybody else. To solve this issue, I created a systemd drop-in unit for docker service to wait for NFS mounts to come online as mentioned in this post https://thedaneshproject.com/posts/start-docker-after-nfs-mounts-come-online/ .

                        I did not yet test on Volumes in Cloudron but in my case the NFS folders are mounted in the host under /media and these folders are added as mounts in the Volume section of Cloudron (as Filesystem Mountpoint).

                        Perhaps @girish @nebulon can implement something similar in Cloudron at some point!

                        robiR 1 Reply Last reply
                        0
                        • neurokrishN neurokrish

                          I am just putting this information out here for anybody else. To solve this issue, I created a systemd drop-in unit for docker service to wait for NFS mounts to come online as mentioned in this post https://thedaneshproject.com/posts/start-docker-after-nfs-mounts-come-online/ .

                          I did not yet test on Volumes in Cloudron but in my case the NFS folders are mounted in the host under /media and these folders are added as mounts in the Volume section of Cloudron (as Filesystem Mountpoint).

                          Perhaps @girish @nebulon can implement something similar in Cloudron at some point!

                          robiR Offline
                          robiR Offline
                          robi
                          wrote on last edited by
                          #11

                          @neurokrish That's great, can you post the contents of that file?

                          Then others can take it further from there.

                          Conscious tech

                          neurokrishN 1 Reply Last reply
                          0
                          • robiR robi

                            @neurokrish That's great, can you post the contents of that file?

                            Then others can take it further from there.

                            neurokrishN Offline
                            neurokrishN Offline
                            neurokrish
                            wrote on last edited by neurokrish
                            #12

                            @robi sure, I created a file, let's say, x.conf in /etc/systemd/system/docker.service.d as mentioned in the link posted above. The contents of that file are,

                            e9394ed1-a6e1-4705-abef-b9573d4669b2-image.png

                            media-movies.mount is just my systemd unit for the NFS mount. I have rebooted my server a few times after this change and my files are all accessible in apps as desired!

                            robiR 1 Reply Last reply
                            0
                            • neurokrishN neurokrish

                              @robi sure, I created a file, let's say, x.conf in /etc/systemd/system/docker.service.d as mentioned in the link posted above. The contents of that file are,

                              e9394ed1-a6e1-4705-abef-b9573d4669b2-image.png

                              media-movies.mount is just my systemd unit for the NFS mount. I have rebooted my server a few times after this change and my files are all accessible in apps as desired!

                              robiR Offline
                              robiR Offline
                              robi
                              wrote on last edited by
                              #13

                              @neurokrish Sounds like it also needs the contents of what that references.

                              Conscious tech

                              neurokrishN 1 Reply Last reply
                              0
                              • robiR robi

                                @neurokrish Sounds like it also needs the contents of what that references.

                                neurokrishN Offline
                                neurokrishN Offline
                                neurokrish
                                wrote on last edited by
                                #14

                                @robi perhaps there is some other way. I will try to dig a little deeper to see if there is any other solution!

                                1 Reply Last reply
                                0
                                • ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by
                                  #15

                                  Unrelated but I did a double take reading NFS as NFT. This forum has not been tainted yet.

                                  robiR 1 Reply Last reply
                                  1
                                  • ? A Former User

                                    Unrelated but I did a double take reading NFS as NFT. This forum has not been tainted yet.

                                    robiR Offline
                                    robiR Offline
                                    robi
                                    wrote on last edited by
                                    #16

                                    @atridad it has been now. 😢

                                    Conscious tech

                                    1 Reply Last reply
                                    0
                                    • nebulonN Offline
                                      nebulonN Offline
                                      nebulon
                                      Staff
                                      wrote on last edited by
                                      #17

                                      I took a quick look at this and the proposed solution to have the dependencies properly setup are not working due to a dependency loop.

                                      unbound requires docker
                                      volumemount requires unbound but has to be started before docker

                                      not quite sure how to resolve that, have to investigate further or does anyone have an idea or are there any best practices with systemd dependencies and docker container startup?

                                      robiR 1 Reply Last reply
                                      0
                                      • nebulonN nebulon

                                        I took a quick look at this and the proposed solution to have the dependencies properly setup are not working due to a dependency loop.

                                        unbound requires docker
                                        volumemount requires unbound but has to be started before docker

                                        not quite sure how to resolve that, have to investigate further or does anyone have an idea or are there any best practices with systemd dependencies and docker container startup?

                                        robiR Offline
                                        robiR Offline
                                        robi
                                        wrote on last edited by robi
                                        #18

                                        @nebulon I don't see a loop.

                                        You have docker already, and unbound and volume mounts can be done with volumes or binds mounts via docker cli..

                                        https://docs.docker.com/storage/volumes/

                                        Escape values from outer CSV parser
                                        
                                        If your volume driver accepts a comma-separated list as an option, you must escape the value from the outer CSV parser. To escape a volume-opt, surround it with double quotes (") and surround the entire mount parameter with single quotes (').
                                        
                                        For example, the local driver accepts mount options as a comma-separated list in the o parameter. This example shows the correct way to escape the list.
                                        
                                        $ docker service create \
                                            --mount 'type=volume,src=<VOLUME-NAME>,dst=<CONTAINER-PATH>,volume-driver=local,volume-opt=type=nfs,volume-opt=device=<nfs-server>:<nfs-path>,"volume-opt=o=addr=<nfs-address>,vers=4,soft,timeo=180,bg,tcp,rw"'
                                            --name myservice \
                                            <IMAGE>
                                        

                                        Conscious tech

                                        nebulonN 1 Reply Last reply
                                        0
                                        • robiR robi

                                          @nebulon I don't see a loop.

                                          You have docker already, and unbound and volume mounts can be done with volumes or binds mounts via docker cli..

                                          https://docs.docker.com/storage/volumes/

                                          Escape values from outer CSV parser
                                          
                                          If your volume driver accepts a comma-separated list as an option, you must escape the value from the outer CSV parser. To escape a volume-opt, surround it with double quotes (") and surround the entire mount parameter with single quotes (').
                                          
                                          For example, the local driver accepts mount options as a comma-separated list in the o parameter. This example shows the correct way to escape the list.
                                          
                                          $ docker service create \
                                              --mount 'type=volume,src=<VOLUME-NAME>,dst=<CONTAINER-PATH>,volume-driver=local,volume-opt=type=nfs,volume-opt=device=<nfs-server>:<nfs-path>,"volume-opt=o=addr=<nfs-address>,vers=4,soft,timeo=180,bg,tcp,rw"'
                                              --name myservice \
                                              <IMAGE>
                                          
                                          nebulonN Offline
                                          nebulonN Offline
                                          nebulon
                                          Staff
                                          wrote on last edited by
                                          #19

                                          @robi my explanation lacked some detail. Let me try to explain with my first morning coffee, maybe helps me sort it as well 🙂

                                          On cloudron we have those volumes, which are essentially mounts on the host system. Those are managed by systemd and can be configured via the dashboard. Then such a volume or mounted folder essentially, can be mounted into an app. (note Cloudron volume !~ docker volume and same for mounts, the terminology is not exactly the same)

                                          Now if the system starts up, the docker daemon will startup up the containers, at which point the host mounted folders have to be available, otherwise docker will mount empty folders into the apps. The unbound service is required for reliable volume host resolving https://git.cloudron.io/cloudron/box/-/commit/a56766ab0e7f13cbc678fee80d3cea2a86d12c71 so it has to be up an running prior to Cloudron volume mounts. All clear so far I think.

                                          Now docker needs to be started before unbound, at least according to the unit file adjusted with https://git.cloudron.io/cloudron/box/-/commit/4d55783ed865922b155c71e8b17533fdd5d850ec this leads to the mentioned loop and systemd breaks the loop during startup by postponing host mounts in this case, according to the systemd startup logs.

                                          Two possible solutions here. Some smart way with systemd to solve such situations, which I don't know yet, or double check why unbound requires to be run after docker. Maybe @girish can shed some light here, I can't remember why that was required back then.

                                          robiR 1 Reply Last reply
                                          0
                                          • nebulonN nebulon

                                            @robi my explanation lacked some detail. Let me try to explain with my first morning coffee, maybe helps me sort it as well 🙂

                                            On cloudron we have those volumes, which are essentially mounts on the host system. Those are managed by systemd and can be configured via the dashboard. Then such a volume or mounted folder essentially, can be mounted into an app. (note Cloudron volume !~ docker volume and same for mounts, the terminology is not exactly the same)

                                            Now if the system starts up, the docker daemon will startup up the containers, at which point the host mounted folders have to be available, otherwise docker will mount empty folders into the apps. The unbound service is required for reliable volume host resolving https://git.cloudron.io/cloudron/box/-/commit/a56766ab0e7f13cbc678fee80d3cea2a86d12c71 so it has to be up an running prior to Cloudron volume mounts. All clear so far I think.

                                            Now docker needs to be started before unbound, at least according to the unit file adjusted with https://git.cloudron.io/cloudron/box/-/commit/4d55783ed865922b155c71e8b17533fdd5d850ec this leads to the mentioned loop and systemd breaks the loop during startup by postponing host mounts in this case, according to the systemd startup logs.

                                            Two possible solutions here. Some smart way with systemd to solve such situations, which I don't know yet, or double check why unbound requires to be run after docker. Maybe @girish can shed some light here, I can't remember why that was required back then.

                                            robiR Offline
                                            robiR Offline
                                            robi
                                            wrote on last edited by robi
                                            #20

                                            @nebulon in this case, what is unbound actually doing? resolving anything?

                                            If so, one solution is to use 'names' that don't need resolving or add it to the local resolver.

                                            Get more explicit.

                                            Conscious tech

                                            girishG 1 Reply Last reply
                                            0
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes


                                              • Login

                                              • Don't have an account? Register

                                              • Login or register to search.
                                              • First post
                                                Last post
                                              0
                                              • Categories
                                              • Recent
                                              • Tags
                                              • Popular
                                              • Bookmarks
                                              • Search