diff --git a/Containers/mastercontainer/start.sh b/Containers/mastercontainer/start.sh index f87527cbb21..98490bfbaa9 100644 --- a/Containers/mastercontainer/start.sh +++ b/Containers/mastercontainer/start.sh @@ -168,6 +168,22 @@ It is set to '$NEXTCLOUD_MAX_TIME'." exit 1 fi fi +if [ -n "$NEXTCLOUD_MAX_FILE_UPLOADS" ]; then + if ! echo "$NEXTCLOUD_MAX_FILE_UPLOADS" | grep -q '^[0-9]\+$'; then + print_red "You've set NEXTCLOUD_MAX_FILE_UPLOADS but not to an allowed value. +The string must be a number. E.g. '200'. +It is set to '$NEXTCLOUD_MAX_FILE_UPLOADS'." + exit 1 + fi +fi +if [ -n "$NEXTCLOUD_CHUNK_SIZE" ]; then + if ! echo "$NEXTCLOUD_CHUNK_SIZE" | grep -q '^[0-9]\+$'; then + print_red "You've set NEXTCLOUD_CHUNK_SIZE but not to an allowed value. +The string must be a number. E.g. '10485760'. +It is set to '$NEXTCLOUD_CHUNK_SIZE'." + exit 1 + fi +fi if [ -n "$NEXTCLOUD_MEMORY_LIMIT" ]; then if ! echo "$NEXTCLOUD_MEMORY_LIMIT" | grep -q '^[0-9]\+M$'; then print_red "You've set NEXTCLOUD_MEMORY_LIMIT but not to an allowed value. diff --git a/Containers/nextcloud/Dockerfile b/Containers/nextcloud/Dockerfile index b79644bb00a..e897bc13e04 100644 --- a/Containers/nextcloud/Dockerfile +++ b/Containers/nextcloud/Dockerfile @@ -4,6 +4,7 @@ FROM php:8.2.24-fpm-alpine3.20 ENV PHP_MEMORY_LIMIT=512M ENV PHP_UPLOAD_LIMIT=10G ENV PHP_MAX_TIME=3600 +ENV PHP_MAX_FILE_UPLOADS=200 ENV SOURCE_LOCATION=/usr/src/nextcloud ENV REDIS_DB_INDEX=0 @@ -122,6 +123,7 @@ RUN set -ex; \ { \ echo 'memory_limit=${PHP_MEMORY_LIMIT}'; \ echo 'upload_max_filesize=${PHP_UPLOAD_LIMIT}'; \ + echo 'max_file_uploads=${PHP_MAX_FILE_UPLOADS}'; \ echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \ echo 'max_execution_time=${PHP_MAX_TIME}'; \ echo 'max_input_time=${PHP_MAX_TIME}'; \ diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 1abbcd5e9e2..cd80f958ae9 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -377,6 +377,11 @@ DATADIR_PERMISSION_CONF done fi + # Adjust Files app chunk size + if [ -n "$NEXTCLOUD_CHUNK_SIZE"]; then + php /var/www/html/occ config:app:set files max_chunk_size --value="$NEXTCLOUD_CHUNK_SIZE" + fi + #upgrade else touch "$NEXTCLOUD_DATA_DIR/update.failed" diff --git a/compose.yaml b/compose.yaml index f3b534529ed..66e57cae0ba 100644 --- a/compose.yaml +++ b/compose.yaml @@ -22,7 +22,9 @@ services: # NEXTCLOUD_MOUNT: /mnt/ # Allows the Nextcloud container to access the chosen directory on the host. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host # NEXTCLOUD_UPLOAD_LIMIT: 10G # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-upload-limit-for-nextcloud # NEXTCLOUD_MAX_TIME: 3600 # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-max-execution-time-for-nextcloud + # NEXTCLOUD_MAX_FILE_UPLOADS: 200 # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-max-file-uploads-limit-for-nextcloud # NEXTCLOUD_MEMORY_LIMIT: 512M # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-memory-limit-for-nextcloud + # NEXTCLOUD_CHUNK_SIZE: 10485760 # Can be adjusted if you need more. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-file-upload-chunk-size-for-nextcloud # NEXTCLOUD_TRUSTED_CACERTS_DIR: /path/to/my/cacerts # CA certificates in this directory will be trusted by the OS of the nexcloud container (Useful e.g. for LDAPS) See See https://github.com/nextcloud/all-in-one#how-to-trust-user-defined-certification-authorities-ca # NEXTCLOUD_STARTUP_APPS: deck twofactor_totp tasks calendar contacts notes # Allows to modify the Nextcloud apps that are installed on starting AIO the first time. See https://github.com/nextcloud/all-in-one#how-to-change-the-nextcloud-apps-that-are-installed-on-the-first-startup # NEXTCLOUD_ADDITIONAL_APKS: imagemagick # This allows to add additional packages to the Nextcloud container permanently. Default is imagemagick but can be overwritten by modifying this value. See https://github.com/nextcloud/all-in-one#how-to-add-os-packages-permanently-to-the-nextcloud-container diff --git a/manual-install/latest.yml b/manual-install/latest.yml index e5d876ca12d..4ec4d5fdf1c 100644 --- a/manual-install/latest.yml +++ b/manual-install/latest.yml @@ -141,9 +141,11 @@ services: - CLAMAV_MAX_SIZE=${APACHE_MAX_SIZE} - PHP_UPLOAD_LIMIT=${NEXTCLOUD_UPLOAD_LIMIT} - PHP_MEMORY_LIMIT=${NEXTCLOUD_MEMORY_LIMIT} + - NEXTCLOUD_CHUNK_SIZE=${NEXTCLOUD_CHUNK_SIZE} - FULLTEXTSEARCH_ENABLED=${FULLTEXTSEARCH_ENABLED} - FULLTEXTSEARCH_HOST=nextcloud-aio-fulltextsearch - PHP_MAX_TIME=${NEXTCLOUD_MAX_TIME} + - PHP_MAX_FILE_UPLOADS=${NEXTCLOUD_MAX_FILE_UPLOADS} - TRUSTED_CACERTS_DIR=${NEXTCLOUD_TRUSTED_CACERTS_DIR} - STARTUP_APPS=${NEXTCLOUD_STARTUP_APPS} - ADDITIONAL_APKS=${NEXTCLOUD_ADDITIONAL_APKS} diff --git a/manual-install/sample.conf b/manual-install/sample.conf index e75f5b1e527..78343360a8e 100644 --- a/manual-install/sample.conf +++ b/manual-install/sample.conf @@ -31,7 +31,9 @@ NEXTCLOUD_ADDITIONAL_APKS=imagemagick # This allows to add additional pac NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value. NEXTCLOUD_DATADIR=nextcloud_aio_nextcloud_data # You can change this to e.g. "/mnt/ncdata" to map it to a location on your host. It needs to be adjusted before the first startup and never afterwards! NEXTCLOUD_MAX_TIME=3600 # This allows to change the upload time limit of the Nextcloud container +NEXTCLOUD_MAX_FILE_UPLOADS=200 # This allows to change the maximum number of files allowed to be uploaded simultaneously of the Nextcloud container. NEXTCLOUD_MEMORY_LIMIT=512M # This allows to change the PHP memory limit of the Nextcloud container +NEXTCLOUD_CHUNK_SIZE=10485760 # This allows to change the chunk size of the Nextcloud container. NEXTCLOUD_MOUNT=/mnt/ # This allows the Nextcloud container to access directories on the host. It must never be equal to the value of NEXTCLOUD_DATADIR! NEXTCLOUD_STARTUP_APPS="deck twofactor_totp tasks calendar contacts notes" # Allows to modify the Nextcloud apps that are installed on starting AIO the first time NEXTCLOUD_TRUSTED_CACERTS_DIR=/usr/local/share/ca-certificates/my-custom-ca # Nextcloud container will trust all the Certification Authorities, whose certificates are included in the given directory. diff --git a/manual-install/update-yaml.sh b/manual-install/update-yaml.sh index d8bb0cc21af..f70ac6595d3 100644 --- a/manual-install/update-yaml.sh +++ b/manual-install/update-yaml.sh @@ -78,8 +78,10 @@ sed -i 's|NEXTCLOUD_DATADIR=|NEXTCLOUD_DATADIR=nextcloud_aio_nextcloud_data sed -i 's|NEXTCLOUD_MOUNT=|NEXTCLOUD_MOUNT=/mnt/ # This allows the Nextcloud container to access directories on the host. It must never be equal to the value of NEXTCLOUD_DATADIR!|' sample.conf sed -i 's|NEXTCLOUD_UPLOAD_LIMIT=|NEXTCLOUD_UPLOAD_LIMIT=10G # This allows to change the upload limit of the Nextcloud container|' sample.conf sed -i 's|NEXTCLOUD_MEMORY_LIMIT=|NEXTCLOUD_MEMORY_LIMIT=512M # This allows to change the PHP memory limit of the Nextcloud container|' sample.conf +sed -i 's|NEXTCLOUD_CHUNK_SIZE=|NEXTCLOUD_CHUNK_SIZE=10485760 # This allows to change the chunk size of the Nextcloud container.|' sample.conf sed -i 's|APACHE_MAX_SIZE=|APACHE_MAX_SIZE=10737418240 # This needs to be an integer and in sync with NEXTCLOUD_UPLOAD_LIMIT|' sample.conf sed -i 's|NEXTCLOUD_MAX_TIME=|NEXTCLOUD_MAX_TIME=3600 # This allows to change the upload time limit of the Nextcloud container|' sample.conf +sed -i 's|NEXTCLOUD_MAX_FILE_UPLOADS=|NEXTCLOUD_MAX_FILE_UPLOADS=200 # This allows to change the maximum number of files allowed to be uploaded simultaneously of the Nextcloud container.|' sample.conf sed -i 's|NEXTCLOUD_TRUSTED_CACERTS_DIR=|NEXTCLOUD_TRUSTED_CACERTS_DIR=/usr/local/share/ca-certificates/my-custom-ca # Nextcloud container will trust all the Certification Authorities, whose certificates are included in the given directory.|' sample.conf sed -i 's|UPDATE_NEXTCLOUD_APPS=|UPDATE_NEXTCLOUD_APPS="no" # When setting to "yes" (with quotes), it will automatically update all installed Nextcloud apps upon container startup on saturdays.|' sample.conf sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else).|' sample.conf diff --git a/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml b/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml index cbfc8b157fc..afaf180b22f 100755 --- a/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml +++ b/nextcloud-aio-helm-chart/templates/nextcloud-aio-nextcloud-deployment.yaml @@ -127,8 +127,12 @@ spec: value: https - name: PHP_MAX_TIME value: "{{ .Values.NEXTCLOUD_MAX_TIME }}" + - name: PHP_MAX_FILE_UPLOADS + value: "{{ .Values.NEXTCLOUD_MAX_FILE_UPLOADS }}" - name: PHP_MEMORY_LIMIT value: "{{ .Values.NEXTCLOUD_MEMORY_LIMIT }}" + - name: NEXTCLOUD_CHUNK_SIZE + value: "{{ .Values.NEXTCLOUD_CHUNK_SIZE }}" - name: PHP_UPLOAD_LIMIT value: "{{ .Values.NEXTCLOUD_UPLOAD_LIMIT }}" - name: POSTGRES_DB diff --git a/nextcloud-aio-helm-chart/values.yaml b/nextcloud-aio-helm-chart/values.yaml index 4d483cef67d..ffa7667ed22 100755 --- a/nextcloud-aio-helm-chart/values.yaml +++ b/nextcloud-aio-helm-chart/values.yaml @@ -29,7 +29,9 @@ INSTALL_LATEST_MAJOR: no # Setting this to yes will install the latest Ma NEXTCLOUD_ADDITIONAL_APKS: imagemagick # This allows to add additional packages to the Nextcloud container permanently. Default is imagemagick but can be overwritten by modifying this value. NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS: imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value. NEXTCLOUD_MAX_TIME: 3600 # This allows to change the upload time limit of the Nextcloud container +NEXTCLOUD_MAX_FILE_UPLOADS: 200 # This allows to change the maximum number of files allowed to be uploaded simultaneously of the Nextcloud container. NEXTCLOUD_MEMORY_LIMIT: 512M # This allows to change the PHP memory limit of the Nextcloud container +NEXTCLOUD_CHUNK_SIZE: 10485760 # This allows to change the chunk size of the Nextcloud container. NEXTCLOUD_STARTUP_APPS: deck twofactor_totp tasks calendar contacts notes # Allows to modify the Nextcloud apps that are installed on starting AIO the first time NEXTCLOUD_TRUSTED_CACERTS_DIR: # Setting this to any value allows to automatically import root certificates into the Nextcloud container NEXTCLOUD_UPLOAD_LIMIT: 10G # This allows to change the upload limit of the Nextcloud container diff --git a/php/containers.json b/php/containers.json index a107df84a40..e43de5d78e7 100644 --- a/php/containers.json +++ b/php/containers.json @@ -210,9 +210,11 @@ "CLAMAV_MAX_SIZE=%APACHE_MAX_SIZE%", "PHP_UPLOAD_LIMIT=%NEXTCLOUD_UPLOAD_LIMIT%", "PHP_MEMORY_LIMIT=%NEXTCLOUD_MEMORY_LIMIT%", + "NEXTCLOUD_CHUNK_SIZE=%NEXTCLOUD_CHUNK_SIZE%", "FULLTEXTSEARCH_ENABLED=%FULLTEXTSEARCH_ENABLED%", "FULLTEXTSEARCH_HOST=nextcloud-aio-fulltextsearch", "PHP_MAX_TIME=%NEXTCLOUD_MAX_TIME%", + "PHP_MAX_FILE_UPLOADS=%NEXTCLOUD_MAX_FILE_UPLOADS", "TRUSTED_CACERTS_DIR=%NEXTCLOUD_TRUSTED_CACERTS_DIR%", "STARTUP_APPS=%NEXTCLOUD_STARTUP_APPS%", "ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%", diff --git a/readme.md b/readme.md index 88972ecfa13..59826cf1efd 100644 --- a/readme.md +++ b/readme.md @@ -28,7 +28,9 @@ Included are: - Ready to be used behind existing [Reverse proxies](https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md) - Can be used behind [Cloudflare Tunnel](https://github.com/nextcloud/all-in-one#how-to-run-nextcloud-behind-a-cloudflare-tunnel) - Ready for big file uploads up to 10 GB on public links, [adjustable](https://github.com/nextcloud/all-in-one#how-to-adjust-the-upload-limit-for-nextcloud) (logged in users can upload much bigger files using the webinterface or the mobile/desktop clients since chunking is used in that case) +- Adjust files [chunk size](https://github.com/nextcloud/all-in-one#how-to-adjust-the-file-upload-chunk-size-for-nextcloud) for Cloudflare Tunnel/Proxy users. - PHP and web server timeouts set to 3600s, [adjustable](https://github.com/nextcloud/all-in-one#how-to-adjust-the-max-execution-time-for-nextcloud) (important for big file uploads) +- Defaults to a max of 200 simultaneous file uploads, [adjustable](https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-max-file-uploads-limit-for-nextcloud) - Defaults to a max of 512 MB RAM per PHP process, [adjustable](https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-memory-limit-for-nextcloud) - Automatic TLS included (by using Let's Encrypt) - Brotli compression enabled by default for javascript, css and svg files which reduces Nextcloud load times @@ -229,6 +231,7 @@ Another but untested way is to install Portainer on your TrueNAS SCALE from here - Make sure to [disable Cloudflares Rocket Loader feature](https://help.nextcloud.com/t/login-page-not-working-solved/149417/8) as otherwise Nextcloud's login prompt will not be shown. - Cloudflare only supports uploading files up to 100 MB in the free plan, if you try to upload bigger files you will get an error (413 - Payload Too Large) if no chunking is used (e.g. for public uploads in the web, or if chunks are configured to be bigger than 100 MB in the clients or the web). If you need to upload bigger files, you need to disable the proxy option in your DNS settings. Note that this will both disable Cloudflare DDoS protection and Cloudflare Tunnel as these services require the proxy option to be enabled. - If using Cloudflare Tunnel and the Nextcloud Desktop Client [Set Chunking on Nextcloud Desktop Client](https://github.com/nextcloud/desktop/issues/4271#issuecomment-1159578065) +- If using Cloudflare Tunnel/Proxy [Adjust chunk size for Nextcloud files](https://github.com/nextcloud/all-in-one#how-to-adjust-the-file-upload-chunk-size-for-nextcloud) - Cloudflare only allows a max timeout of 100s for requests which is not configurable. This means that any server-side processing e.g. for assembling chunks for big files during upload that take longer than 100s will simply not work. See https://github.com/nextcloud/server/issues/19223. If you need to upload big files reliably, you need to disable the proxy option in your DNS settings. Note that this will both disable Cloudflare DDoS protection and Cloudflare Tunnel as these services require the proxy option to be enabled. - It is known that the in AIO included collabora (Nextcloud Office) does not work out of the box behind Cloudflare. To make it work, you need to add all [Cloudflare IP-ranges](https://www.cloudflare.com/ips/) to the wopi-allowlist in `https://yourdomain.com/settings/admin/richdocuments` - Cloudflare Proxy might block the Turnserver for Nextcloud Talk from working correctly. You might want to disable Cloudflare Proxy thus. See https://github.com/nextcloud/all-in-one/discussions/2463#discussioncomment-5779981 @@ -667,9 +670,15 @@ By default, public uploads to Nextcloud are limited to a max of 10G (logged in u ### How to adjust the max execution time for Nextcloud? By default, uploads to Nextcloud are limited to a max of 3600s. You can adjust the upload time limit by providing `--env NEXTCLOUD_MAX_TIME=3600` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must be a number e.g. `3600`. +### How to adjust the PHP max file uploads limit for Nextcloud? +By default, the max number of files that can be uploaded simultaneously is limited to a max of 200 files. You can adjust this value limit by providing `--env NEXTCLOUD_MAX_FILE_UPLOADS=200` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must be a number e.g. `200`. + ### How to adjust the PHP memory limit for Nextcloud? By default, each PHP process in the Nextcloud container is limited to a max of 512 MB. You can adjust the memory limit by providing `--env NEXTCLOUD_MEMORY_LIMIT=512M` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must start with a number and end with `M` e.g. `1024M`. +### How to adjust the file upload chunk size for Nextcloud? +By default, Nexcloud chunk size is limited to a max of 10 MiB. You can adjust the chunk size by providing `--env NEXTCLOUD_CHUNK_SIZE=10485760` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) and customize the value to your fitting. It must start with a number and the size should be in bytes, e.g.`104857600` for 100 MiB, important if you use Cloudflare Tunnel or Proxy. + ### What can I do to fix the internal or reserved ip-address error? If you get an error during the domain validation which states that your ip-address is an internal or reserved ip-address, you can fix this by first making sure that your domain indeed has the correct public ip-address that points to the server and then adding `--add-host yourdomain.com:` to the docker run command of the mastercontainer (but before the last line `nextcloud/all-in-one:latest`! If it was started already, you will need to stop the mastercontainer, remove it (no data will be lost) and recreate it using the docker run command that you initially used) which will allow the domain validation to work correctly. And so that you know: even if the `A` record of your domain should change over time, this is no problem since the mastercontainer will not make any attempt to access the chosen domain after the initial domain validation. diff --git a/tests/QA/060-environmental-variables.md b/tests/QA/060-environmental-variables.md index 488ae8e0d38..7c4960602bb 100644 --- a/tests/QA/060-environmental-variables.md +++ b/tests/QA/060-environmental-variables.md @@ -9,7 +9,9 @@ - [ ] When starting the mastercontainer with `--env NEXTCLOUD_MOUNT="/mnt/"` it should map `/mnt/` to `/mnt/` inside the Nextcloud container. See https://github.com/nextcloud/all-in-one#how-to-allow-the-nextcloud-container-to-access-directories-on-the-host for allowed values. - [ ] When starting the mastercontainer with `--env NEXTCLOUD_UPLOAD_LIMIT=11G` it should change Nextclouds upload limit to 11G. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-upload-limit-for-nextcloud for allowed values. - [ ] When starting the mastercontainer with `--env NEXTCLOUD_MEMORY_LIMIT=1024M` it should change Nextclouds PHP memory limit to 1024M. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-memory-limit-for-nextcloud for allowed values. +- [ ] When starting the mastercontainer with `--env NEXTCLOUD_CHUNK_SIZE=10485760` it should change Nextclouds chunk size to 10MiB. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-file-upload-chunk-size-for-nextcloud for allowed values. - [ ] When starting the mastercontainer with `--env NEXTCLOUD_MAX_TIME=4000` it should change Nextclouds upload max time 4000s. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-max-execution-time-for-nextcloud for allowed values. +- [ ] When starting the mastercontainer with `--env NEXTCLOUD_MAX_FILE_UPLOADS=200` it should change Nextclouds max file uploads to 200. See https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-max-file-uploads-limit-for-nextcloud for for allowed values. - [ ] When starting the mastercontainer with `--env BORG_RETENTION_POLICY="--keep-within=1d --keep-weekly=1 --keep-monthly=1"` it should change borgs retention policy to the defined one. This can be checked when creating a backup and looking at the logs. - [ ] When starting the mastercontainer with `--env WATCHTOWER_DOCKER_SOCKET_PATH="$XDG_RUNTIME_DIR/docker.sock"` it should map `$XDG_RUNTIME_DIR/docker.sock` to `/var/run/docker.sock` inside the watchtower container which allow to update the mastercontainer on docker rootless. - [ ] When starting the mastercontainer with `--env AIO_DISABLE_BACKUP_SECTION=true` it should hide the backup section that gets shown after AIO is set up (everything of [020-backup-and-restore](./020-backup-and-restore.md)) and simply show that the backup section is disabled.