Install nextcloud on vps, but data folder on external nas

Hi
I have installed nextcloud on my NAS built with Raspberry Pi 4. I love it but it is quite slow. I thought of the idea of actually installing nextcloud on my VPS server (cloud server online), but I would like the data folder to be one of my NAS, thus having the performance of the VPS and the big storage of my NAS.

For this purpose, I have tried running nextcloud using docker composer, and then mounting a folder of my nas on the VPS server using Samba. Then on docker, I set the data folder to one on my vps that this one is one on the nas.
I am writing here because when I try installing Nextcloud using the web installer, I get this error:

Error
Unable to create or write to the data folder /data

Maybe is something related to permissions or users? It writes on the NAS, because for example if we see the volume used on docker compose:

volumes:
- /mnt/nextcloud_vps/data:/data

The data folder is created inside the NAS.

Thanks.
Bruno

please show ls -la /mnt

and show us your docker-compose.yml

Sure

ls -la /mnt:
image

You can see inside nextcloud_vps folder the data folder created on the NAS:

image

my docker compose:

---
version: "2.1"
services:
  aio-imaginary:
    image: nextcloud/aio-imaginary:latest
    restart: always
    expose:
      - "9005"
    cap_add:
      - SYS_NICE
    environment:
      - PORT=9005
      - DEBUG=*
    ports:
      - 9005:9005
    command: -concurrency 50 -enable-url-source -p 9005 -return-size
  redis:
    image: redis:latest
    container_name: redis
    restart: always
    command: redis-server --requirepass nextcloud_redis_pass
  nextcloud:
    image: lscr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=33
      - PGID=33
      - TZ=Europe/Berlin
      - REDIS_HOST=redis
      - REDIS_HOST_PORT=6379
      - REDIS_HOST_PASSWORD=nextcloud_redis_pass
    ports:
      - 8888:80
    links:
      - redis
    volumes:
      - /mnt/docker/nextcloud_vps/config:/config
      - /mnt/nextcloud_vps/data:/data # folder on the nas
    depends_on:
      - mariadb
      - redis
    restart: unless-stopped
    
  mariadb:
    image: lscr.io/linuxserver/mariadb
    container_name: mariadb
    environment:
      - PUID=33
      - PGID=33
      - TZ=Europe/Berlin
      - MYSQL_ROOT_PASSWORD=------
      - MYSQL_PASSWORD=---------
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
    ports:
      - 5432:5432
    volumes:
      - /mnt/docker/mariadb_vps:/config
    restart: unless-stopped

thanks
bruno

In your config, you define id33 to run Nextcloud. I think, id33 will be www-data, so try:
sudo chown -R www-data:www-data /mnt/nextcloud_vps

Tried that, still not working. For my nas, I am using openmediavault and samba, maybe something related to user permission on my nas?

did you do a docker compose down?

Yes! I did compose down then up.

and your data-dir is still empty?

There is only a nextcloud.log file inside.

image

 cat nextcloud.log
{"reqId":"Q4LKRyjJ4klrSH0S6ywf","level":3,"time":"2023-11-02T19:15:01+00:00","remoteAddr":"","user":"--","app":"cron","method":"","url":"--","message":"Not installed","userAgent":"--","version":"","exception":{"Exception":"Exception","Message":"Not installed","Code":0,"Trace":[{"file":"/app/www/public/lib/base.php","line":709,"function":"checkInstalled","class":"OC","type":"::"},{"file":"/app/www/public/lib/base.php","line":1196,"function":"init","class":"OC","type":"::"},{"file":"/app/www/public/cron.php","line":43,"args":["/app/www/public/lib/base.php"],"function":"require_once"}],"File":"/app/www/public/lib/base.php","Line":283,"CustomMessage":"--"}}

well, then I think you should do it the other way around. Install it with all stuff on you vps an use external share in Nextcloud. Maybe your server @home is too slow or your internet connection is too slow.
Not sure, if there might be another way to go.

I have tried that before and It makes my nextcloud instance on the VPS get very slow, block itself, or even crash. I am using Zerotier to connect the NAS to the VPS. Maybe are there other ways to connect my NAS and vpn that are faster?>
My nas has full 1 gigabit internet speed.

Iā€™d like to apologize in case these questions are out of the scope of this forum.
Thanks for all the support.