PerformRecursiveContainerStop: Fix the stop order

Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
Simon L. 2025-07-24 10:36:27 +02:00
parent 762d911a94
commit adeee71982
2 changed files with 13 additions and 6 deletions

View file

@ -8,9 +8,9 @@
"nextcloud-aio-onlyoffice",
"nextcloud-aio-collabora",
"nextcloud-aio-talk",
"nextcloud-aio-nextcloud",
"nextcloud-aio-notify-push",
"nextcloud-aio-whiteboard"
"nextcloud-aio-whiteboard",
"nextcloud-aio-nextcloud"
],
"display_name": "Apache",
"image": "ghcr.io/nextcloud-releases/aio-apache",

View file

@ -22,6 +22,7 @@ readonly class DockerController {
private function PerformRecursiveContainerStart(string $id, bool $pullImage = true) : void {
$container = $this->containerDefinitionFetcher->GetContainerById($id);
// Start all dependencies first and then itself
foreach($container->GetDependsOn() as $dependency) {
$this->PerformRecursiveContainerStart($dependency, $pullImage);
}
@ -227,13 +228,19 @@ readonly class DockerController {
private function PerformRecursiveContainerStop(string $id) : void
{
$container = $this->containerDefinitionFetcher->GetContainerById($id);
// This is a hack but no better solution was found for the meantime
// Stop Collabora first to make sure it force-saves
// See https://github.com/nextcloud/richdocuments/issues/3799
if ($id === self::TOP_CONTAINER) {
$this->PerformRecursiveContainerStop('nextcloud-aio-collabora');
}
// Stop itself first and then all the dependencies
$this->dockerActionManager->StopContainer($container);
foreach($container->GetDependsOn() as $dependency) {
$this->PerformRecursiveContainerStop($dependency);
}
// Disconnecting is not needed. This also allows to start the containers manually via docker-cli
//$this->dockerActionManager->DisconnectContainerFromNetwork($container);
$this->dockerActionManager->StopContainer($container);
}
public function StopContainer(Request $request, Response $response, array $args) : Response