Need help setting up nextcloud on SMB share

Hello Community!

So i have an ubuntu VM on my truenas server. The VM itself has very limited capacity and is used for small applications only (Adguard, nginx, kuma, etc.)

Now i want to host a nextcloud instance on that aswell. However i don't want nextcloud to store the files on the VM itself. I want it to be on a SMB share from my truenas instance.

I am not getting that to work...i tried the docker-compose from nextcloud themselves and defined the volumes to be on the SMB share. But when i do that i get the error that nextcloud could not write into the config directory bcs of lacking permissions. Odd because i mounted the share as 1000:1000 and every other directory and file that was created by nextcloud was made as uid=1000 but the config can't be written.

I then tried to define only the config directory to be on a docker volume (like the docker-compose wants for everything) and only the data on that SMB share. Then i get the error it cannot write into the apps folder. But it could create the apps folder but then it can't write into that.

I don't really know what to do anymore.

If someone could help me out here? Maybe give me a small step-by-step guide on how i could achieve what i want here? I don't care about anything to be on the VM itself, that's fine but i want all the personal files to be on that SMB share.

I do NOT want to do this inside of nextcloud and mount that SMB share there...i want it natively on the share.

https://pastebin.com/fxiJdLqB - Docker-Compose file

This was my last try. The SMB share is mounted under /home/pluto/docker/nextcloud and is mounted in /etc/fstab as:
//XXX.XXX.XXX.XX/nextcloud /home/pluto/docker/nextcloud cifs vers=3.0,soft,rsize=8192,wsize=8192,mfsymlinks,user=noneofyourbusiness,pass=wonttellyou,uid=1000,gid=1000

Hopefully someone has the time to help me out :-)

Posted Mar 27, 2023, 1:27 PM UTC · edited

218
flaming_m0e•

The normal way of doing this is mount the SMB share on your docker host, and point your config directory to that path. Don't mess with SMB inside your compose.

1
RandomBrainFckOP•

But thats what i did, didn't i?

I mount the SMB share under a certain path, and then point docker-compose to that path.

Or is there a difference to what i did?

1
flaming_m0e•

But thats what i did, didn't i?

I don't know. Your post didn't really specify that's what you did. It really sounded like you were trying to map the SMB directly in the compose, not on the host.

1
RandomBrainFckOP•

No no, i didn't.

I posted a comment where i linked some pastebin and the exact format of my fstab to show how i do it.

1
flaming_m0e•

And that comment wasn't there when I commented.

I was going off the OP...

1
RandomBrainFckOP•

https://pastebin.com/fxiJdLqB

This was my last try. The SMB share is mounted under /home/pluto/docker/nextcloud and is mounted in /etc/fstab as:
//XXX.XXX.XXX.XX/nextcloud /home/pluto/docker/nextcloud cifs vers=3.0,soft,rsize=8192,wsize=8192,mfsymlinks,user=noneofyourbusiness,pass=wonttellyou,uid=1000,gid=1000

1
flaming_m0e•
  1. You don't have to obfuscate your internal IP addresses. It just makes it more difficult for people to assist when it comes to network items.

  2. You're trying to mount it in your HOME directory. Create a directory OUTSIDE of home and grant permissions to that directory. I use /srv/docker/<nameofapporstack>.

2
RandomBrainFckOP•
  1. i know that i don't have to obfuscate my internet IP.
    But i try to have as little information about my internal network online as possible.
  2. never had any issues with those being inside my home directory...but sure can try that. I added my user "pluto" in the docker group and made it so pluto can run docker. Should i give permissions to that new /srv/... directory to 1000:1000 then aswell? Or docker (999)?
1
flaming_m0e•

The permissions on the path need to match whatever UID/GID the application is running under. If the app is running as user 1000, use 1000

2
RandomBrainFckOP•

i didn't specify the uid or gid in the docker compose....but in my last tries nextcloud made the directories as pluto, so it should be 1000

Alright, gonna try that now - thanks already for your time

1
RandomBrainFckOP•

yeah so nothing works...

i now tried to make a new volume in portainer and use NFS for that, but the docker-compose of the nextcloud won't use that one and wants to use the one it makes by itself.

When i then try to change the volume of the nextcloud-app by hand to that NFS volume it says error: duplicate mounting point /var/www/html

1
jezu-jezu•

wild guess: not sure if this applicable to SMB but does for NFS.

Try to set SMB share maproot User/Group to root:wheel (equivivalent of linux no_root_squash)

edit: sorry just realized there is no maproot option for SMB shares, only for NFS. But hey. maybe this will push you in right direction.

1