Mount custom volume in app container
I would like to propose/discsuss the following: How about an option to bind additional Docker volumes for Cloudron apps?
My usecase is the following: As discussed several times in this forum, the built-in backup options of Cloudron are not so well suited for the rather large data directories of Nextcloud. Therefore, I would like to move the Nextcloud data to another volume (which is not included in the Cloudron backup) and change the nextcloud-config to use that as data directory. I would then take care of backing up that directory on the Cloudron host by myself.
I currently implemented that behaviour by creating a symlink of the data directory on the host. @tobru mentioned that in this post and asked how to include it in the backup. I explicitly went that way to exclude a folder from the backup. But that seems like misusing an implementational detail of the Cloudron backup, which might change at some point and should not be done on purpose. Thus my question to bind a custom folder as volume in the app-container.
I know that you plan to implement a per-app choice of tgz/rsync backup-options in one of the upcoming releases. That wouldn't really solve it for me though, as I use the Filesystem backup provider and would end up with an additional copy of my nextcloud data. (I use restic btw, to backup both the Cloudron backup-directory and the nextcloud data folder.)
@hendrikvl Yes, agreed. This is in our immediate roadmap. As you said, what is needed is a way to add a volume (which is a directory on the server) and then place this volume in a location of the app's container (essentially, docker's -v flag). This way this volume can be used by the app to store data (like nextcloud's external storage feature). We also had this idea that we can optionally allow this volume to be backed up just like apps. So, it won't be part of the app's backups but volume's backups. Most likely, we won't implement the backup feature as part of the first iteration though.
Time wise, we are making a new release of Cloudron (https://forum.cloudron.io/topic/2103/what-s-coming-in-4-5) in the coming days. The volume feature is the roadmap for the release after that.
@hendrikvl Just wanted to report that I switched to volumes which are now implemented in Cloudron 6. I have the Nextcloud-config and apps in appsdata and a separate Nextcloud datadirectory mounted through a volume. Cloudron takes care of backing up appsdata and I backup the NC-datadirectory separately. Works like a charm.
Thanks for implementing that!
@girish Oops, I realized just now, that I didn't reply to your question yet. What I changed and maybe has to be protected from being accidentally overwritten is the 'datadirectory' option in /app/data/config/config.php. I changed that path from the default path to '/media/mymountpoint'.
I don't remember if I had Nextcloud in maintenance mode or put the app in recovery mode, while I changed that path and moved the files. But it was either of them. However, I had some duplicate storage paths in the database afterwards and I manually updated the oc_storages table as described here and did a files:scan afterwards. But that should not be related to what the code for updates overwrites, I guess.