# Nextcloud

### Manually adding files

It is possible to add files directly in the server, by transfering them in the Nextcloud's app volume. The volumes are located under `/var/lib/docker/volumes`, and the files are in the `data/__groupfolders/1/` subfolder of the volume.

To correctly add the files, you may need to convert the filename encoding, the easiest being using [`rsync`](https://linux.die.net/man/1/rsync). For example: `rsync -ahr --info=progress2 --iconv=ISO-8859-1,utf8 /var/gdrive/03_Événementiel/ /var/lib/docker/volumes/nextcloud_nextcloud-app/_data/data/__groupfolders/1/GDrive/03_Événementiel/`.

Once added, you first need to update the files ownership to `www-data` with `chmod www-data:www-data <FOLDER> -R`. Then index them in Nextcloud for them to be available in the web application. To do so, run the command `php ./occ files:scan --all` from the `/var/www/html` directory as the user `www-data` within the Nextcloud's container. The easy way is to get the container's name using `docker ps`, then run `docker exec -it -u www-data <CONTAINER> php ./occ files:scan --all`. This may take a while, so I recommend to use [`screen`](https://linux.die.net/man/1/screen) to start it in background, such that you can close the connexion without stopping the indexing.

### Fixing index.php

After restarting nextcloud, it may happen that the base path of the installation become `/nextcloud/index.php`. In that case, you should run the command `php occ maintenance:update:htaccess` in the nextcloud container when logged in as `www-data`, thus usually something like `docker exec -u www-data nextcloud_nextcloud.<smth> php occ maintenance:update:htaccess` should be sufficient.

### OnlyOffice file size issues

OnlyOffice restricts the maximum size of files that can be edited live by the server. It can be increased in the server's configuration (`default.json` in the `onlyoffice_config` docker volume, full path is `/var/lib/docker/volumes/onlyoffice_config/_data/default.json`), through the `FileConverter.converter.maxDownloadBytes` and `FileConverter.inputLimits.[type=your_file_type].uncompressed` fields.

We have increased the maximum size for PPTX and related files to 512MB, as well as XSLX and related to 300MB.