nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.67k stars 4k forks source link

[Bug]: changes on filesystem not reflected w/ 'filesystem_check_changes' => 1 #38010

Closed zakimano closed 1 year ago

zakimano commented 1 year ago

⚠️ This issue respects the following points: ⚠️

Bug description

'filesystem_check_changes' => 1 setting has no effect, when set in either

no error or warning observed.

Steps to reproduce

  1. set 'filesystem_check_changes' => 1 at the end of config.php or user.config.php like so:
    [ ... ]
    'maintenance' => false,
    'filesystem_check_changes' => 1,
    );
  2. cp <nextcloud-data-mount-dir>/<username>/files/test_dir/001.jpg <nextcloud-data-mount-dir>/<username>/files/001.jpg
  3. browse to same location on nextcloud web interface, refresh site, 001.jpg does not show up outside test_dir.

Expected behavior

Copied file shows up at copy destination.

Installation method

Official All-in-One appliance

Nextcloud Server version

25

Operating system

Other

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwritehost": "cloud.local.host",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "cloud.local.host"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "25.0.6.1",
        "overwrite.cli.url": "https:\/\/cloud.local.host\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "tempdirectory": "\/mnt\/ncdata\/tmp\/",
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "updatedirectory": "\/nc-updater",
        "htaccess.RewriteBase": "\/",
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "filesystem_check_changes": 1,
        "loglevel": 2,
        "maintenance": false
    }
}

List of activated Apps

Enabled:
  - activity: 2.17.0
  - calendar: 4.3.3
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.2.0
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_external: 1.17.0
  - files_markdown: 2.4.0
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - nextcloud-aio: 0.3.0
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - notify_push: 0.6.2
  - oauth2: 1.13.0
  - onlyoffice: 7.8.0
  - password_policy: 1.15.0
  - photos: 2.0.1
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.4
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - tasks: 0.14.5
  - text: 3.6.0
  - theming: 2.0.1
  - twofactor_backupcodes: 1.14.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - admin_audit
  - bruteforcesettings
  - encryption
  - suspicious_login
  - twofactor_totp
  - user_ldap

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:45+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairInfoEvent: Repair info: Image cache cleared","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairInfoEvent: Repair info: JS cache cleared","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Clear every generated avatar on major updates","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add preview background cleanup job","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Queue a one-time job to cleanup old backups of the updater","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Cleanup invalid photocache files for carddav","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add background job to cleanup login flow v2 tokens","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Remove potentially over exposing share links","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairInfoEvent: Repair info: No need to remove link shares.","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Clear access cache of projects","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Reset generated avatar flag","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Keep legacy encryption enabled","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Check encryption key format","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Remove old dashboard app config data","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add job to cleanup the bruteforce entries","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Queue a one-time job to check for user uploaded certificates","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Repair DAV shares","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add background job to set the lookup server share state for users","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add token cleanup job","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Clean up abandoned apps","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"OC\\Repair\\Events\\RepairStepEvent: Repair step: Add possibly missing system config","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:46+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::startCheckCodeIntegrity: Starting code integrity check...","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:50+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::finishedCheckCodeIntegrity: Finished code integrity check","userAgent":"--","version":"25.0.5.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:50+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::updateEnd: Update successful","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:50+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::maintenanceDisabled: Turned off maintenance mode","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}
{"reqId":"fyCkTrds16gVg0oF7ghN","level":1,"time":"2023-05-01T17:03:50+00:00","remoteAddr":"","user":"--","app":"updater","method":"","url":"--","message":"\\OC\\Updater::resetLogLevel: Reset log level to Warning(2)","userAgent":"--","version":"25.0.6.1","data":{"app":"updater"}}

Additional info

Official AIO images used in a manual install, following the guide.

