mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-30 07:20:09 +00:00
feat: add dnsmasq community container for LAN DNS, remove ddclient, add NC_DOMAIN Docker alias
Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/7bd0c60a-c5df-404a-a8a5-5cbb97c7a48c Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
7c5abc978d
commit
5b72d17438
@@ -60,6 +60,9 @@ readonly class DesecController {
|
||||
if (!in_array('caddy', $enabled, true)) {
|
||||
$enabled[] = 'caddy';
|
||||
}
|
||||
if (!in_array('dnsmasq', $enabled, true)) {
|
||||
$enabled[] = 'dnsmasq';
|
||||
}
|
||||
$this->configurationManager->aioCommunityContainers = $enabled;
|
||||
$this->configurationManager->commitTransaction();
|
||||
|
||||
@@ -132,7 +135,7 @@ readonly class DesecController {
|
||||
if (is_array($data) && isset($data['email'])) {
|
||||
throw new \Exception(
|
||||
'This email address is already registered at deSEC. '
|
||||
. 'Please log in at https://desec.io to retrieve your token and configure ddclient manually.',
|
||||
. 'Please log in at https://desec.io to retrieve your token and set up your domain manually.',
|
||||
);
|
||||
}
|
||||
throw new \Exception('Registration at deSEC failed (HTTP 400): ' . $body);
|
||||
|
||||
@@ -805,7 +805,7 @@ readonly class DockerActionManager {
|
||||
}
|
||||
}
|
||||
|
||||
private function ConnectContainerIdToNetwork(string $id, string $internalPort, string $network = 'nextcloud-aio', bool $createNetwork = true, string $alias = ''): void {
|
||||
private function ConnectContainerIdToNetwork(string $id, string $internalPort, string $network = 'nextcloud-aio', bool $createNetwork = true, array $aliases = []): void {
|
||||
if ($internalPort === 'host') {
|
||||
return;
|
||||
}
|
||||
@@ -837,8 +837,8 @@ readonly class DockerActionManager {
|
||||
sprintf('networks/%s/connect', $network)
|
||||
);
|
||||
$jsonPayload = ['Container' => $id];
|
||||
if ($alias !== '') {
|
||||
$jsonPayload['EndpointConfig'] = ['Aliases' => [$alias]];
|
||||
if (count($aliases) > 0) {
|
||||
$jsonPayload['EndpointConfig'] = ['Aliases' => $aliases];
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -864,17 +864,30 @@ readonly class DockerActionManager {
|
||||
}
|
||||
|
||||
public function ConnectContainerToNetwork(Container $container): void {
|
||||
$aliases = [];
|
||||
|
||||
// Add a secondary alias for domaincheck container, to keep it as similar to actual apache controller as possible.
|
||||
// If a reverse-proxy is relying on container name as hostname this allows it to operate as usual and still validate the domain
|
||||
// The domaincheck container and apache container are never supposed to be active at the same time because they use the same APACHE_PORT anyway, so this doesn't add any new constraints.
|
||||
$alias = ($container->identifier === 'nextcloud-aio-domaincheck') ? 'nextcloud-aio-apache' : '';
|
||||
if ($container->identifier === 'nextcloud-aio-domaincheck') {
|
||||
$aliases[] = 'nextcloud-aio-apache';
|
||||
}
|
||||
|
||||
$this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, alias: $alias);
|
||||
// Add NC_DOMAIN as a Docker network alias so that intra-network traffic for the Nextcloud
|
||||
// domain is forwarded directly to this container without leaving the Docker network.
|
||||
if ($container->identifier === 'nextcloud-aio-apache' || $container->identifier === 'nextcloud-aio-domaincheck') {
|
||||
$domain = $this->configurationManager->domain;
|
||||
if ($domain !== '') {
|
||||
$aliases[] = $domain;
|
||||
}
|
||||
}
|
||||
|
||||
$this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, aliases: $aliases);
|
||||
|
||||
if ($container->identifier === 'nextcloud-aio-apache' || $container->identifier === 'nextcloud-aio-domaincheck') {
|
||||
$apacheAdditionalNetwork = $this->configurationManager->getApacheAdditionalNetwork();
|
||||
if ($apacheAdditionalNetwork !== '') {
|
||||
$this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, $apacheAdditionalNetwork, false, $alias);
|
||||
$this->ConnectContainerIdToNetwork($container->identifier, $container->internalPorts, $apacheAdditionalNetwork, false, $aliases);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user