Merge pull request #1595 from nextcloud/enh/noid/improve-container-definition

rename values of containers definition to match docker-compose values
This commit is contained in:
Simon L 2022-12-29 10:27:05 +01:00 committed by GitHub
commit 2983904697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 155 additions and 208 deletions

View file

@ -5,11 +5,11 @@ sed -i 's|","location":"|:|g' /tmp/containers.json
sed -i 's|","writeable":false|:ro"|g' /tmp/containers.json sed -i 's|","writeable":false|:ro"|g' /tmp/containers.json
sed -i 's|","writeable":true|:rw"|g' /tmp/containers.json sed -i 's|","writeable":true|:rw"|g' /tmp/containers.json
OUTPUT="$(cat /tmp/containers.json)" OUTPUT="$(cat /tmp/containers.json)"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[].internalPorts)')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[].internal_port)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[].secrets)')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[].secrets)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-watchtower"))')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-watchtower"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-domaincheck"))')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-domaincheck"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-borgbackup"))')" OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-borgbackup"))')"
snap install yq snap install yq
mkdir -p ./manual-install mkdir -p ./manual-install
@ -17,16 +17,9 @@ echo "$OUTPUT" | yq -P > ./manual-install/containers.yml
cd manual-install || exit cd manual-install || exit
sed -i "s|'||g" containers.yml sed -i "s|'||g" containers.yml
sed -i 's|production:|services:|' containers.yml sed -i '/display_name:/d' containers.yml
sed -i 's|- identifier:| container_name:|' containers.yml
sed -i 's|restartPolicy:|restart:|' containers.yml
sed -i 's|environmentVariables:|environment:|' containers.yml
sed -i '/displayName:/d' containers.yml
sed -i 's|maxShutdownTime:|stop_grace_period:|' containers.yml
sed -i '/stop_grace_period:/s/$/s/' containers.yml sed -i '/stop_grace_period:/s/$/s/' containers.yml
sed -i 's|containerName:|image:|' containers.yml
sed -i '/: \[\]/d' containers.yml sed -i '/: \[\]/d' containers.yml
sed -i 's|dependsOn:|depends_on:|' containers.yml
sed -i 's|- name: |- |' containers.yml sed -i 's|- name: |- |' containers.yml
TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)" TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)"

View file