Observed before and after updating to 25.0.6 from 25.0.5. Configuration in config.php was set via docker exec -it <container id> bash and vi. Care was taken not to destroy the configured image. As an alternative, user.config.php was mounted as a local volume like so:

  nextcloud-aio-nextcloud:
    depends_on:
      - nextcloud-aio-database
      - nextcloud-aio-redis
      - nextcloud-aio-clamav
      - nextcloud-aio-fulltextsearch
      - nextcloud-aio-imaginary
    image: nextcloud/aio-nextcloud:latest
    expose:
      - "9000"
      - "7867"
    volumes:
      - nextcloud_aio_nextcloud:/var/www/html:rw
      - ./nc-config/user.config.php:/var/www/html/config/user.config.php 
szaimen commented 1 year ago

2. //files/001.jpg

Does this file has the correct file permissions? cp does not retain them IIRC...

zakimano commented 1 year ago

Same behavior (copied files still not recognized) with cp -p, and rsync -pog. Though admittedly, I did overlook this at first.

joshtrichards commented 1 year ago

I'm unable to reproduce this in either v25.0.6/v25.0.5, but there are some differences in our test setups.

Anything unusual about your <nextcloud-data-mount-dir> (/mnt/ncdata I presume)? i.e. What's the underlying filesystem/mount type?

zakimano commented 1 year ago

Sorry for the delay, Here's my config:

nextcloud's data dir is mounted on a mergerFS filesystem @ /srv/mfs/mfs1/nc_data

fstab:

# <file system>                              <dir>                <type>           <options>                                                   <dump> <pass>
tmpfs                                        /tmp                 tmpfs            defaults,noatime,mode=1777                                  0    0
# /dev/sda2
UUID=91ffdb16-a201-4c55-a737-d5f2b1a2e723    /                    ext4             rw,relatime                                                 0    1
# /dev/sda1
UUID=6DA7-880E                               /boot                vfat             rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro    0    2
# /dev/sdb1
UUID=7ee2682a-3c9b-471c-964c-d1362f4fb3f6    /srv/scsi/Y57        ext4             defaults,rw,relatime                                        0    2
# /dev/sdc1
UUID=01d66e02-7f2b-48cc-ba7d-4d26118940da    /srv/scsi/HUP        ext4             defaults,rw,relatime                                        0    2
# /dev/sdd1
UUID=0435f595-067c-4c6d-8a93-bd80b499c495    /srv/scsi/5X1        ext4             defaults,rw,relatime                                        0    2
# /dev/sde1
UUID=333a1a4b-8185-48c0-9cfe-a6e6104ebd71    /srv/scsi/R1K        ext4             defaults,rw,relatime                                        0    2

# MergerFS
/srv/scsi/5X1:/srv/scsi/HUP:/srv/scsi/Y57    /srv/mfs/mfs1        fuse.mergerfs    defaults,fsname=mfs1,allow_other,use_ino,category.create=mfs,moveonenospc=mfs,minfreespace=100G    0    0

I set the following in my .env config:

.env:

[...]
NEXTCLOUD_DATADIR="nextcloud_aio_nextcloud_data"
[...]
VOL_NC="./nc"
VOL_NC_DATA="/srv/mfs/mfs1/nc_data"

In the docker compose file, I create named bound volumes, to keep all nextcloud files organized / in an easy to find place.

docker-compose.yml:

version: "3.9"

