Skip to content
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
check healthcheck and heartbeat after ExApp container start
Signed-off-by: bigcat88 <[email protected]>
  • Loading branch information
bigcat88 committed Oct 31, 2024
commit 7360d998f34b25662f781527820641b241c885ad
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