feat: set default cpuShares to 1024 in ContainerDefinitionFetcher

Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/d051ae44-c6c5-476d-9217-425945116a19

Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-05-12 11:48:01 +00:00
committed by GitHub
parent 42b0d661c8
commit b697863f5f
9 changed files with 41 additions and 17 deletions

View File

@@ -141,6 +141,9 @@
"shm_size": {
"type": "integer"
},
"cpu_shares": {
"type": "integer"
},
"secrets": {
"type": "array",
"items": {

View File

@@ -81,7 +81,8 @@
],
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-database",
@@ -138,7 +139,8 @@
],
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-nextcloud",
@@ -280,7 +282,8 @@
],
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-notify-push",
@@ -321,7 +324,8 @@
"read_only": true,
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-redis",
@@ -363,7 +367,8 @@
"read_only": true,
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-collabora",
@@ -609,7 +614,8 @@
"tmpfs": [
"/tmp",
"/nextcloud_aio_volumes"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-watchtower",
@@ -632,7 +638,8 @@
"read_only": true,
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-domaincheck",
@@ -877,7 +884,8 @@
],
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-harp",
@@ -918,7 +926,8 @@
],
"cap_drop": [
"NET_RAW"
]
],
"cpu_shares": 2048
},
{
"container_name": "nextcloud-aio-whiteboard",

View File

@@ -28,6 +28,7 @@ readonly class Container {
/** @var string[] */
public array $capAdd,
public int $shmSize,
public int $cpuShares,
public bool $apparmorUnconfined,
/** @var string[] */
public array $backupVolumes,

View File

@@ -303,6 +303,11 @@ readonly class ContainerDefinitionFetcher {
$shmSize = $entry['shm_size'];
}
$cpuShares = 1024;
if (isset($entry['cpu_shares'])) {
$cpuShares = $entry['cpu_shares'];
}
$apparmorUnconfined = false;
if (isset($entry['apparmor_unconfined'])) {
$apparmorUnconfined = $entry['apparmor_unconfined'];
@@ -361,6 +366,7 @@ readonly class ContainerDefinitionFetcher {
$enableNvidiaGpu,
$capAdd,
$shmSize,
$cpuShares,
$apparmorUnconfined,
$backupVolumes,
$nextcloudExecCommands,

View File

@@ -374,6 +374,11 @@ readonly class DockerActionManager {
$requestBody['HostConfig']['ShmSize'] = $shmSize;
}
$cpuShares = $container->cpuShares;
if ($cpuShares > 0) {
$requestBody['HostConfig']['CpuShares'] = $cpuShares;
}
$tmpfs = [];
foreach ($container->tmpfs as $tmp) {
$mode = "";