I have no support/technical question and have seen the support category. (Be aware that direct support questions will be deleted.)
on
Which general topic do you have
Just recently Nextcloud completely erased many users and files from it’s /data
directory. I have a feeling that the way I use it might be causing this problem (or other potential problems). I create web apps and use Nextcloud within my development and production workflow.
I self-host Nextcloud via docker on a NUC and use it as my production server for said web apps.
Development
I will use a git repo to pull down an instance of project and modify various unique files (like .env
) to the project. This dev project folder is synced via the Nextcloud client on my Laptop
Source Files
I’ve set up the client to ignore such things as **/db/**
and .env
files as I usually deploy the apps with the database right beside it. This means I keep the source code in sync while bouncing between laptop and server. The ignore pattern allows me to have separate production .env
files and ignored Postgres, MongoDB, etc files.
This workflow has been going no problem for over a year now, until now
Production
I’ll ssh into my production server (same NUC that runs Nextcloud) and cd
into the mounted volume nextcloud/data/USERNAME/files/webapps/project_1
directory. There I will deploy the project_1
app via a docker-compose.yml script. The database files will be built right inside, for example webapps/project_1/db/DATABASE_FILES
.
What To Do?
My worry is that this will cause problems, extra work for Nextcloud when it tries to scan files via occ
or when restarting. Even though I ignore them on my client.
Is it nothing to worry about or should I be deploying any database files outside of the nextcloud/data
folder?
Edit/Update
Looks like it was an issue with the log file become very large, filling up the drive, and sometimes unmounting the external drive (where the /data
folder is)
nextcloud/data/nextcloud.log
being over 100gb in size. I made sure the log level was set to only errors.
Looking at the logs revealed that there were permission issues caused by files generated by postgres database
UnexpectedValueException RecursiveDirectoryIterator::__construct(/var/www/html/data/nextcloud/files/webdev/WEBAPP/db/postgres): Failed to open directory: Permission denied
I realize it’s no bueno to create files outside of any nextcloud/webdav client and hopefully this will be a cautionary tail to any others attempting the same thing.
The Fix
clearing out the log files, remounting the drive, and restarting the container brought everything back online
echo "" | sudo tee /mnt/MYDRIVE/nextcloud/data/nextcloud.log > /dev/null
echo "" | sudo tee /mnt/MYDRIVE/nextcloud/data/flow.log > /dev/null