diff --git a/community-containers/jellyfin/jellyfin.json b/community-containers/jellyfin/jellyfin.json index f54c7b81c4a5..b469c38b6cc6 100644 --- a/community-containers/jellyfin/jellyfin.json +++ b/community-containers/jellyfin/jellyfin.json @@ -28,10 +28,7 @@ "writeable": false } ], - "devices": [ - "/dev/dri" - ], - "nvidia": true, + "enable_gpu": true, "backup_volumes": [ "nextcloud_aio_jellyfin" ] diff --git a/community-containers/memories/memories.json b/community-containers/memories/memories.json index 803156608e8d..baa5a4493bc0 100644 --- a/community-containers/memories/memories.json +++ b/community-containers/memories/memories.json @@ -24,10 +24,7 @@ "writeable": false } ], - "devices": [ - "/dev/dri" - ], - "nvidia": true, + "enable_gpu": true, "nextcloud_exec_commands": [ "php /var/www/html/occ app:install memories", "php /var/www/html/occ app:enable memories", diff --git a/community-containers/plex/plex.json b/community-containers/plex/plex.json index f20222ec44aa..322f4c81fafe 100644 --- a/community-containers/plex/plex.json +++ b/community-containers/plex/plex.json @@ -30,10 +30,7 @@ "writeable": false } ], - "devices": [ - "/dev/dri" - ], - "nvidia": true, + "enable_gpu": true, "backup_volumes": [ "nextcloud_aio_plex" ] diff --git a/php/containers-schema.json b/php/containers-schema.json index ec11f7dbeaf6..a10fd09948ad 100644 --- a/php/containers-schema.json +++ b/php/containers-schema.json @@ -160,7 +160,7 @@ "pattern": "^/dev/[a-z]+$" } }, - "nvidia": { + "enable_gpu": { "type": "boolean" }, "apparmor_unconfined": { diff --git a/php/containers.json b/php/containers.json index b771efcffb38..c7a986094acd 100644 --- a/php/containers.json +++ b/php/containers.json @@ -260,10 +260,7 @@ ], "stop_grace_period": 600, "restart": "unless-stopped", - "devices": [ - "/dev/dri" - ], - "nvidia": true, + "enable_gpu": true, "backup_volumes": [ "nextcloud_aio_nextcloud" ], diff --git a/php/src/Container/Container.php b/php/src/Container/Container.php index 22feceb60493..b30f72d60a2f 100644 --- a/php/src/Container/Container.php +++ b/php/src/Container/Container.php @@ -23,7 +23,7 @@ public function __construct( private array $secrets, /** @var string[] */ private array $devices, - private bool $nvidia, + private bool $enable_gpu, /** @var string[] */ private array $capAdd, private int $shmSize, @@ -93,8 +93,8 @@ public function GetDevices() : array { return $this->devices; } - public function CanUseNvidia() : bool { - return $this->nvidia; + public function GetGpuMode() : bool { + return $this->enable_gpu; } public function GetCapAdds() : array { diff --git a/php/src/ContainerDefinitionFetcher.php b/php/src/ContainerDefinitionFetcher.php index 9d6566b29c8a..8d04fd6df401 100644 --- a/php/src/ContainerDefinitionFetcher.php +++ b/php/src/ContainerDefinitionFetcher.php @@ -249,7 +249,7 @@ private function GetDefinition(): array $devices = $entry['devices']; } - $nvidia = $entry['nvidia'] === true; + $enable_gpu = $entry['enable_gpu'] === true; $capAdd = []; if (isset($entry['cap_add'])) { @@ -314,7 +314,7 @@ private function GetDefinition(): array $dependsOn, $secrets, $devices, - $nvidia, + $enable_gpu, $capAdd, $shmSize, $apparmorUnconfined, diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 31fa7272056a..c404c3e24cd1 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -968,33 +968,24 @@ public function GetEnabledCommunityContainers() : array { return explode(' ', $this->GetCommunityContainers()); } - private function GetEnabledDriDevice() : string { - $envVariableName = 'NEXTCLOUD_ENABLE_DRI_DEVICE'; - $configName = 'nextcloud_enable_dri_device'; + + private function GetEnabledGPUMode() : string { + $envVariableName = 'NEXTCLOUD_GPU_MODE'; + $configName = 'nextcloud_gpu_mode'; $defaultValue = ''; return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); } public function isDriDeviceEnabled() : bool { - if ($this->GetEnabledDriDevice() === 'true') { - return true; - } else { - return false; - } - } - private function GetEnabledNvidiaGPUMode() : string { - $envVariableName = 'NEXTCLOUD_NVIDIA_GPU_MODE'; - $configName = 'nextcloud_nvidia_gpu_mode'; - $defaultValue = ''; - return $this->GetEnvironmentalVariableOrConfig($envVariableName, $configName, $defaultValue); + return $this->GetEnabledGPUMode() === 'dri'; } public function isNvidiaRuntimeEnabled() : bool { - return $this->GetEnabledNvidiaGPUMode() === 'runtime'; + return $this->GetEnabledGPUMode() === 'nvidia-runtime'; } public function isNvidiaDeployEnabled() : bool { - return $this->GetEnabledNvidiaGPUMode() === 'deploy'; + return $this->GetEnabledGPUMode() === 'nvidia-deploy'; } private function GetKeepDisabledApps() : string { diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 1ca27a01ff5f..b19a95dbb652 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -481,18 +481,13 @@ public function CreateContainer(Container $container) : void { $devices = []; foreach($container->GetDevices() as $device) { - if ($device === '/dev/dri' && ! $this->configurationManager->isDriDeviceEnabled()) { - continue; - } $devices[] = ["PathOnHost" => $device, "PathInContainer" => $device, "CgroupPermissions" => "rwm"]; } - if (count($devices) > 0) { - $requestBody['HostConfig']['Devices'] = $devices; - } - if ($container->canUseNvidia()) { - if ($this->configurationManager->isNvidiaRuntimeEnabled()) { + if($this->configurationManager->isDriDeviceEnabled()) { + $devices[] = ["PathOnHost" => '/dev/dri', "PathInContainer" => '/dev/dri', "CgroupPermissions" => "rwm"]; + } elseif ($this->configurationManager->isNvidiaRuntimeEnabled()) { $requestBody['HostConfig']['Runtime'] = 'nvidia'; } elseif ($this->configurationManager->isNvidiaDeployEnabled()) { $requestBody['HostConfig']['DeviceRequests'] = [ @@ -505,6 +500,10 @@ public function CreateContainer(Container $container) : void { } } + if (count($devices) > 0) { + $requestBody['HostConfig']['Devices'] = $devices; + } + $shmSize = $container->GetShmSize(); if ($shmSize > 0) { $requestBody['HostConfig']['ShmSize'] = $shmSize; diff --git a/php/templates/includes/aio-config.twig b/php/templates/includes/aio-config.twig index f4f2741771bf..dce902021a9f 100644 --- a/php/templates/includes/aio-config.twig +++ b/php/templates/includes/aio-config.twig @@ -30,21 +30,15 @@
{% if is_dri_device_enabled == true %} - The /dev/dri device which is needed for hardware transcoding is getting attached to the Nextcloud container. - {% else %} - The /dev/dri device which is needed for hardware transcoding is not attached to the Nextcloud container. - {% endif %} - See the NEXTCLOUD_ENABLE_DRI_DEVICE documentation on how to change this.
- -- {% if is_nvidia_runtime_enabled == true %} - Nvidia runtime is enabled. + The /dev/dri device is getting attached to the Nextcloud container. + {% elseif is_nvidia_runtime_enabled == true %} + The Nvida runtime is used for the Nextcloud container. {% elseif is_nvidia_gpu_deploy_enabled == true %} - Nvidia GPU access is enabled. + The Nvidia device is getting attached to the Nextcloud container. {% else %} - Nvidia GPU access is disabled. + No GPU acceleration is enabled. It's recommended to enable hardware transcoding for better performance. {% endif %} -
+ See the NEXTCLOUD_GPU_MODE documentation on how to change this.For further documentation on AIO, refer to this page. You can use the browser search [CTRL]+[F] to search through the documentation. Additional documentation can be found here.
diff --git a/readme.md b/readme.md index 38016ce20db5..914016c2f38c 100644 --- a/readme.md +++ b/readme.md @@ -765,11 +765,33 @@ You can do so by adding `--env NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS="imagick exte ### What about the pdlib PHP extension for the facerecognition app? The [facerecognition app](https://apps.nextcloud.com/apps/facerecognition) requires the pdlib PHP extension to be installed. Unfortunately, it is not available on PECL nor via PHP core, so there is no way to add this into AIO currently. However you can use [this community container](https://github.com/nextcloud/all-in-one/tree/main/community-containers/facerecognition) in order to run facerecognition. -### How to enable hardware-transcoding for Nextcloud? +### How to enable GPU acceleration for Nextcloud? +Some container can use GPU acceleration to increase performance like [memories app](https://apps.nextcloud.com/apps/memories) allows to enable hardware transcoding for videos. + +To enable it you need to add `--env NEXTCLOUD_GPU_MODE=