Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ENV variables to adjust max_file_uploads and max_chunk_size #5449

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion Containers/mastercontainer/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ It is set to '$NEXTCLOUD_DATADIR'."
fi
if [ -n "$NEXTCLOUD_MOUNT" ]; then
if ! echo "$NEXTCLOUD_MOUNT" | grep -q "^/" || [ "$NEXTCLOUD_MOUNT" = "/" ]; then
print_red "You've set NEXCLOUD_MOUNT but not to an allowed value.
print_red "You've set NEXTCLOUD_MOUNT but not to an allowed value.
The string must start with '/' and must not be equal to '/'.
It is set to '$NEXTCLOUD_MOUNT'."
exit 1
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions Containers/nextcloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}'; \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so that this info does not get lost: #5095 (reply in thread)

echo 'post_max_size=${PHP_UPLOAD_LIMIT}'; \
echo 'max_execution_time=${PHP_MAX_TIME}'; \
echo 'max_input_time=${PHP_MAX_TIME}'; \
Expand Down
5 changes: 5 additions & 0 deletions Containers/nextcloud/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ 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_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_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 nextcloud 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
# 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. See https://github.com/nextcloud/all-in-one#how-to-add-php-extensions-permanently-to-the-nextcloud-container
Expand Down
2 changes: 2 additions & 0 deletions manual-install/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 2 additions & 0 deletions manual-install/sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions manual-install/update-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions nextcloud-aio-helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions php/containers.json
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down
2 changes: 2 additions & 0 deletions php/public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@
'nextcloud_mount' => $configurationManager->GetNextcloudMount(),
'nextcloud_upload_limit' => $configurationManager->GetNextcloudUploadLimit(),
'nextcloud_max_time' => $configurationManager->GetNextcloudMaxTime(),
'nextcloud_max_file_uploads' => $configurationManager->GetNextcloudMaxFileUploads(),
'nextcloud_memory_limit' => $configurationManager->GetNextcloudMemoryLimit(),
'nextcloud_chunk_size' => $configurationManager->GetNextcloudChunkSize(),
'is_dri_device_enabled' => $configurationManager->isDriDeviceEnabled(),
'is_talk_recording_enabled' => $configurationManager->isTalkRecordingEnabled(),
'is_docker_socket_proxy_enabled' => $configurationManager->isDockerSocketProxyEnabled(),
Expand Down
14 changes: 14 additions & 0 deletions php/src/Data/ConfigurationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,20 @@ public function GetNextcloudMaxTime() : string {
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}

public function GetNextcloudMaxFileUploads() : string {
$envVariableName = 'NEXTCLOUD_MAX_FILE_UPLOADS';
$configName = 'nextcloud_max_file_uploads';
$defaultValue = '200';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}

public function GetNextcloudChunkSize() : string {
$envVariableName = 'NEXTCLOUD_CHUNK_SIZE';
$configName = 'nextcloud_chunk_size';
$defaultValue = '10485760';
return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue);
}

public function GetBorgRetentionPolicy() : string {
$envVariableName = 'BORG_RETENTION_POLICY';
$configName = 'borg_retention_policy';
Expand Down
4 changes: 4 additions & 0 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,10 @@ public function CreateContainer(Container $container) : void {
$replacements[1] = $this->configurationManager->GetNextcloudMemoryLimit();
} elseif ($out[1] === 'NEXTCLOUD_MAX_TIME') {
$replacements[1] = $this->configurationManager->GetNextcloudMaxTime();
} elseif ($out[1] === 'NEXTCLOUD_MAX_FILE_UPLOADS') {
$replacements[1] = $this->configurationManager->GetNextcloudMaxFileUploads();
} elseif ($out[1] === 'NEXTCLOUD_CHUNK_SIZE') {
$replacements[1] = $this->configurationManager->GetNextcloudChunkSize();
} elseif ($out[1] === 'BORG_RETENTION_POLICY') {
$replacements[1] = $this->configurationManager->GetBorgRetentionPolicy();
} elseif ($out[1] === 'NEXTCLOUD_TRUSTED_CACERTS_DIR') {
Expand Down
4 changes: 4 additions & 0 deletions php/templates/includes/aio-config.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@

<p>Nextcloud has a timeout of {{ nextcloud_max_time }} seconds configured (important for big file uploads). See the <a href="https://github.com/nextcloud/all-in-one#how-to-adjust-the-max-execution-time-for-nextcloud">NEXTCLOUD_MAX_TIME documentation</a> on how to change this.</p>

<p>Nextcloud has a simultaneous file limit of {{ nextcloud_max_file_uploads }} files per single request. See the <a> href="https://github.com/nextcloud/all-in-one#how-to-adjust-the-php-max-file-uploads-limit-for-nextcloud">NEXTCLOUD_MAX_FILE_UPLOADS documentation</a> on how to change this.</p>

<p>Nextcloud has a chunk size of {{ nextcloud_chunk_size }} configured for file uploads. See the <a> href="https://github.com/nextcloud/all-in-one#how-to-adjust-the-file-upload-chunk-size-for-nextcloud">NEXTCLOUD_CHUNK_SIZE documentation</a> on how to change this.</p>

<p>
{% if is_dri_device_enabled == true %}
The /dev/dri device which is needed for hardware transcoding is getting attached to the Nextcloud container.
Expand Down
Loading