mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
add docker-socket-proxy as option
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
7e5fe5ac8e
commit
6685791427
14 changed files with 236 additions and 7 deletions
|
|
@ -93,6 +93,10 @@ class ContainerDefinitionFetcher
|
|||
if (!$this->configurationManager->isFulltextsearchEnabled()) {
|
||||
continue;
|
||||
}
|
||||
} elseif ($entry['container_name'] === 'nextcloud-aio-docker-socket-proxy') {
|
||||
if (!$this->configurationManager->isDockerSocketProxyEnabled()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$ports = new ContainerPorts();
|
||||
|
|
@ -195,6 +199,10 @@ class ContainerDefinitionFetcher
|
|||
if (!$this->configurationManager->isFulltextsearchEnabled()) {
|
||||
continue;
|
||||
}
|
||||
} elseif ($value === 'nextcloud-aio-docker-socket-proxy') {
|
||||
if (!$this->configurationManager->isDockerSocketProxyEnabled()) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$dependsOn[] = $value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,11 @@ class ConfigurationController
|
|||
} else {
|
||||
$this->configurationManager->SetFulltextsearchEnabledState(0);
|
||||
}
|
||||
if (isset($request->getParsedBody()['docker-socket-proxy'])) {
|
||||
$this->configurationManager->SetDockerSocketProxyEnabledState(1);
|
||||
} else {
|
||||
$this->configurationManager->SetDockerSocketProxyEnabledState(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request->getParsedBody()['delete_collabora_dictionaries'])) {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,21 @@ class ConfigurationManager
|
|||
}
|
||||
}
|
||||
|
||||
public function isDockerSocketProxyEnabled() : bool {
|
||||
$config = $this->GetConfig();
|
||||
if (isset($config['isDockerSocketProxyEnabled']) && $config['isDockerSocketProxyEnabled'] === 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function SetDockerSocketProxyEnabledState(int $value) : void {
|
||||
$config = $this->GetConfig();
|
||||
$config['isDockerSocketProxyEnabled'] = $value;
|
||||
$this->WriteConfig($config);
|
||||
}
|
||||
|
||||
public function SetClamavEnabledState(int $value) : void {
|
||||
$config = $this->GetConfig();
|
||||
$config['isClamavEnabled'] = $value;
|
||||
|
|
|
|||
|
|
@ -346,6 +346,12 @@ class DockerActionManager
|
|||
} else {
|
||||
$replacements[1] = '';
|
||||
}
|
||||
} elseif ($out[1] === 'DOCKER_SOCKET_PROXY_ENABLED') {
|
||||
if ($this->configurationManager->isDockerSocketProxyEnabled()) {
|
||||
$replacements[1] = 'yes';
|
||||
} else {
|
||||
$replacements[1] = '';
|
||||
}
|
||||
} elseif ($out[1] === 'NEXTCLOUD_UPLOAD_LIMIT') {
|
||||
$replacements[1] = $this->configurationManager->GetNextcloudUploadLimit();
|
||||
} elseif ($out[1] === 'NEXTCLOUD_MEMORY_LIMIT') {
|
||||
|
|
@ -406,7 +412,11 @@ class DockerActionManager
|
|||
$portWithProtocol = $value->port . '/' . $value->protocol;
|
||||
$exposedPorts[$portWithProtocol] = null;
|
||||
}
|
||||
$requestBody['HostConfig']['NetworkMode'] = 'nextcloud-aio';
|
||||
if ($container->GetIdentifier() !== 'nextcloud-aio-docker-socket-proxy') {
|
||||
$requestBody['HostConfig']['NetworkMode'] = 'nextcloud-aio';
|
||||
} else {
|
||||
$requestBody['HostConfig']['NetworkMode'] = 'nextcloud-aio-docker-socket-proxy-network';
|
||||
}
|
||||
} else {
|
||||
$requestBody['HostConfig']['NetworkMode'] = 'host';
|
||||
}
|
||||
|
|
@ -763,13 +773,12 @@ class DockerActionManager
|
|||
}
|
||||
}
|
||||
|
||||
private function ConnectContainerIdToNetwork(string $id, string $internalPort) : void
|
||||
private function ConnectContainerIdToNetwork(string $id, string $internalPort, string $network = 'nextcloud-aio') : void
|
||||
{
|
||||
if ($internalPort === 'host') {
|
||||
return;
|
||||
}
|
||||
|
||||
$network = 'nextcloud-aio';
|
||||
$url = $this->BuildApiUrl('networks/create');
|
||||
try {
|
||||
$this->guzzleClient->request(
|
||||
|
|
@ -777,7 +786,7 @@ class DockerActionManager
|
|||
$url,
|
||||
[
|
||||
'json' => [
|
||||
'Name' => 'nextcloud-aio',
|
||||
'Name' => $network,
|
||||
'CheckDuplicate' => true,
|
||||
'Driver' => 'bridge',
|
||||
'Internal' => false,
|
||||
|
|
@ -815,13 +824,17 @@ class DockerActionManager
|
|||
public function ConnectMasterContainerToNetwork() : void
|
||||
{
|
||||
$this->ConnectContainerIdToNetwork('nextcloud-aio-mastercontainer', '');
|
||||
$this->ConnectContainerIdToNetwork('nextcloud-aio-mastercontainer', '', 'nextcloud-aio-docker-socket-proxy-network');
|
||||
// Don't disconnect here since it slows down the initial login by a lot. Is getting done during cron.sh instead.
|
||||
// $this->DisconnectContainerFromBridgeNetwork('nextcloud-aio-mastercontainer');
|
||||
}
|
||||
|
||||
public function ConnectContainerToNetwork(Container $container) : void
|
||||
{
|
||||
$this->ConnectContainerIdToNetwork($container->GetIdentifier(), $container->GetInternalPort());
|
||||
$this->ConnectContainerIdToNetwork($container->GetIdentifier(), $container->GetInternalPort());
|
||||
if ($container->GetIdentifier() === 'nextcloud-aio-nextcloud' || $container->GetIdentifier() === 'nextcloud-aio-docker-socket-proxy') {
|
||||
$this->ConnectContainerIdToNetwork($container->GetIdentifier(), $container->GetInternalPort(), 'nextcloud-aio-docker-socket-proxy-network');
|
||||
}
|
||||
}
|
||||
|
||||
public function StopContainer(Container $container) : void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue