diff --git a/src/Commands/ProtocolStart.php b/src/Commands/ProtocolStart.php index 7dbfb36..0cd086e 100644 --- a/src/Commands/ProtocolStart.php +++ b/src/Commands/ProtocolStart.php @@ -236,6 +236,9 @@ private function startDirect(string $dir): int $this->checkDiskSpace(); $this->writeSummary($dir, $ctx); + // Clear cached data so status reads fresh state from disk + Json::clearInstances(); + // Run protocol status to show full dashboard $statusArgs = new ArrayInput(['--dir' => $dir]); $this->getApplication()->find('status')->run($statusArgs, $this->output); diff --git a/src/Commands/ProtocolStatus.php b/src/Commands/ProtocolStatus.php index eb91e98..ab630cf 100644 --- a/src/Commands/ProtocolStatus.php +++ b/src/Commands/ProtocolStatus.php @@ -139,7 +139,7 @@ private function buildContext(InputInterface $input): array $strategy = $nodeData['deployment']['strategy'] ?? 'none'; $projectName = $nodeData['name'] ?? $nodeConfig; $releasesDir = $nodeData['bluegreen']['releases_dir'] ?? null; - $currentRelease = $nodeData['release']['current'] ?? null; + $currentRelease = $nodeData['release']['active'] ?? $nodeData['release']['current'] ?? null; $currentBranch = $nodeData['deployment']['branch'] ?? null; $awaitingRelease = $nodeData['deployment']['awaiting_release'] ?? false; $dockerImage = $nodeData['docker']['image'] ?? null; @@ -413,6 +413,7 @@ private function renderDocker(array $ctx): void { $output = $this->output; $repo_dir = $ctx['repo_dir']; + $strategy = $ctx['strategy']; $dockerDir = ($ctx['nodeConfig'] && $ctx['activeDir']) ? $ctx['activeDir'] : $repo_dir; $containers = ContainerName::resolveAll($repo_dir); @@ -421,12 +422,14 @@ private function renderDocker(array $ctx): void } $releaseDockerDir = null; + $activeContainerName = null; if (BlueGreen::isEnabled($repo_dir)) { $activeVersion = BlueGreen::getActiveVersion($repo_dir); if ($activeVersion) { $releaseDir = BlueGreen::getReleaseDir($repo_dir, $activeVersion); if (is_dir($releaseDir)) { $releaseDockerDir = $releaseDir; + $activeContainerName = ContainerName::resolveFromDir($releaseDir); } } } @@ -446,7 +449,14 @@ private function renderDocker(array $ctx): void $this->writeService($output, $container, 'running', $stats); } else { $this->writeService($output, $container, 'stopped'); - $this->issues[] = "Container '{$container}' is not running"; + // Only flag as issue if this is the active container or strategy=none + // Old release containers being stopped is expected + $isActiveContainer = ($strategy === 'none') + || (!$activeContainerName) + || ($container === $activeContainerName); + if ($isActiveContainer) { + $this->issues[] = "Container '{$container}' is not running"; + } } } diff --git a/src/Utils/NodeConfig.php b/src/Utils/NodeConfig.php index 55d8c06..7a96832 100644 --- a/src/Utils/NodeConfig.php +++ b/src/Utils/NodeConfig.php @@ -261,7 +261,7 @@ public static function resolveActiveDir(array $data): string { $strategy = $data['deployment']['strategy'] ?? 'none'; $releasesDir = $data['bluegreen']['releases_dir'] ?? null; - $currentRelease = $data['release']['current'] ?? null; + $currentRelease = $data['release']['active'] ?? $data['release']['current'] ?? null; $currentBranch = $data['deployment']['branch'] ?? $data['git']['branch'] ?? null; $projectName = $data['name'] ?? 'unknown';