Merge pull request #3140 from nextcloud/enh/3052/add-init

add init flag to all containers
This commit is contained in:
Simon L 2023-08-17 09:39:05 +02:00 committed by GitHub
commit 5621a456f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 40 additions and 0 deletions

View file

@ -137,6 +137,9 @@
"read_only": {
"type": "boolean"
},
"init": {
"type": "boolean"
},
"tmpfs": {
"type": "array",
"items": {

View file

@ -11,6 +11,7 @@
],
"display_name": "Apache",
"image": "nextcloud/aio-apache",
"init": true,
"ports": [
{
"ip_binding": "%APACHE_IP_BINDING%",
@ -69,6 +70,7 @@
"container_name": "nextcloud-aio-database",
"display_name": "Database",
"image": "nextcloud/aio-postgresql",
"init": true,
"expose": [
"5432"
],
@ -122,6 +124,7 @@
],
"display_name": "Nextcloud",
"image": "nextcloud/aio-nextcloud",
"init": true,
"expose": [
"9000"
],
@ -218,6 +221,7 @@
"container_name": "nextcloud-aio-notify-push",
"display_name": "Notify Push",
"image": "nextcloud/aio-notify-push",
"init": true,
"expose": [
"7867"
],
@ -253,6 +257,7 @@
"container_name": "nextcloud-aio-redis",
"display_name": "Redis",
"image": "nextcloud/aio-redis",
"init": true,
"expose": [
"6379"
],
@ -283,6 +288,7 @@
"container_name": "nextcloud-aio-collabora",
"display_name": "Collabora",
"image": "nextcloud/aio-collabora",
"init": true,
"expose": [
"9980"
],
@ -311,6 +317,7 @@
"container_name": "nextcloud-aio-talk",
"display_name": "Talk",
"image": "nextcloud/aio-talk",
"init": true,
"ports": [
{
"ip_binding": "",
@ -361,6 +368,7 @@
"container_name": "nextcloud-aio-talk-recording",
"display_name": "Talk Recording",
"image": "nextcloud/aio-talk-recording",
"init": true,
"expose": [
"1234"
],
@ -392,6 +400,7 @@
{
"container_name": "nextcloud-aio-borgbackup",
"image": "nextcloud/aio-borgbackup",
"init": true,
"environment": [
"BORG_PASSWORD=%BORGBACKUP_PASSWORD%",
"BORG_MODE=%BORGBACKUP_MODE%",
@ -453,6 +462,7 @@
{
"container_name": "nextcloud-aio-watchtower",
"image": "nextcloud/aio-watchtower",
"init": true,
"environment": [
"CONTAINER_TO_UPDATE=nextcloud-aio-mastercontainer"
],
@ -468,6 +478,7 @@
{
"container_name": "nextcloud-aio-domaincheck",
"image": "nextcloud/aio-domaincheck",
"init": true,
"ports": [
{
"ip_binding": "%APACHE_IP_BINDING%",
@ -494,6 +505,7 @@
"container_name": "nextcloud-aio-clamav",
"display_name": "ClamAV",
"image": "nextcloud/aio-clamav",
"init": true,
"expose": [
"3310"
],
@ -527,6 +539,7 @@
"container_name": "nextcloud-aio-onlyoffice",
"display_name": "OnlyOffice",
"image": "nextcloud/aio-onlyoffice",
"init": true,
"expose": [
"80"
],
@ -559,6 +572,7 @@
"container_name": "nextcloud-aio-imaginary",
"display_name": "Imaginary",
"image": "nextcloud/aio-imaginary",
"init": true,
"expose": [
"9000"
],
@ -585,6 +599,7 @@
"container_name": "nextcloud-aio-fulltextsearch",
"display_name": "Fulltextsearch",
"image": "nextcloud/aio-fulltextsearch",
"init": false,
"expose": [
"9200"
],

View file

@ -32,6 +32,7 @@ class Container {
private array $nextcloudExecCommands;
private bool $readOnlyRootFs;
private array $tmpfs;
private bool $init;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -54,6 +55,7 @@ class Container {
array $nextcloudExecCommands,
bool $readOnlyRootFs,
array $tmpfs,
bool $init,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -75,6 +77,7 @@ class Container {
$this->nextcloudExecCommands = $nextcloudExecCommands;
$this->readOnlyRootFs = $readOnlyRootFs;
$this->tmpfs = $tmpfs;
$this->init = $init;
$this->dockerActionManager = $dockerActionManager;
}
@ -98,6 +101,10 @@ class Container {
return $this->readOnlyRootFs;
}
public function GetInit() : bool {
return $this->init;
}
public function GetShmSize() : int {
return $this->shmSize;
}

View file

@ -272,6 +272,11 @@ class ContainerDefinitionFetcher
$tmpfs = $entry['tmpfs'];
}
$init = true;
if (isset($entry['init'])) {
$init = $entry['init'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -292,6 +297,7 @@ class ContainerDefinitionFetcher
$nextcloudExecCommands,
$readOnlyRootFs,
$tmpfs,
$init,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -450,6 +450,8 @@ class DockerActionManager
$requestBody['HostConfig']['Tmpfs'] = $tmpfs;
}
$requestBody['HostConfig']['Init'] = $container->GetInit();
$capAdds = $container->GetCapAdds();
if (count($capAdds) > 0) {
$requestBody['HostConfig']['CapAdd'] = $capAdds;