@ -4,41 +4,38 @@
"additionalProperties": false, "additionalProperties": false,
"minProperties": 1, "minProperties": 1,
"properties": { "properties": {
"production": { "services": {
"type": "array", "type": "array",
"items": { "items": {
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"minProperties": 11, "minProperties": 11,
"properties": { "properties": {
"containerName": { "image": {
"type": "string" "type": "string"
}, },
"dependsOn": { "depends_on": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"displayName": { "display_name": {
"type": "string" "type": "string"
}, },
"environmentVariables": { "environment": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string"
} }
}, },
"identifier": { "container_name": {
"type": "string" "type": "string"
}, },
"internalPorts": { "internal_port": {
"type": "array",
"items": {
"type": "string" "type": "string"
}
}, },
"maxShutdownTime": { "stop_grace_period": {
"type": "integer" "type": "integer"
}, },
"ports": { "ports": {
@ -47,11 +44,14 @@
"type": "string" "type": "string"
} }
}, },
"restartPolicy": { "restart": {
"type": "string" "type": "string"
}, },
"secrets": { "secrets": {
"type": "array" "type": "array",
"items": {
"type": "string"
}
}, },
"volumes": { "volumes": {
"type": "array", "type": "array",

View file

@ -1,23 +1,21 @@
{ {
"production": [ "services": [
{ {
"identifier": "nextcloud-aio-apache", "container_name": "nextcloud-aio-apache",
"dependsOn": [ "depends_on": [
"nextcloud-aio-onlyoffice", "nextcloud-aio-onlyoffice",
"nextcloud-aio-collabora", "nextcloud-aio-collabora",
"nextcloud-aio-talk", "nextcloud-aio-talk",
"nextcloud-aio-nextcloud" "nextcloud-aio-nextcloud"
], ],
"displayName": "Apache", "display_name": "Apache",
"containerName": "nextcloud/aio-apache", "image": "nextcloud/aio-apache",
"ports": [ "ports": [
"%APACHE_PORT%/tcp" "%APACHE_PORT%/tcp"
], ],
"internalPorts": [ "internal_port": "%APACHE_PORT%",
"%APACHE_PORT%"
],
"secrets": [], "secrets": [],
"environmentVariables": [ "environment": [
"NC_DOMAIN=%NC_DOMAIN%", "NC_DOMAIN=%NC_DOMAIN%",
"NEXTCLOUD_HOST=nextcloud-aio-nextcloud", "NEXTCLOUD_HOST=nextcloud-aio-nextcloud",
"COLLABORA_HOST=nextcloud-aio-collabora", "COLLABORA_HOST=nextcloud-aio-collabora",
@ -40,18 +38,16 @@
"writeable": true "writeable": true
} }
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-database", "container_name": "nextcloud-aio-database",
"dependsOn": [], "depends_on": [],
"displayName": "Database", "display_name": "Database",
"containerName": "nextcloud/aio-postgresql", "image": "nextcloud/aio-postgresql",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "5432",
"5432"
],
"secrets": [ "secrets": [
"DATABASE_PASSWORD" "DATABASE_PASSWORD"
], ],
@ -67,31 +63,29 @@
"writeable": true "writeable": true
} }
], ],
"environmentVariables": [ "environment": [
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%", "POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
"POSTGRES_DB=nextcloud_database", "POSTGRES_DB=nextcloud_database",
"POSTGRES_USER=nextcloud", "POSTGRES_USER=nextcloud",
"TZ=%TIMEZONE%", "TZ=%TIMEZONE%",
"PGTZ=%TIMEZONE%" "PGTZ=%TIMEZONE%"
], ],
"maxShutdownTime": 1800, "stop_grace_period": 1800,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-nextcloud", "container_name": "nextcloud-aio-nextcloud",
"dependsOn": [ "depends_on": [
"nextcloud-aio-database", "nextcloud-aio-database",
"nextcloud-aio-redis", "nextcloud-aio-redis",
"nextcloud-aio-clamav", "nextcloud-aio-clamav",
"nextcloud-aio-fulltextsearch", "nextcloud-aio-fulltextsearch",
"nextcloud-aio-imaginary" "nextcloud-aio-imaginary"
], ],
"displayName": "Nextcloud", "display_name": "Nextcloud",
"containerName": "nextcloud/aio-nextcloud", "image": "nextcloud/aio-nextcloud",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "9000",
"9000"
],
"secrets": [ "secrets": [
"DATABASE_PASSWORD", "DATABASE_PASSWORD",
"REDIS_PASSWORD", "REDIS_PASSWORD",
@ -121,7 +115,7 @@
"writeable": false "writeable": false
} }
], ],
"environmentVariables": [ "environment": [
"POSTGRES_HOST=nextcloud-aio-database", "POSTGRES_HOST=nextcloud-aio-database",
"POSTGRES_PASSWORD=%DATABASE_PASSWORD%", "POSTGRES_PASSWORD=%DATABASE_PASSWORD%",
"POSTGRES_DB=nextcloud_database", "POSTGRES_DB=nextcloud_database",
@ -162,19 +156,17 @@
"ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%", "ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%",
"ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%" "ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%"
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-redis", "container_name": "nextcloud-aio-redis",
"dependsOn": [], "depends_on": [],
"displayName": "Redis", "display_name": "Redis",
"containerName": "nextcloud/aio-redis", "image": "nextcloud/aio-redis",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "6379",
"6379" "environment": [
],
"environmentVariables": [
"REDIS_HOST_PASSWORD=%REDIS_PASSWORD%", "REDIS_HOST_PASSWORD=%REDIS_PASSWORD%",
"TZ=%TIMEZONE%" "TZ=%TIMEZONE%"
], ],
@ -189,19 +181,17 @@
"REDIS_PASSWORD", "REDIS_PASSWORD",
"ONLYOFFICE_SECRET" "ONLYOFFICE_SECRET"
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-collabora", "container_name": "nextcloud-aio-collabora",
"dependsOn": [], "depends_on": [],
"displayName": "Collabora", "display_name": "Collabora",
"containerName": "nextcloud/aio-collabora", "image": "nextcloud/aio-collabora",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "9980",
"9980" "environment": [
],
"environmentVariables": [
"aliasgroup1=https://%NC_DOMAIN%:443", "aliasgroup1=https://%NC_DOMAIN%:443",
"extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:logging.level=warning --o:home_mode.enable=true %COLLABORA_SECCOMP_POLICY%", "extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:logging.level=warning --o:home_mode.enable=true %COLLABORA_SECCOMP_POLICY%",
"dictionaries=%COLLABORA_DICTIONARIES%", "dictionaries=%COLLABORA_DICTIONARIES%",
@ -215,22 +205,20 @@
} }
], ],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-talk", "container_name": "nextcloud-aio-talk",
"dependsOn": [], "depends_on": [],
"displayName": "Talk", "display_name": "Talk",
"containerName": "nextcloud/aio-talk", "image": "nextcloud/aio-talk",
"ports": [ "ports": [
"%TALK_PORT%/tcp", "%TALK_PORT%/tcp",
"%TALK_PORT%/udp" "%TALK_PORT%/udp"
], ],
"internalPorts": [ "internal_port": "%TALK_PORT%",
"%TALK_PORT%" "environment": [
],
"environmentVariables": [
"NC_DOMAIN=%NC_DOMAIN%", "NC_DOMAIN=%NC_DOMAIN%",
"TURN_SECRET=%TURN_SECRET%", "TURN_SECRET=%TURN_SECRET%",
"SIGNALING_SECRET=%SIGNALING_SECRET%", "SIGNALING_SECRET=%SIGNALING_SECRET%",
@ -244,17 +232,17 @@
"SIGNALING_SECRET", "SIGNALING_SECRET",
"JANUS_API_KEY" "JANUS_API_KEY"
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-borgbackup", "container_name": "nextcloud-aio-borgbackup",
"dependsOn": [], "depends_on": [],
"displayName": "Borgbackup", "display_name": "Borgbackup",
"containerName": "nextcloud/aio-borgbackup", "image": "nextcloud/aio-borgbackup",
"ports": [], "ports": [],
"internalPorts": [], "internal_port": "",
"environmentVariables": [ "environment": [
"BORG_PASSWORD=%BORGBACKUP_PASSWORD%", "BORG_PASSWORD=%BORGBACKUP_PASSWORD%",
"BORG_MODE=%BORGBACKUP_MODE%", "BORG_MODE=%BORGBACKUP_MODE%",
"SELECTED_RESTORE_TIME=%SELECTED_RESTORE_TIME%", "SELECTED_RESTORE_TIME=%SELECTED_RESTORE_TIME%",
@ -317,17 +305,17 @@
"secrets": [ "secrets": [
"BORGBACKUP_PASSWORD" "BORGBACKUP_PASSWORD"
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "" "restart": ""
}, },
{ {
"identifier": "nextcloud-aio-watchtower", "container_name": "nextcloud-aio-watchtower",
"dependsOn": [], "depends_on": [],
"displayName": "Watchtower", "display_name": "Watchtower",
"containerName": "nextcloud/aio-watchtower", "image": "nextcloud/aio-watchtower",
"ports": [], "ports": [],
"internalPorts": [], "internal_port": "",
"environmentVariables": [ "environment": [
"CONTAINER_TO_UPDATE=nextcloud-aio-mastercontainer" "CONTAINER_TO_UPDATE=nextcloud-aio-mastercontainer"
], ],
"volumes": [ "volumes": [
@ -338,19 +326,19 @@
} }
], ],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "" "restart": ""
}, },
{ {
"dependsOn": [], "depends_on": [],
"identifier": "nextcloud-aio-domaincheck", "container_name": "nextcloud-aio-domaincheck",
"displayName": "Domaincheck", "display_name": "Domaincheck",
"containerName": "nextcloud/aio-domaincheck", "image": "nextcloud/aio-domaincheck",
"ports": [ "ports": [
"%APACHE_PORT%/tcp" "%APACHE_PORT%/tcp"
], ],
"internalPorts": [], "internal_port": "",
"environmentVariables": [ "environment": [
"INSTANCE_ID=%INSTANCE_ID%", "INSTANCE_ID=%INSTANCE_ID%",
"APACHE_PORT=%APACHE_PORT%" "APACHE_PORT=%APACHE_PORT%"
], ],
@ -358,19 +346,17 @@
"secrets": [ "secrets": [
"INSTANCE_ID" "INSTANCE_ID"
], ],
"maxShutdownTime": 1, "stop_grace_period": 1,
"restartPolicy": "" "restart": ""
}, },
{ {
"identifier": "nextcloud-aio-clamav", "container_name": "nextcloud-aio-clamav",
"dependsOn": [], "depends_on": [],
"displayName": "ClamAV", "display_name": "ClamAV",
"containerName": "nextcloud/aio-clamav", "image": "nextcloud/aio-clamav",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "3310",
"3310" "environment": [
],
"environmentVariables": [
"TZ=%TIMEZONE%", "TZ=%TIMEZONE%",
"CLAMD_STARTUP_TIMEOUT=90" "CLAMD_STARTUP_TIMEOUT=90"
], ],
@ -382,19 +368,17 @@
} }
], ],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-onlyoffice", "container_name": "nextcloud-aio-onlyoffice",
"dependsOn": [], "depends_on": [],
"displayName": "OnlyOffice", "display_name": "OnlyOffice",
"containerName": "nextcloud/aio-onlyoffice", "image": "nextcloud/aio-onlyoffice",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "80",
"80" "environment": [
],
"environmentVariables": [
"TZ=%TIMEZONE%", "TZ=%TIMEZONE%",
"JWT_ENABLED=true", "JWT_ENABLED=true",
"JWT_HEADER=AuthorizationJwt", "JWT_HEADER=AuthorizationJwt",
@ -410,36 +394,32 @@
"secrets": [ "secrets": [
"ONLYOFFICE_SECRET" "ONLYOFFICE_SECRET"
], ],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-imaginary", "container_name": "nextcloud-aio-imaginary",
"dependsOn": [], "depends_on": [],
"displayName": "Imaginary", "display_name": "Imaginary",
"containerName": "nextcloud/aio-imaginary", "image": "nextcloud/aio-imaginary",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "9000",
"9000" "environment": [
],
"environmentVariables": [
"TZ=%TIMEZONE%" "TZ=%TIMEZONE%"
], ],
"volumes": [], "volumes": [],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
}, },
{ {
"identifier": "nextcloud-aio-fulltextsearch", "container_name": "nextcloud-aio-fulltextsearch",
"dependsOn": [], "depends_on": [],
"displayName": "Fulltextsearch", "display_name": "Fulltextsearch",
"containerName": "nextcloud/aio-fulltextsearch", "image": "nextcloud/aio-fulltextsearch",
"ports": [], "ports": [],
"internalPorts": [ "internal_port": "9200",
"9200" "environment": [
],
"environmentVariables": [
"TZ=%TIMEZONE%", "TZ=%TIMEZONE%",
"discovery.type=single-node", "discovery.type=single-node",
"ES_JAVA_OPTS=-Xms1024M -Xmx1024M" "ES_JAVA_OPTS=-Xms1024M -Xmx1024M"
@ -452,8 +432,8 @@
} }
], ],
"secrets": [], "secrets": [],
"maxShutdownTime": 10, "stop_grace_period": 10,
"restartPolicy": "unless-stopped" "restart": "unless-stopped"
} }
] ]
} }

