Skip to content

Commit

Permalink
set NEXTCLOUD_MOUNT to rshared
Browse files Browse the repository at this point in the history
Signed-off-by: Simon L <szaimen@e.mail.de>
  • Loading branch information
szaimen committed Jul 19, 2023
1 parent f4140e1 commit 3348450
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,15 @@ public function CreateVolumes(Container $container): void
public function CreateContainer(Container $container) : void {
$volumes = [];
foreach($container->GetVolumes()->GetVolumes() as $volume) {
// NEXTCLOUD_MOUNT gets addded via bind-mount later on
if ($container->GetIdentifier() === 'nextcloud-aio-nextcloud') {
if ($volume->name === $configurationManager->GetNextcloudMount()) {
continue;
}
}

$volumeEntry = $volume->name . ':' . $volume->mountPoint;
if($volume->isWritable) {
if ($volume->isWritable) {
$volumeEntry = $volumeEntry . ':' . 'rw';
} else {
$volumeEntry = $volumeEntry . ':' . 'ro';
Expand Down Expand Up @@ -425,10 +432,11 @@ public function CreateContainer(Container $container) : void {
$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];
Expand All @@ -443,13 +451,22 @@ public function CreateContainer(Container $container) : void {
}
}
}
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 !== $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());
Expand Down

0 comments on commit 3348450

Please sign in to comment.