Compare commits

...

23 Commits

Author SHA1 Message Date
Simon L.
a647d10bf0 Merge pull request #5401 from nextcloud/nextcloud-container-update
Nextcloud dependency update
2024-10-10 12:56:28 +02:00
szaimen
ce29c17ca4 nextcloud-update automated change
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-10 10:52:10 +00:00
Simon L.
1050095d89 Merge pull request #5398 from nextcloud/enn/noid/adjust-config
nginx: adjust configs
2024-10-09 15:42:14 +02:00
Simon L.
0250098a71 Merge pull request #5399 from nextcloud/imaginary-container-update
Imaginary update
2024-10-09 15:29:54 +02:00
szaimen
1ea728bd2a imaginary-update automated change
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-09 12:10:45 +00:00
Simon L.
bf8395c62e nginx: radjust configs
Signed-off-by: Simon L. <szaimen@e.mail.de>
2024-10-09 13:51:29 +02:00
Simon L.
531104db66 increase to 9.7.0
Signed-off-by: Simon L. <szaimen@e.mail.de>
2024-10-08 11:08:23 +02:00
Simon L.
32f8c6587c Merge pull request #5372 from nextcloud/enh/noid/enum
Use enum instead of interface for state
2024-10-08 10:57:01 +02:00
Simon L.
b375f61a70 Merge pull request #5395 from nextcloud/dependabot/docker/Containers/talk-recording/python-3.13.0-alpine3.20
build(deps): bump python from 3.12.7-alpine3.20 to 3.13.0-alpine3.20 in /Containers/talk-recording
2024-10-08 09:47:44 +02:00
Simon L.
519b5114d7 Merge pull request #5394 from nextcloud/dependabot/docker/Containers/redis/redis-7.2.6-alpine
build(deps): bump redis from 7.2.5-alpine to 7.2.6-alpine in /Containers/redis
2024-10-08 09:47:25 +02:00
dependabot[bot]
bd9070ec6a build(deps): bump python in /Containers/talk-recording
Bumps python from 3.12.7-alpine3.20 to 3.13.0-alpine3.20.

---
updated-dependencies:
- dependency-name: python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 05:04:23 +00:00
dependabot[bot]
966e0175ab build(deps): bump redis in /Containers/redis
Bumps redis from 7.2.5-alpine to 7.2.6-alpine.

---
updated-dependencies:
- dependency-name: redis
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-08 05:04:09 +00:00
Simon L.
433a7c81fe Merge pull request #5392 from nextcloud/dependabot/docker/Containers/whiteboard/nextcloud-releases/whiteboard-v1.0.3
build(deps): bump nextcloud-releases/whiteboard from v1.0.2 to v1.0.3 in /Containers/whiteboard
2024-10-07 18:08:50 +02:00
dependabot[bot]
386bab0958 build(deps): bump nextcloud-releases/whiteboard
Bumps nextcloud-releases/whiteboard from v1.0.2 to v1.0.3.

---
updated-dependencies:
- dependency-name: nextcloud-releases/whiteboard
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 16:08:00 +00:00
Jean-Yves
dc209adb84 Update php/src/Container/WorkingState.php
Co-authored-by: Simon L. <szaimen@e.mail.de>
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
2024-10-07 13:24:21 +02:00
Jean-Yves
edeb5ca40a Fix containers.twig
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
2024-10-07 13:22:38 +02:00
Jean-Yves
a0ec043c49 Add Enum
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
2024-10-07 13:22:37 +02:00
Simon L.
a54cfed53d Merge pull request #5389 from nextcloud/enh/noid/constructor
Inprove constructor
2024-10-07 12:49:08 +02:00
Simon L.
a5e8c82e59 Merge pull request #5382 from nextcloud/nextcloud-container-update
Nextcloud dependency update
2024-10-07 11:27:37 +02:00
Simon L.
43e60cb76f Merge pull request #5388 from nextcloud/dependabot/docker/Containers/clamav/clamav/clamav-1.4.1-7
build(deps): bump clamav/clamav from 1.4.1-5 to 1.4.1-7 in /Containers/clamav
2024-10-07 11:27:23 +02:00
Jean-Yves
496ec9ba17 update constructor
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
2024-10-07 10:12:43 +02:00
dependabot[bot]
505e2dc2ab build(deps): bump clamav/clamav in /Containers/clamav
Bumps clamav/clamav from 1.4.1-5 to 1.4.1-7.