services:
  nextcloud-aio-apache:
    depends_on:
      - nextcloud-aio-onlyoffice
      - nextcloud-aio-collabora
      - nextcloud-aio-talk
      - nextcloud-aio-nextcloud
    image: nextcloud/aio-apache:latest
      #ports:
      #  - ${APACHE_IP_BINDING}:${APACHE_PORT}:${APACHE_PORT}/tcp
    environment:
      - NC_DOMAIN=${NC_DOMAIN}
      - NEXTCLOUD_HOST=nextcloud-aio-nextcloud
      - COLLABORA_HOST=nextcloud-aio-collabora
      - TALK_HOST=nextcloud-aio-talk
      - APACHE_PORT=${APACHE_PORT}
      - ONLYOFFICE_HOST=nextcloud-aio-onlyoffice
      - TZ=${TIMEZONE}
      - APACHE_MAX_SIZE=${APACHE_MAX_SIZE}
      - APACHE_MAX_TIME=${NEXTCLOUD_MAX_TIME}
    volumes:
      - nextcloud_aio_nextcloud:/var/www/html:ro
      - nextcloud_aio_apache:/mnt/data:rw
    restart: unless-stopped
    networks:
      - nextcloud-aio
      - nc-net

  nextcloud-aio-database:
    image: nextcloud/aio-postgresql:latest
    expose:
      - "5432"
    volumes:
      - nextcloud_aio_database:/var/lib/postgresql/data:rw
      - nextcloud_aio_database_dump:/mnt/data:rw
    environment:
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
      - POSTGRES_DB=nextcloud_database
      - POSTGRES_USER=nextcloud
      - TZ=${TIMEZONE}
      - PGTZ=${TIMEZONE}
    stop_grace_period: 1800s
    restart: unless-stopped
    networks:
      - nextcloud-aio
    shm_size: 268435456

  nextcloud-aio-nextcloud:
    depends_on:
      - nextcloud-aio-database
      - nextcloud-aio-redis
    image: nextcloud/aio-nextcloud:latest
    expose:
      - "9000"
      - "7867"
    volumes:
      - nextcloud_aio_nextcloud:/var/www/html:rw
      - ./nc-config/user.config.php:/var/www/html/config/user.config.php 
      - ${NEXTCLOUD_DATADIR}:/mnt/ncdata:rw
      - ${NEXTCLOUD_TRUSTED_CACERTS_DIR}:/usr/local/share/ca-certificates:ro
    environment:
      - POSTGRES_HOST=nextcloud-aio-database
      - POSTGRES_PASSWORD=${DATABASE_PASSWORD}
      - POSTGRES_DB=nextcloud_database
      - POSTGRES_USER=nextcloud
      - REDIS_HOST=nextcloud-aio-redis
      - REDIS_HOST_PASSWORD=${REDIS_PASSWORD}
      - AIO_TOKEN=${AIO_TOKEN}
      - NC_DOMAIN=${NC_DOMAIN}
      - ADMIN_USER=admin
      - ADMIN_PASSWORD=${NEXTCLOUD_PASSWORD}
      - NEXTCLOUD_DATA_DIR=/mnt/ncdata
      - OVERWRITEHOST=${NC_DOMAIN}
      - OVERWRITEPROTOCOL=https
      - TURN_SECRET=${TURN_SECRET}
      - SIGNALING_SECRET=${SIGNALING_SECRET}
      - ONLYOFFICE_SECRET=${ONLYOFFICE_SECRET}
      - AIO_URL=${AIO_URL}
      - CLAMAV_ENABLED=${CLAMAV_ENABLED}
      - CLAMAV_HOST=nextcloud-aio-clamav
      - ONLYOFFICE_ENABLED=${ONLYOFFICE_ENABLED}
      - COLLABORA_ENABLED=${COLLABORA_ENABLED}
      - COLLABORA_HOST=nextcloud-aio-collabora
      - TALK_ENABLED=${TALK_ENABLED}
      - ONLYOFFICE_HOST=nextcloud-aio-onlyoffice
      - UPDATE_NEXTCLOUD_APPS=${UPDATE_NEXTCLOUD_APPS}
      - TZ=${TIMEZONE}
      - TALK_PORT=${TALK_PORT}
      - IMAGINARY_ENABLED=${IMAGINARY_ENABLED}
      - IMAGINARY_HOST=nextcloud-aio-imaginary
      - PHP_UPLOAD_LIMIT=${NEXTCLOUD_UPLOAD_LIMIT}
      - PHP_MEMORY_LIMIT=${NEXTCLOUD_MEMORY_LIMIT}
      - FULLTEXTSEARCH_ENABLED=${FULLTEXTSEARCH_ENABLED}
      - FULLTEXTSEARCH_HOST=nextcloud-aio-fulltextsearch
      - PHP_MAX_TIME=${NEXTCLOUD_MAX_TIME}
      - TRUSTED_CACERTS_DIR=${NEXTCLOUD_TRUSTED_CACERTS_DIR}
      - STARTUP_APPS=${NEXTCLOUD_STARTUP_APPS}
      - ADDITIONAL_APKS=${NEXTCLOUD_ADDITIONAL_APKS}
      - ADDITIONAL_PHP_EXTENSIONS=${NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS}
      - INSTALL_LATEST_MAJOR=${INSTALL_LATEST_MAJOR}
    restart: unless-stopped
    networks:
      - nextcloud-aio

  nextcloud-aio-redis:
    image: nextcloud/aio-redis:latest
    expose:
      - "6379"
    environment:
      - REDIS_HOST_PASSWORD=${REDIS_PASSWORD}
      - TZ=${TIMEZONE}
    volumes:
      - nextcloud_aio_redis:/data:rw
    restart: unless-stopped
    networks:
      - nextcloud-aio

    profiles: ["fulltextsearch"]
    image: nextcloud/aio-fulltextsearch:latest
    expose:
      - "9200"
    environment:
      - TZ=${TIMEZONE}
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms1024M -Xmx1024M
      - POSTGRES_HOST=nextcloud-aio-database
    volumes:
      - nextcloud_aio_elasticsearch:/usr/share/elasticsearch/data:rw
    restart: unless-stopped
    networks:
      - nextcloud-aio

