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

set NEXTCLOUD_MOUNT to rshared #2601

Merged
merged 1 commit into from
Jul 20, 2023
Merged
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
31 changes: 24 additions & 7 deletions php/src/Docker/DockerActionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,16 @@ public function CreateVolumes(Container $container): void

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';
Expand All @@ -226,7 +233,7 @@ public function CreateContainer(Container $container) : void {
'Image' => $this->BuildImageName($container),
];

if(count($volumes) > 0) {
if (count($volumes) > 0) {
$requestBody['HostConfig']['Binds'] = $volumes;
}

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 !== $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());
Expand Down