---
updated-dependencies:
- dependency-name: clamav/clamav
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 04:34:27 +00:00
szaimen
4aaf8e9067 nextcloud-update automated change
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-10-05 12:09:56 +00:00
32 changed files with 153 additions and 307 deletions

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:latest
# Probably from this file: https://github.com/Cisco-Talos/clamav-docker/blob/main/clamav/1.3/alpine/Dockerfile
FROM clamav/clamav:1.4.1-5
FROM clamav/clamav:1.4.1-7
COPY clamav.conf /clamav.conf
COPY --chmod=775 start.script /start.script

View File

@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:latest
FROM golang:1.23.2-alpine3.20 AS go
ENV IMAGINARY_HASH=6cd9edd1d3fb151eb773c14552886e4fc8e50138
ENV IMAGINARY_HASH=8f36a26c448be8c151a3878404b75fcd1cd3cf0c
RUN set -ex; \
apk add --no-cache \

View File

@@ -8,7 +8,7 @@ ENV SOURCE_LOCATION=/usr/src/nextcloud
ENV REDIS_DB_INDEX=0
# AIO settings start # Do not remove or change this line!
ENV NEXTCLOUD_VERSION=29.0.7
ENV NEXTCLOUD_VERSION=29.0.8
ENV AIO_TOKEN=123456
ENV AIO_URL=localhost
# AIO settings end # Do not remove or change this line!
@@ -81,7 +81,7 @@ RUN set -ex; \
pecl install igbinary-3.2.16; \
pecl install APCu-5.1.24; \
pecl install -D 'enable-memcached-igbinary="yes"' memcached-3.2.0; \
pecl install -D 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"' redis-6.0.2; \
pecl install -D 'enable-redis-igbinary="yes" enable-redis-zstd="yes" enable-redis-lz4="yes"' redis-6.1.0; \
pecl install imagick-3.7.0; \
\
docker-php-ext-enable \

View File

@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:latest
# From https://github.com/docker-library/redis/blob/master/7.2/alpine/Dockerfile
FROM redis:7.2.5-alpine
FROM redis:7.2.6-alpine
COPY --chmod=775 start.sh /start.sh

View File

@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:latest
FROM python:3.12.7-alpine3.20
FROM python:3.13.0-alpine3.20
COPY --chmod=775 start.sh /start.sh

View File

@@ -1,5 +1,5 @@
# syntax=docker/dockerfile:latest
FROM ghcr.io/nextcloud-releases/whiteboard:v1.0.2
FROM ghcr.io/nextcloud-releases/whiteboard:v1.0.3
USER root
RUN set -ex; \

View File