volumes:
  nextcloud_aio_apache:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/apache"
  nextcloud_aio_database:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/database"
  nextcloud_aio_database_dump:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/database_dump"
  nextcloud_aio_elasticsearch:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/elasticsearch"
  nextcloud_aio_nextcloud:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/nextcloud"
  nextcloud_aio_redis:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC}/redis"
  nextcloud_aio_nextcloud_data:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC_DATA}"

networks:
  nextcloud-aio:
  nc-net:
    driver: bridge

Since nextcloud-aio-nextcloud container binds ${NEXTCLOUD_DATADIR}:/mnt/ncdata:rw, then at the end I declare:

volumes:
  [...]
  nextcloud_aio_nextcloud_data:
    driver: local
    driver_opts:
      type: "none"
      o: "bind"
      device: "${VOL_NC_DATA}"

which corresponds to the

VOL_NC_DATA="/srv/mfs/mfs1/nc_data"

line in the .env file (which also says that ${NEXTCLOUD_DATADIR} == nextcloud_aio_nextcloud_data), I have bound /srv/mfs/mfs1/nc_data on the host to /mnt/ncdata in the container.

And (somewhat to my surprise) it works really well! Except for this small feature which I really would like to have.

I'll do my best to help you if you have any ideas on what about this setup I should test out or modify.

joshtrichards commented 1 year ago

Okay yeah I'd say that's an unusual underlying filesystem. 🤣

I think NC mostly relies on stat() to grab metadata. Since you're using a fancy UnionFS my first guess is an interaction maybe with the overlays (e.g. the stat() call is getting data from one of them but not the one that necessarily has the new data on it) or something along those lines.

Check out the TIPS as well as KNOWN ISSUES sections for MergerFS here: https://github.com/trapexit/mergerfs You can see they hint at some interactions with things like Plex/Kodi doing filesystem scans to pick up new files

Looks like MergerFS supports an option called func.getattr=newest which is one possibility that may be help you get at the root of things and/or address your issue permanently.

Given that we can't reproduce this on normal filesystems, unless something ends up pointing back at a bug or oversight on the NC side I think it's going to turn out to be something like what I just mentioned.

I'm certainly curious about the outcome - let us know!

nextcloud-command commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

zakimano commented 1 year ago

Good reminder from the bot, thanks. I could only do limited testing with the func.getattr=newest option so far, but it seems to have solved my problem. Thanks for the pointer! I'll close this now.