Compare commits

...

5 commits

Author SHA1 Message Date
szaimen
976db132e5 Yaml updates
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-10 12:03:42 +00:00
Simon L.
cfaf69fb58
Merge pull request #6841 from nextcloud/global-secrets
Register secrets for generation when their declarations are read
2025-09-10 13:47:58 +02:00
Simon L.
f3104bd661
Merge pull request #6846 from nextcloud/dependabot/docker/Containers/talk/nats-2.11.9-scratch
build(deps): bump nats from 2.11.8-scratch to 2.11.9-scratch in /Containers/talk
2025-09-10 09:25:59 +02:00
dependabot[bot]
f87bd7ae45
build(deps): bump nats in /Containers/talk
Bumps nats from 2.11.8-scratch to 2.11.9-scratch.

---
updated-dependencies:
- dependency-name: nats
  dependency-version: 2.11.9-scratch
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-09-10 04:21:22 +00:00
Alan Savage
29c093afae Make secrets global and init on first use.
This allows all containers to use any secret declared anywhere
in their placeholders but they will not be generated and
written to the configuration until they are used.

Signed-off-by: Alan Savage <3028205+asavageiv@users.noreply.github.com>
2025-09-09 14:59:41 -07:00
6 changed files with 17 additions and 29 deletions

View file

@ -1,5 +1,5 @@
# syntax=docker/dockerfile:latest
FROM nats:2.11.8-scratch AS nats
FROM nats:2.11.9-scratch AS nats
FROM eturnal/eturnal:1.12.1 AS eturnal
FROM strukturag/nextcloud-spreed-signaling:2.0.4 AS signaling
FROM alpine:3.22.1 AS janus

View file

@ -255,7 +255,7 @@ services:
expose:
- "9980"
environment:
- aliasgroup1=https://${NC_DOMAIN}:443
- aliasgroup1=https://${NC_DOMAIN}:443,http://nextcloud-aio-apache:23973
- extra_params=--o:ssl.enable=false --o:ssl.termination=true --o:mount_jail_tree=false --o:logging.level=warning --o:logging.level_startup=warning --o:home_mode.enable=true --o:remote_font_config.url=https://${NC_DOMAIN}/apps/richdocuments/settings/fonts.json --o:net.post_allow.host[0]=.+
- dictionaries=${COLLABORA_DICTIONARIES}
- TZ=${TIMEZONE}

View file

@ -19,8 +19,6 @@ readonly class Container {
private ContainerEnvironmentVariables $containerEnvironmentVariables,
/** @var string[] */
private array $dependsOn,
/** @var string[] */
private array $secrets,
private string $uiSecret,
/** @var string[] */
private array $devices,
@ -82,10 +80,6 @@ readonly class Container {
return $this->maxShutdownTime;
}
public function GetSecrets() : array {
return $this->secrets;
}
public function GetUiSecret() : string {
return $this->dockerActionManager->GetAndGenerateSecretWrapper($this->uiSecret);
}

View file

@ -239,9 +239,12 @@ readonly class ContainerDefinitionFetcher {
$internalPort = $entry['internal_port'];
}
$secrets = [];
if (isset($entry['secrets'])) {
$secrets = $entry['secrets'];
// All secrets are registered with the configuration when they
// are discovered so they can be later generated at time-of-use.
foreach ($entry['secrets'] as $secret) {
$this->configurationManager->RegisterSecret($secret);
}
}
$uiSecret = '';
@ -320,7 +323,6 @@ readonly class ContainerDefinitionFetcher {
$volumes,
$variables,
$dependsOn,
$secrets,
$uiSecret,
$devices,
$enableNvidiaGpu,

View file

@ -7,6 +7,8 @@ use AIO\Controller\DockerController;
class ConfigurationManager
{
private array $secrets = [];
public function GetConfig() : array
{
if(file_exists(DataConst::GetConfigFile()))
@ -50,13 +52,15 @@ class ConfigurationManager
return $config['secrets'][$secretId];
}
public function GetSecret(string $secretId) : string {
$config = $this->GetConfig();
if(!isset($config['secrets'][$secretId])) {
$config['secrets'][$secretId] = "";
public function GetRegisteredSecret(string $secretId) : string {
if ($this->secrets[$secretId]) {
return $this->GetAndGenerateSecret($secretId);
}
throw new \Exception("The secret " . $secretId . " was not registered. Please check if it is defined in secrets of containers.json.");
}
return $config['secrets'][$secretId];
public function RegisterSecret(string $secretId) : void {
$this->secrets[$secretId] = true;
}
private function DoubleSafeBackupSecret(string $borgBackupPassword) : void {

View file

@ -221,10 +221,6 @@ readonly class DockerActionManager {
$requestBody['HostConfig']['Binds'] = $volumes;
}
foreach ($container->GetSecrets() as $secret) {
$this->configurationManager->GetAndGenerateSecret($secret);
}
$aioVariables = $container->GetAioVariables()->GetVariables();
foreach ($aioVariables as $variable) {
$config = $this->configurationManager->GetConfig();
@ -566,18 +562,10 @@ readonly class DockerActionManager {
// Allow to get local ip-address of caddy container and add it to trusted proxies automatically
'CADDY_IP_ADDRESS' => in_array('caddy', $this->configurationManager->GetEnabledCommunityContainers(), true) ? gethostbyname('nextcloud-aio-caddy') : '',
'WHITEBOARD_ENABLED' => $this->configurationManager->isWhiteboardEnabled() ? 'yes' : '',
default => $this->getSecretOrThrow($placeholder),
default => $this->configurationManager->GetRegisteredSecret($placeholder),
};
}
private function getSecretOrThrow(string $secretName): string {
$secret = $this->configurationManager->GetSecret($secretName);
if ($secret === "") {
throw new \Exception("The secret " . $secretName . " is empty. Cannot substitute its value. Please check if it is defined in secrets of containers.json.");
}
return $secret;
}
private function isContainerUpdateAvailable(string $id): string {
$container = $this->containerDefinitionFetcher->GetContainerById($id);