@@ -6,12 +6,12 @@ use AIO\Data\ConfigurationManager;
use AIO\Data\DataConst;
use \DateTime;
class AuthManager {
readonly class AuthManager {
private const string SESSION_KEY = 'aio_authenticated';
private ConfigurationManager $configurationManager;
public function __construct(ConfigurationManager $configurationManager) {
$this->configurationManager = $configurationManager;
public function __construct(
private ConfigurationManager $configurationManager
) {
}
public function CheckCredentials(string $password) : bool {

View File

@@ -2,92 +2,42 @@
namespace AIO\Container;
use AIO\Container\State\IContainerState;
use AIO\Data\ConfigurationManager;
use AIO\Docker\DockerActionManager;
use AIO\ContainerDefinitionFetcher;
class Container {
private string $identifier;
private string $displayName;
private string $containerName;
private string $restartPolicy;
private int $maxShutdownTime;
private ContainerPorts $ports;
private string $internalPorts;
private ContainerVolumes $volumes;
private ContainerEnvironmentVariables $containerEnvironmentVariables;
/** @var string[] */
private array $dependsOn;
/** @var string[] */
private array $secrets;
/** @var string[] */
private array $devices;
/** @var string[] */
private array $capAdd;
private int $shmSize;
private bool $apparmorUnconfined;
/** @var string[] */
private array $backupVolumes;
private array $nextcloudExecCommands;
private bool $readOnlyRootFs;
private array $tmpfs;
private bool $init;
private string $imageTag;
private AioVariables $aioVariables;
private string $documentation;
private DockerActionManager $dockerActionManager;
readonly class Container {
public function __construct(
string $identifier,
string $displayName,
string $containerName,
string $restartPolicy,
int $maxShutdownTime,
ContainerPorts $ports,
string $internalPorts,
ContainerVolumes $volumes,
ContainerEnvironmentVariables $containerEnvironmentVariables,
array $dependsOn,
array $secrets,
array $devices,
array $capAdd,
int $shmSize,
bool $apparmorUnconfined,
array $backupVolumes,
array $nextcloudExecCommands,
bool $readOnlyRootFs,
array $tmpfs,
bool $init,
string $imageTag,
AioVariables $aioVariables,
string $documentation,
DockerActionManager $dockerActionManager
private string $identifier,
private string $displayName,
private string $containerName,
private string $restartPolicy,
private int $maxShutdownTime,
private ContainerPorts $ports,
private string $internalPorts,
private ContainerVolumes $volumes,
private ContainerEnvironmentVariables $containerEnvironmentVariables,
/** @var string[] */
private array $dependsOn,
/** @var string[] */
private array $secrets,
/** @var string[] */
private array $devices,
/** @var string[] */
private array $capAdd,
private int $shmSize,
private bool $apparmorUnconfined,
/** @var string[] */
private array $backupVolumes,
private array $nextcloudExecCommands,
private bool $readOnlyRootFs,
private array $tmpfs,
private bool $init,
private string $imageTag,
private AioVariables $aioVariables,
private string $documentation,
private DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
$this->displayName = $displayName;
$this->containerName = $containerName;
$this->restartPolicy = $restartPolicy;
$this->maxShutdownTime = $maxShutdownTime;
$this->ports = $ports;
$this->internalPorts = $internalPorts;
$this->volumes = $volumes;
$this->containerEnvironmentVariables = $containerEnvironmentVariables;
$this->dependsOn = $dependsOn;
$this->secrets = $secrets;
$this->devices = $devices;
$this->capAdd = $capAdd;
$this->shmSize = $shmSize;
$this->apparmorUnconfined = $apparmorUnconfined;
$this->backupVolumes = $backupVolumes;
$this->nextcloudExecCommands = $nextcloudExecCommands;
$this->readOnlyRootFs = $readOnlyRootFs;
$this->tmpfs = $tmpfs;
$this->init = $init;
$this->imageTag = $imageTag;
$this->aioVariables = $aioVariables;
$this->documentation = $documentation;
$this->dockerActionManager = $dockerActionManager;
}
public function GetIdentifier() : string {
@@ -162,19 +112,19 @@ class Container {
return $this->volumes;
}
public function GetRunningState() : IContainerState {
public function GetRunningState() : ContainerState {
return $this->dockerActionManager->GetContainerRunningState($this);
}
public function GetRestartingState() : IContainerState {
public function GetRestartingState() : ContainerState {
return $this->dockerActionManager->GetContainerRestartingState($this);
}
public function GetUpdateState() : IContainerState {
public function GetUpdateState() : VersionState {
return $this->dockerActionManager->GetContainerUpdateState($this);
}
public function GetStartingState() : IContainerState {
public function GetStartingState() : ContainerState {
return $this->dockerActionManager->GetContainerStartingState($this);
}

View File

@@ -3,17 +3,10 @@
namespace AIO\Container;
class ContainerPort {
public string $port;
public string $ipBinding;
public string $protocol;
public function __construct(
string $port,
string $ipBinding,
string $protocol
public string $port,
public string $ipBinding,
public string $protocol
) {
$this->port = $port;
$this->ipBinding = $ipBinding;
$this->protocol = $protocol;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace AIO\Container;
enum ContainerState: string {
case ImageDoesNotExist = 'image_does_not_exist';
case NotRestarting = 'not_restarting';
case Restarting = 'restarting';
case Running = 'running';
case Starting = 'starting';
case Stopped = 'stopped';
}

View File

@@ -3,17 +3,10 @@
namespace AIO\Container;
class ContainerVolume {
public string $name;
public string $mountPoint;
public bool $isWritable;
public function __construct(
string $name,
string $mountPoint,
bool $isWritable
public string $name,
public string $mountPoint,
public bool $isWritable
) {
$this->name = $name;
$this->mountPoint = $mountPoint;
$this->isWritable = $isWritable;
}
}

View File

@@ -1,5 +0,0 @@
<?php
namespace AIO\Container\State;
interface IContainerState {}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class ImageDoesNotExistState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class NotRestartingState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class RestartingState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class RunningState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class StartingState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class StoppedState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class VersionDifferentState implements IContainerState
{}

View File

@@ -1,6 +0,0 @@
<?php
namespace AIO\Container\State;
class VersionEqualState implements IContainerState
{}

View File

@@ -0,0 +1,8 @@
<?php
namespace AIO\Container;
enum VersionState: string {
case Different = 'different';
case Equal = 'equal';
}

View File

@@ -9,23 +9,15 @@ use AIO\Container\ContainerPort;
use AIO\Container\ContainerPorts;
use AIO\Container\ContainerVolume;
use AIO\Container\ContainerVolumes;
use AIO\Container\State\RunningState;
use AIO\Data\ConfigurationManager;
use AIO\Data\DataConst;
use AIO\Docker\DockerActionManager;
class ContainerDefinitionFetcher
{
private ConfigurationManager $configurationManager;
private \DI\Container $container;
readonly class ContainerDefinitionFetcher {
public function __construct(
ConfigurationManager $configurationManager,
\DI\Container $container
)
{
$this->configurationManager = $configurationManager;
$this->container = $container;
private ConfigurationManager $configurationManager,
private \DI\Container $container
) {
}
public function GetContainerById(string $id): Container
@@ -103,7 +95,7 @@ class ContainerDefinitionFetcher
$ports = new ContainerPorts();
if (isset($entry['ports'])) {
foreach ($entry['ports'] as $value) {
foreach ($entry['ports'] as $value) {
$ports->AddPort(
new ContainerPort(
$value['port_number'],
@@ -212,7 +204,7 @@ class ContainerDefinitionFetcher
$dependsOn[] = $value;
}
}
$variables = new ContainerEnvironmentVariables();
if (isset($entry['environment'])) {
foreach ($entry['environment'] as $value) {

View File

@@ -9,14 +9,10 @@ use AIO\Docker\DockerActionManager;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class ConfigurationController
{
private ConfigurationManager $configurationManager;
readonly class ConfigurationController {
public function __construct(
ConfigurationManager $configurationManager
private ConfigurationManager $configurationManager
) {
$this->configurationManager = $configurationManager;
}
public function SetConfig(Request $request, Response $response, array $args) : Response {

View File

@@ -2,28 +2,21 @@
namespace AIO\Controller;
use AIO\Container\State\RunningState;
use AIO\Container\ContainerState;
use AIO\ContainerDefinitionFetcher;
use AIO\Docker\DockerActionManager;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use AIO\Data\ConfigurationManager;
class DockerController
{
private DockerActionManager $dockerActionManager;
private ContainerDefinitionFetcher $containerDefinitionFetcher;
readonly class DockerController {
private const string TOP_CONTAINER = 'nextcloud-aio-apache';
private ConfigurationManager $configurationManager;
public function __construct(
DockerActionManager $dockerActionManager,
ContainerDefinitionFetcher $containerDefinitionFetcher,
ConfigurationManager $configurationManager
private DockerActionManager $dockerActionManager,
private ContainerDefinitionFetcher $containerDefinitionFetcher,
private ConfigurationManager $configurationManager
) {
$this->dockerActionManager = $dockerActionManager;
$this->containerDefinitionFetcher = $containerDefinitionFetcher;
$this->configurationManager = $configurationManager;
}
private function PerformRecursiveContainerStart(string $id, bool $pullImage = true) : void {
@@ -35,7 +28,7 @@ class DockerController
// Don't start if container is already running
// This is expected to happen if a container is defined in depends_on of multiple containers
if ($container->GetRunningState() instanceof RunningState) {
if ($container->GetRunningState() === ContainerState::Running) {
error_log('Not starting ' . $id . ' because it was already started.');
return;
}
@@ -48,7 +41,7 @@ class DockerController
}
}
// Check if docker hub is reachable in order to make sure that we do not try to pull an image if it is down
// Check if docker hub is reachable in order to make sure that we do not try to pull an image if it is down
// and try to mitigate issues that are arising due to that
if ($pullImage) {
if (!$this->dockerActionManager->isDockerHubReachable($container)) {
@@ -261,10 +254,10 @@ class DockerController
$domaincheckContainer = $this->containerDefinitionFetcher->GetContainerById($id);
$apacheContainer = $this->containerDefinitionFetcher->GetContainerById(self::TOP_CONTAINER);
// Don't start if apache is already running
if ($apacheContainer->GetRunningState() instanceof RunningState) {
if ($apacheContainer->GetRunningState() === ContainerState::Running) {
return;
// Don't start if domaincheck is already running
} elseif ($domaincheckContainer->GetRunningState() instanceof RunningState) {
} elseif ($domaincheckContainer->GetRunningState() === ContainerState::Running) {
$domaincheckWasStarted = apcu_fetch($cacheKey);
// Start domaincheck again when 10 minutes are over by not returning here
if($domaincheckWasStarted !== false && is_string($domaincheckWasStarted)) {

View File

@@ -9,14 +9,11 @@ use AIO\Docker\DockerActionManager;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
class LoginController
{
private AuthManager $authManager;
private DockerActionManager $dockerActionManager;
public function __construct(AuthManager $authManager, DockerActionManager $dockerActionManager) {
$this->authManager = $authManager;
$this->dockerActionManager = $dockerActionManager;
readonly class LoginController {
public function __construct(
private AuthManager $authManager,
private DockerActionManager $dockerActionManager,
) {
}
public function TryLogin(Request $request, Response $response, array $args) : Response {

View File

@@ -4,16 +4,11 @@ namespace AIO\Data;
use AIO\Auth\PasswordGenerator;
class Setup
{
private PasswordGenerator $passwordGenerator;
private ConfigurationManager $configurationManager;
readonly class Setup {
public function __construct(
PasswordGenerator $passwordGenerator,
ConfigurationManager $configurationManager) {
$this->passwordGenerator = $passwordGenerator;
$this->configurationManager = $configurationManager;
private PasswordGenerator $passwordGenerator,
private ConfigurationManager $configurationManager,
) {
}
public function Setup() : string {

View File

@@ -3,44 +3,24 @@
namespace AIO\Docker;
use AIO\Container\Container;
use AIO\Container\State\IContainerState;
use AIO\Container\State\ImageDoesNotExistState;
use AIO\Container\State\StartingState;
use AIO\Container\State\RunningState;
use AIO\Container\State\RestartingState;
use AIO\Container\State\NotRestartingState;
use AIO\Container\State\VersionDifferentState;
use AIO\Container\State\StoppedState;
use AIO\Container\State\VersionEqualState;
use AIO\Container\VersionState;
use AIO\Container\ContainerState;
use AIO\Data\ConfigurationManager;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use AIO\ContainerDefinitionFetcher;
use http\Env\Response;
class DockerActionManager
{
readonly class DockerActionManager {
private const string API_VERSION = 'v1.41';
private \GuzzleHttp\Client $guzzleClient;
private ConfigurationManager $configurationManager;
private ContainerDefinitionFetcher $containerDefinitionFetcher;
private DockerHubManager $dockerHubManager;
private Client $guzzleClient;
public function __construct(
ConfigurationManager $configurationManager,
ContainerDefinitionFetcher $containerDefinitionFetcher,
DockerHubManager $dockerHubManager
private ConfigurationManager $configurationManager,
private ContainerDefinitionFetcher $containerDefinitionFetcher,
private DockerHubManager $dockerHubManager
) {
$this->configurationManager = $configurationManager;
$this->containerDefinitionFetcher = $containerDefinitionFetcher;
$this->dockerHubManager = $dockerHubManager;
$this->guzzleClient = new \GuzzleHttp\Client(
[
'curl' => [
CURLOPT_UNIX_SOCKET_PATH => '/var/run/docker.sock',
],
]
);
$this->guzzleClient = new Client(['curl' => [CURLOPT_UNIX_SOCKET_PATH => '/var/run/docker.sock']]);
}
private function BuildApiUrl(string $url) : string {
@@ -55,14 +35,14 @@ class DockerActionManager
return $container->GetContainerName() . ':' . $tag;
}
public function GetContainerRunningState(Container $container) : IContainerState
public function GetContainerRunningState(Container $container) : ContainerState
{
$url = $this->BuildApiUrl(sprintf('containers/%s/json', urlencode($container->GetIdentifier())));
try {
$response = $this->guzzleClient->get($url);
} catch (RequestException $e) {
if ($e->getCode() === 404) {
return new ImageDoesNotExistState();
return ContainerState::ImageDoesNotExist;
}
throw $e;
}
@@ -70,20 +50,20 @@ class DockerActionManager
$responseBody = json_decode((string)$response->getBody(), true);
if ($responseBody['State']['Running'] === true) {
return new RunningState();
return ContainerState::Running;
} else {
return new StoppedState();
return ContainerState::Stopped;
}
}
public function GetContainerRestartingState(Container $container) : IContainerState
public function GetContainerRestartingState(Container $container) : ContainerState
{
$url = $this->BuildApiUrl(sprintf('containers/%s/json', urlencode($container->GetIdentifier())));
try {
$response = $this->guzzleClient->get($url);
} catch (RequestException $e) {
if ($e->getCode() === 404) {
return new ImageDoesNotExistState();
return ContainerState::ImageDoesNotExist;
}
throw $e;
}
@@ -91,13 +71,13 @@ class DockerActionManager
$responseBody = json_decode((string)$response->getBody(), true);
if ($responseBody['State']['Restarting'] === true) {
return new RestartingState();
return ContainerState::Restarting;
} else {
return new NotRestartingState();
return ContainerState::NotRestarting;
}
}
public function GetContainerUpdateState(Container $container) : IContainerState
public function GetContainerUpdateState(Container $container) : VersionState
{
$tag = $container->GetImageTag();
if ($tag === '%AIO_CHANNEL%') {
@@ -106,28 +86,26 @@ class DockerActionManager
$runningDigests = $this->GetRepoDigestsOfContainer($container->GetIdentifier());
if ($runningDigests === null) {
return new VersionDifferentState();
return VersionState::Different;
}
$remoteDigest = $this->dockerHubManager->GetLatestDigestOfTag($container->GetContainerName(), $tag);
if ($remoteDigest === null) {
return new VersionEqualstate();
return VersionState::Equal;
}
foreach($runningDigests as $runningDigest) {
if ($runningDigest === $remoteDigest) {
return new VersionEqualState();
return VersionState::Equal;
}
}
return new VersionDifferentState();
return VersionState::Different;
}
public function GetContainerStartingState(Container $container) : IContainerState
public function GetContainerStartingState(Container $container) : ContainerState
{
$runningState = $this->GetContainerRunningState($container);
if ($runningState instanceof StoppedState) {
return new StoppedState();
} elseif ($runningState instanceof ImageDoesNotExistState) {
return new ImageDoesNotExistState();
if ($runningState === ContainerState::Stopped || $runningState === ContainerState::ImageDoesNotExist) {
return $runningState;
}
$containerName = $container->GetIdentifier();
@@ -142,12 +120,12 @@ class DockerActionManager
$connection = @fsockopen($containerName, (int)$internalPort, $errno, $errstr, 0.2);
if ($connection) {
fclose($connection);
return new RunningState();
return ContainerState::Running;
} else {
return new StartingState();
return ContainerState::Starting;
}
} else {
return new RunningState();
return ContainerState::Running;
}
}
@@ -641,7 +619,7 @@ class DockerActionManager
$container = $this->containerDefinitionFetcher->GetContainerById($id);
$updateAvailable = "";
if ($container->GetUpdateState() instanceof VersionDifferentState) {
if ($container->GetUpdateState() === VersionState::Different) {
$updateAvailable = '1';
}
foreach ($container->GetDependsOn() as $dependency) {
@@ -802,7 +780,7 @@ class DockerActionManager
public function sendNotification(Container $container, string $subject, string $message, string $file = '/notify.sh') : void
{
if ($this->GetContainerStartingState($container) instanceof RunningState) {
if ($this->GetContainerStartingState($container) === ContainerState::Running) {
$containerName = $container->GetIdentifier();
@@ -986,7 +964,7 @@ class DockerActionManager
public function isLoginAllowed() : bool {
$id = 'nextcloud-aio-apache';
$apacheContainer = $this->containerDefinitionFetcher->GetContainerById($id);
if ($this->GetContainerStartingState($apacheContainer) instanceof RunningState) {
if ($this->GetContainerStartingState($apacheContainer) === ContainerState::Running) {
return false;
}
return true;
@@ -995,7 +973,7 @@ class DockerActionManager
public function isBackupContainerRunning() : bool {
$id = 'nextcloud-aio-borgbackup';
$backupContainer = $this->containerDefinitionFetcher->GetContainerById($id);
if ($this->GetContainerRunningState($backupContainer) instanceof RunningState) {
if ($this->GetContainerRunningState($backupContainer) === ContainerState::Running) {
return true;
}
return false;

View File

@@ -6,12 +6,11 @@ use AIO\ContainerDefinitionFetcher;
use AIO\Data\ConfigurationManager;
use GuzzleHttp\Client;
class DockerHubManager
{
readonly class DockerHubManager {
private Client $guzzleClient;
public function __construct()
{
public function __construct(
) {
$this->guzzleClient = new Client();
}
@@ -59,4 +58,4 @@ class DockerHubManager
return null;
}
}
}
}

View File

@@ -8,12 +8,10 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
class AuthMiddleware
{
private AuthManager $authManager;
public function __construct(AuthManager $authManager) {
$this->authManager = $authManager;
readonly class AuthMiddleware {
public function __construct(
private AuthManager $authManager
) {
}
public function __invoke(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface

View File

@@ -3,17 +3,13 @@
namespace AIO\Twig;
use Slim\Csrf\Guard;
use Twig\Extension\AbstractExtension;
use Twig\Extension\GlobalsInterface;
class CsrfExtension extends \Twig\Extension\AbstractExtension implements \Twig\Extension\GlobalsInterface
{
/**
* @var Guard
*/
protected Guard $csrf;
public function __construct(Guard $csrf)
{
$this->csrf = $csrf;
class CsrfExtension extends AbstractExtension implements GlobalsInterface {
public function __construct(
protected Guard $csrf
) {
}
public function getGlobals() : array
@@ -35,4 +31,4 @@ class CsrfExtension extends \Twig\Extension\AbstractExtension implements \Twig\E
]
];
}
}
}

View File

@@ -16,7 +16,7 @@
</header>
<main>
<h1>Nextcloud AIO v9.6.0</h1>
<h1>Nextcloud AIO v9.7.0</h1>
{# Add 2nd tab warning #}
<script type="text/javascript" src="second-tab-warning.js"></script>
@@ -40,19 +40,19 @@
{% endif %}
{% for container in containers %}
{% if container.GetDisplayName() != '' and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
{% if container.GetDisplayName() != '' and container.GetRunningState().value == 'running' %}
{% set isAnyRunning = true %}
{% endif %}
{% if container.GetDisplayName() != '' and class(container.GetRestartingState()) == 'AIO\\Container\\State\\RestartingState' %}
{% if container.GetDisplayName() != '' and container.GetRestartingState().value == 'restarting' %}
{% set isAnyRestarting = true %}
{% endif %}
{% if container.GetIdentifier() == 'nextcloud-aio-watchtower' and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
{% if container.GetIdentifier() == 'nextcloud-aio-watchtower' and container.GetRunningState().value == 'running' %}
{% set isWatchtowerRunning = true %}
{% endif %}
{% if container.GetIdentifier() == 'nextcloud-aio-domaincheck' and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
{% if container.GetIdentifier() == 'nextcloud-aio-domaincheck' and container.GetRunningState().value == 'running' %}
{% set isDomaincheckRunning = true %}
{% endif %}
{% if container.GetIdentifier() == 'nextcloud-aio-apache' and class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
{% if container.GetIdentifier() == 'nextcloud-aio-apache' and container.GetStartingState().value == 'starting' %}
{% set isApacheStarting = true %}
{% endif %}
{% endfor %}
@@ -261,14 +261,14 @@
{% for container in containers %}
{% if container.GetDisplayName() != '' %}
<li>
{% if class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %}
{% if container.GetStartingState().value == 'starting' %}
<span class="status running"></span>
<span>{{ container.GetDisplayName() }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}" target="_blank" rel="noopener">Starting</a>)
{% if container.GetDocumentation() != '' %}
(<a href="{{ container.GetDocumentation() }}">docs</a>)
{% endif %}
</span>
{% elseif class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %}
{% elseif container.GetRunningState().value == 'running' %}
<span class="status success"></span>
<span>{{ container.GetDisplayName() }} (<a href="/api/docker/logs?id={{ container.GetIdentifier() }}" target="_blank" rel="noopener">Running</a>)
{% if container.GetDocumentation() != '' %}

View File

@@ -353,10 +353,9 @@ server {
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
client_body_buffer_size 512k;
proxy_request_buffering off;
proxy_read_timeout 86400s;
client_max_body_size 0;