View file

@ -46,7 +46,7 @@
<code>$internalPort</code> <code>$internalPort</code>
</InvalidScalarArgument> </InvalidScalarArgument>
<RedundantCondition occurrences="1"> <RedundantCondition occurrences="1">
<code>$container-&gt;GetInternalPorts() !== null</code> <code>$container-&gt;GetInternalPort() !== null</code>
</RedundantCondition> </RedundantCondition>
</file> </file>
<file src="src/Twig/ClassExtension.php"> <file src="src/Twig/ClassExtension.php">

View file

@ -14,7 +14,7 @@ class Container {
private string $restartPolicy; private string $restartPolicy;
private int $maxShutdownTime; private int $maxShutdownTime;
private ContainerPorts $ports; private ContainerPorts $ports;
private ContainerInternalPorts $internalPorts; private string $internalPorts;
private ContainerVolumes $volumes; private ContainerVolumes $volumes;
private ContainerEnvironmentVariables $containerEnvironmentVariables; private ContainerEnvironmentVariables $containerEnvironmentVariables;
/** @var string[] */ /** @var string[] */
@ -30,7 +30,7 @@ class Container {
string $restartPolicy, string $restartPolicy,
int $maxShutdownTime, int $maxShutdownTime,
ContainerPorts $ports, ContainerPorts $ports,
ContainerInternalPorts $internalPorts, string $internalPorts,
ContainerVolumes $volumes, ContainerVolumes $volumes,
ContainerEnvironmentVariables $containerEnvironmentVariables, ContainerEnvironmentVariables $containerEnvironmentVariables,
array $dependsOn, array $dependsOn,
@ -79,7 +79,7 @@ class Container {
return $this->ports; return $this->ports;
} }
public function GetInternalPorts() : ContainerInternalPorts { public function GetInternalPort() : string {
return $this->internalPorts; return $this->internalPorts;
} }

View file

@ -1,19 +0,0 @@
<?php
namespace AIO\Container;
class ContainerInternalPorts {
/** @var string[] */
private array $internalPorts = [];
public function AddInternalPort(string $internalPort) : void {
$this->internalPorts[] = $internalPort;
}
/**
* @return string[]
*/
public function GetInternalPorts() : array {
return $this->internalPorts;
}
}

View file

@ -5,7 +5,6 @@ namespace AIO;
use AIO\Container\Container; use AIO\Container\Container;
use AIO\Container\ContainerEnvironmentVariables; use AIO\Container\ContainerEnvironmentVariables;
use AIO\Container\ContainerPorts; use AIO\Container\ContainerPorts;
use AIO\Container\ContainerInternalPorts;
use AIO\Container\ContainerVolume; use AIO\Container\ContainerVolume;
use AIO\Container\ContainerVolumes; use AIO\Container\ContainerVolumes;
use AIO\Container\State\RunningState; use AIO\Container\State\RunningState;
@ -48,28 +47,28 @@ class ContainerDefinitionFetcher
$data = json_decode(file_get_contents(__DIR__ . '/../containers.json'), true); $data = json_decode(file_get_contents(__DIR__ . '/../containers.json'), true);
$containers = []; $containers = [];
foreach ($data['production'] as $entry) { foreach ($data['services'] as $entry) {
if ($entry['identifier'] === 'nextcloud-aio-clamav') { if ($entry['container_name'] === 'nextcloud-aio-clamav') {
if (!$this->configurationManager->isClamavEnabled()) { if (!$this->configurationManager->isClamavEnabled()) {
continue; continue;
} }
} elseif ($entry['identifier'] === 'nextcloud-aio-onlyoffice') { } elseif ($entry['container_name'] === 'nextcloud-aio-onlyoffice') {
if (!$this->configurationManager->isOnlyofficeEnabled()) { if (!$this->configurationManager->isOnlyofficeEnabled()) {
continue; continue;
} }
} elseif ($entry['identifier'] === 'nextcloud-aio-collabora') { } elseif ($entry['container_name'] === 'nextcloud-aio-collabora') {
if (!$this->configurationManager->isCollaboraEnabled()) { if (!$this->configurationManager->isCollaboraEnabled()) {
continue; continue;
} }
} elseif ($entry['identifier'] === 'nextcloud-aio-talk') { } elseif ($entry['container_name'] === 'nextcloud-aio-talk') {
if (!$this->configurationManager->isTalkEnabled()) { if (!$this->configurationManager->isTalkEnabled()) {
continue; continue;
} }
} elseif ($entry['identifier'] === 'nextcloud-aio-imaginary') { } elseif ($entry['container_name'] === 'nextcloud-aio-imaginary') {
if (!$this->configurationManager->isImaginaryEnabled()) { if (!$this->configurationManager->isImaginaryEnabled()) {
continue; continue;
} }
} elseif ($entry['identifier'] === 'nextcloud-aio-fulltextsearch') { } elseif ($entry['container_name'] === 'nextcloud-aio-fulltextsearch') {
if (!$this->configurationManager->isFulltextsearchEnabled()) { if (!$this->configurationManager->isFulltextsearchEnabled()) {
continue; continue;
} }
@ -87,14 +86,10 @@ class ContainerDefinitionFetcher
$ports->AddPort($port); $ports->AddPort($port);
} }
$internalPorts = new ContainerInternalPorts(); if($entry['internal_port'] === '%APACHE_PORT%') {
foreach ($entry['internalPorts'] as $internalPort) { $entry['internal_port'] = $this->configurationManager->GetApachePort();
if($internalPort === '%APACHE_PORT%') { } elseif($entry['internal_port'] === '%TALK_PORT%') {
$internalPort = $this->configurationManager->GetApachePort(); $entry['internal_port'] = $this->configurationManager->GetTalkPort();
} elseif($internalPort === '%TALK_PORT%') {
$internalPort = $this->configurationManager->GetTalkPort();
}
$internalPorts->AddInternalPort($internalPort);
} }
$volumes = new ContainerVolumes(); $volumes = new ContainerVolumes();
@ -142,7 +137,7 @@ class ContainerDefinitionFetcher
} }
$dependsOn = []; $dependsOn = [];
foreach ($entry['dependsOn'] as $value) { foreach ($entry['depends_on'] as $value) {
if ($value === 'nextcloud-aio-clamav') { if ($value === 'nextcloud-aio-clamav') {
if (!$this->configurationManager->isClamavEnabled()) { if (!$this->configurationManager->isClamavEnabled()) {
continue; continue;
@ -172,18 +167,18 @@ class ContainerDefinitionFetcher
} }
$variables = new ContainerEnvironmentVariables(); $variables = new ContainerEnvironmentVariables();
foreach ($entry['environmentVariables'] as $value) { foreach ($entry['environment'] as $value) {
$variables->AddVariable($value); $variables->AddVariable($value);
} }
$containers[] = new Container( $containers[] = new Container(
$entry['identifier'], $entry['container_name'],
$entry['displayName'], $entry['display_name'],
$entry['containerName'], $entry['image'],
$entry['restartPolicy'], $entry['restart'],
$entry['maxShutdownTime'], $entry['stop_grace_period'],
$ports, $ports,
$internalPorts, $entry['internal_port'],
$volumes, $volumes,
$variables, $variables,
$dependsOn, $dependsOn,

View file

@ -124,16 +124,14 @@ class DockerActionManager
} }
$containerName = $container->GetIdentifier(); $containerName = $container->GetIdentifier();
if ($container->GetInternalPorts() !== null) { if ($container->GetInternalPort() !== "") {
foreach($container->GetInternalPorts()->GetInternalPorts() as $internalPort) { $connection = @fsockopen($containerName, (int)$container->GetInternalPort(), $errno, $errstr, 0.1);
$connection = @fsockopen($containerName, $internalPort, $errno, $errstr, 0.1);
if ($connection) { if ($connection) {
fclose($connection); fclose($connection);
return new RunningState(); return new RunningState();
} else { } else {
return new StartingState(); return new StartingState();
} }
}
} else { } else {
return new RunningState(); return new RunningState();
} }