increase shm_size for postgresql

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-03-29 10:57:44 +02:00
parent b4bd4d115d
commit d0f11028d3
5 changed files with 23 additions and 1 deletions

View file

@ -73,6 +73,9 @@
"restart": { "restart": {
"type": "string" "type": "string"
}, },
"shm_size": {
"type": "integer"
},
"secrets": { "secrets": {
"type": "array", "type": "array",
"items": { "items": {

View file

@ -74,7 +74,8 @@
"PGTZ=%TIMEZONE%" "PGTZ=%TIMEZONE%"
], ],
"stop_grace_period": 1800, "stop_grace_period": 1800,
"restart": "unless-stopped" "restart": "unless-stopped",
"shm_size": 268435456
}, },
{ {
"container_name": "nextcloud-aio-nextcloud", "container_name": "nextcloud-aio-nextcloud",

View file

@ -25,6 +25,7 @@ class Container {
private array $devices; private array $devices;
/** @var string[] */ /** @var string[] */
private array $capAdd; private array $capAdd;
private string $shmSize;
private DockerActionManager $dockerActionManager; private DockerActionManager $dockerActionManager;
public function __construct( public function __construct(
@ -41,6 +42,7 @@ class Container {
array $secrets, array $secrets,
array $devices, array $devices,
array $capAdd, array $capAdd,
string $shmSize,
DockerActionManager $dockerActionManager DockerActionManager $dockerActionManager
) { ) {
$this->identifier = $identifier; $this->identifier = $identifier;
@ -56,6 +58,7 @@ class Container {
$this->secrets = $secrets; $this->secrets = $secrets;
$this->devices = $devices; $this->devices = $devices;
$this->capAdd = $capAdd; $this->capAdd = $capAdd;
$this->shmSize = $shmSize;
$this->dockerActionManager = $dockerActionManager; $this->dockerActionManager = $dockerActionManager;
} }
@ -75,6 +78,10 @@ class Container {
return $this->restartPolicy; return $this->restartPolicy;
} }
public function GetShmSize() : string {
return $this->shmSize;
}
public function GetMaxShutdownTime() : int { public function GetMaxShutdownTime() : int {
return $this->maxShutdownTime; return $this->maxShutdownTime;
} }

View file

@ -218,6 +218,11 @@ class ContainerDefinitionFetcher
$capAdd = $entry['cap_add']; $capAdd = $entry['cap_add'];
} }
$shmSize = '';
if (isset($entry['shm_size'])) {
$shmSize = $entry['shm_size'];
}
$containers[] = new Container( $containers[] = new Container(
$entry['container_name'], $entry['container_name'],
$displayName, $displayName,
@ -232,6 +237,7 @@ class ContainerDefinitionFetcher
$secrets, $secrets,
$devices, $devices,
$capAdd, $capAdd,
$shmSize,
$this->container->get(DockerActionManager::class) $this->container->get(DockerActionManager::class)
); );
} }

View file

@ -411,6 +411,11 @@ class DockerActionManager
$requestBody['HostConfig']['Devices'] = $devices; $requestBody['HostConfig']['Devices'] = $devices;
} }
$shmSize = $container->GetShmSize();
if ($shmSize !== '') {
$requestBody['HostConfig']['ShmSize'] = $shmSize;
}
$capAdds = $container->GetCapAdds(); $capAdds = $container->GetCapAdds();
if (count($capAdds) > 0) { if (count($capAdds) > 0) {
$requestBody['HostConfig']['CapAdd'] = $capAdds; $requestBody['HostConfig']['CapAdd'] = $capAdds;