YunoHost-Apps / nextcloud_ynh

Nextcloud package for YunoHost
https://nextcloud.com/
GNU Affero General Public License v3.0
144 stars 62 forks source link

Command to change the data directory doesn't work #674

Closed Alexis-IMBERT closed 1 week ago

Alexis-IMBERT commented 4 months ago

Describe the bug

The following command to change the data directory of an app doesn't work properly :

yunohost app setting nextcloud data_dir -v /new/data/path

The command was suggested in this thread to change properly the data directory of Nextcloud and not break fail2ban.

In the documentation here, it say that if the directory exist, the data are moved and if it doesn't, it will the directory is created.

But I try it on my server (new clean install) and it doesn't moved the data, the new directory still doesn't exist... However, the result of the following command change from the default path to the new one :

yunohost app setting nextcloud data_dir

Context

Steps to reproduce

yunohost app setting nextcloud data_dir -v /new/data/path
ls /new/data/path

Expected behavior

The solution could simply be an explanation of how to change the data directory properly (it's really relevant for using get Nextcloud on an bigger drive space than the one of Yunohost is running)

The best option will be a new configuration option on the web administration

PS : With explanation on what to do, I will be pleased to help on the development of this feature

Thank you of your help and investment

OniriCorpe commented 4 months ago

hi!

if the dir path changed and a folder exists at the old location, the folder will be mv'ed to the new location

it's because the docs explain the app provisionning, which occurs before the install/upgrade/restore scripts

there is no data moving where you're changing it's path using the yunohost app setting nextcloud datadir -v /new/data/path command, because it's not designed to

Alexis-IMBERT commented 4 months ago

@OniriCorpe Thank you for youre answer, So this way to change the data directory is still accurate ? (even if the doc is deprecated)

niko2 commented 4 months ago

@Alexis-IMBERT there is a typo in the command: this is data_dir instead of datadir then the command will effectively update the settings.yml

Alexis-IMBERT commented 4 months ago

Hi @niko2 thank you for notice that, This is indeed the command I used with data_dir. I corrected my first comment.

What could be the step to produce a generic script that change the data folder of Nextcloud

Alexis-IMBERT commented 4 months ago

And I just notice that if we do an upgrade of the app :

sudo yunohost app setting nextcloud data_dir

The data folder come back to the default one :

sudo yunohost app setting nextcloud data_dir
/home/yunohost.app/nextcloud
niko2 commented 4 months ago

Yes, you can refer to https://github.com/YunoHost-Apps/nextcloud_ynh/issues/675 Customizing data dir is not supported, apart from using a bind mount I will try this way and eventually document it

niko2 commented 4 months ago

I made a symbolic link and it seems to work (I could do the upgrade to the latest version of nextcloud)

Alexis-IMBERT commented 4 months ago

@niko2 thank you for your test !

Did you do a symbolic link (ls -s ) or a bind mount (mount --bind) ?

niko2 commented 4 months ago

as I said, a symbolic link (ln -s)

Alexis-IMBERT commented 4 months ago

I tested it too on my server, I don't get any trouble, so I push the doc (fr and en) on that MR : https://github.com/YunoHost-Apps/nextcloud_ynh/pull/670

alexAubin commented 1 week ago

Closing because the original issue seem to be addressed and there are followup PRs