Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check healthcheck and heartbeat after ExApp container start [backport] [stable30] #440

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion lib/Service/AppAPIService.php
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,23 @@ public function enableExApp(ExApp $exApp): bool {
if ($exApp->getAcceptsDeployId() === $this->dockerActions->getAcceptsDeployId()) {
$daemonConfig = $this->daemonConfigService->getDaemonConfigByName($exApp->getDaemonConfigName());
$this->dockerActions->initGuzzleClient($daemonConfig);
$this->dockerActions->startContainer($this->dockerActions->buildDockerUrl($daemonConfig), $this->dockerActions->buildExAppContainerName($exApp->getAppid()));
$containerName = $this->dockerActions->buildExAppContainerName($exApp->getAppid());
$this->dockerActions->startContainer($this->dockerActions->buildDockerUrl($daemonConfig), $containerName);
if (!$this->dockerActions->waitTillContainerStart($containerName, $daemonConfig)) {
$this->logger->error(sprintf('ExApp %s container startup failed.', $exApp->getAppid()));
return false;
}
if (!$this->dockerActions->healthcheckContainer($containerName, $daemonConfig, true)) {
$this->logger->error(sprintf('ExApp %s container healthcheck failed.', $exApp->getAppid()));
return false;
}
}

$auth = [];
$exAppRootUrl = $this->getExAppUrl($exApp, $exApp->getPort(), $auth);
if (!$this->heartbeatExApp($exAppRootUrl, $auth, $exApp->getAppid())) {
$this->logger->error(sprintf('ExApp %s heartbeat failed.', $exApp->getAppid()));
return false;
}

$exAppEnabled = $this->requestToExApp($exApp, '/enabled?enabled=1', null, 'PUT', options: ['timeout' => 60]);
Expand Down
Loading