mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
Merge pull request #2641 from nextcloud/enh/2506/allow-to-specify-read-only
allow to specify read_only root FS in containers definition
This commit is contained in:
commit
68f64397ea
4 changed files with 18 additions and 0 deletions
|
|
@ -134,6 +134,9 @@
|
||||||
"pattern": "^nextcloud-aio$"
|
"pattern": "^nextcloud-aio$"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"read_only": {
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
"volumes": {
|
"volumes": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ class Container {
|
||||||
/** @var string[] */
|
/** @var string[] */
|
||||||
private array $backupVolumes;
|
private array $backupVolumes;
|
||||||
private array $nextcloudExecCommands;
|
private array $nextcloudExecCommands;
|
||||||
|
private bool $readOnlyRootFs;
|
||||||
private DockerActionManager $dockerActionManager;
|
private DockerActionManager $dockerActionManager;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
|
@ -50,6 +51,7 @@ class Container {
|
||||||
bool $apparmorUnconfined,
|
bool $apparmorUnconfined,
|
||||||
array $backupVolumes,
|
array $backupVolumes,
|
||||||
array $nextcloudExecCommands,
|
array $nextcloudExecCommands,
|
||||||
|
bool $readOnlyRootFs,
|
||||||
DockerActionManager $dockerActionManager
|
DockerActionManager $dockerActionManager
|
||||||
) {
|
) {
|
||||||
$this->identifier = $identifier;
|
$this->identifier = $identifier;
|
||||||
|
|
@ -69,6 +71,7 @@ class Container {
|
||||||
$this->apparmorUnconfined = $apparmorUnconfined;
|
$this->apparmorUnconfined = $apparmorUnconfined;
|
||||||
$this->backupVolumes = $backupVolumes;
|
$this->backupVolumes = $backupVolumes;
|
||||||
$this->nextcloudExecCommands = $nextcloudExecCommands;
|
$this->nextcloudExecCommands = $nextcloudExecCommands;
|
||||||
|
$this->readOnlyRootFs = $readOnlyRootFs;
|
||||||
$this->dockerActionManager = $dockerActionManager;
|
$this->dockerActionManager = $dockerActionManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,6 +91,10 @@ class Container {
|
||||||
return $this->restartPolicy;
|
return $this->restartPolicy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function GetReadOnlySetting() : bool {
|
||||||
|
return $this->readOnlyRootFs;
|
||||||
|
}
|
||||||
|
|
||||||
public function GetShmSize() : int {
|
public function GetShmSize() : int {
|
||||||
return $this->shmSize;
|
return $this->shmSize;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,6 +262,11 @@ class ContainerDefinitionFetcher
|
||||||
$nextcloudExecCommands = $entry['nextcloud_exec_commands'];
|
$nextcloudExecCommands = $entry['nextcloud_exec_commands'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$readOnlyRootFs = false;
|
||||||
|
if (isset($entry['read_only'])) {
|
||||||
|
$readOnlyRootFs = $entry['read_only'];
|
||||||
|
}
|
||||||
|
|
||||||
$containers[] = new Container(
|
$containers[] = new Container(
|
||||||
$entry['container_name'],
|
$entry['container_name'],
|
||||||
$displayName,
|
$displayName,
|
||||||
|
|
@ -280,6 +285,7 @@ class ContainerDefinitionFetcher
|
||||||
$apparmorUnconfined,
|
$apparmorUnconfined,
|
||||||
$backupVolumes,
|
$backupVolumes,
|
||||||
$nextcloudExecCommands,
|
$nextcloudExecCommands,
|
||||||
|
$readOnlyRootFs,
|
||||||
$this->container->get(DockerActionManager::class)
|
$this->container->get(DockerActionManager::class)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -384,6 +384,8 @@ class DockerActionManager
|
||||||
|
|
||||||
$requestBody['HostConfig']['RestartPolicy']['Name'] = $container->GetRestartPolicy();
|
$requestBody['HostConfig']['RestartPolicy']['Name'] = $container->GetRestartPolicy();
|
||||||
|
|
||||||
|
$requestBody['HostConfig']['ReadonlyRootfs'] = $container->GetReadOnlySetting();
|
||||||
|
|
||||||
$exposedPorts = [];
|
$exposedPorts = [];
|
||||||
if ($container->GetInternalPort() !== 'host') {
|
if ($container->GetInternalPort() !== 'host') {
|
||||||
foreach($container->GetPorts()->GetPorts() as $value) {
|
foreach($container->GetPorts()->GetPorts() as $value) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue