Merge pull request #2601 from nextcloud/enh/2585/volume-mounts

set NEXTCLOUD_MOUNT to rshared
This commit is contained in:
Simon L 2023-07-20 16:07:48 +02:00 committed by GitHub
commit 00557fecd2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,9 +211,16 @@ class DockerActionManager
public function CreateContainer(Container $container) : void {
$volumes = [];
foreach($container->GetVolumes()->GetVolumes() as $volume) {
foreach ($container->GetVolumes()->GetVolumes() as $volume) {
// NEXTCLOUD_MOUNT gets added via bind-mount later on
if ($container->GetIdentifier() === 'nextcloud-aio-nextcloud') {
if ($volume->name === $this->configurationManager->GetNextcloudMount()) {
continue;
}
}
$volumeEntry = $volume->name . ':' . $volume->mountPoint;
if($volume->isWritable) {
if ($volume->isWritable) {
$volumeEntry = $volumeEntry . ':' . 'rw';
} else {
$volumeEntry = $volumeEntry . ':' . 'ro';
@ -226,7 +233,7 @@ class DockerActionManager
'Image' => $this->BuildImageName($container),
];
if(count($volumes) > 0) {
if (count($volumes) > 0) {
$requestBody['HostConfig']['Binds'] = $volumes;
}
@ -447,10 +454,11 @@ class DockerActionManager
$requestBody['HostConfig']['SecurityOpt'] = ["apparmor:unconfined"];
}
$mounts = [];
// Special things for the backup container which should not be exposed in the containers.json
if ($container->GetIdentifier() === 'nextcloud-aio-borgbackup') {
// Additional backup directories
$mounts = [];
foreach ($this->getAllBackupVolumes() as $additionalBackupVolumes) {
if ($additionalBackupVolumes !== '') {
$mounts[] = ["Type" => "volume", "Source" => $additionalBackupVolumes, "Target" => "/nextcloud_aio_volumes/" . $additionalBackupVolumes, "ReadOnly" => false];
@ -465,13 +473,22 @@ class DockerActionManager
}
}
}
if(count($mounts) > 0) {
$requestBody['HostConfig']['Mounts'] = $mounts;
}
// Special things for the talk container which should not be exposed in the containers.json
} elseif ($container->GetIdentifier() === 'nextcloud-aio-talk') {
// This is needed due to a bug in libwebsockets which cannot handle unlimited ulimits
$requestBody['HostConfig']['Ulimits'] = [["Name" => "nofile", "Hard" => 200000, "Soft" => 200000]];
// Special things for the nextcloud container which should not be exposed in the containers.json
} elseif ($container->GetIdentifier() === 'nextcloud-aio-nextcloud') {
foreach ($container->GetVolumes()->GetVolumes() as $volume) {
if ($volume->name !== $this->configurationManager->GetNextcloudMount()) {
continue;
}
$mounts[] = ["Type" => "bind", "Source" => $volume->name, "Target" => $volume->mountPoint, "ReadOnly" => !$volume->isWritable, "Propagation" => "rshared"];
}
}
if (count($mounts) > 0) {
$requestBody['HostConfig']['Mounts'] = $mounts;
}
$url = $this->BuildApiUrl('containers/create?name=' . $container->GetIdentifier());