Skip to content

Commit

Permalink
Manual backport of #436
Browse files Browse the repository at this point in the history
  • Loading branch information
bigcat88 committed Nov 8, 2024
1 parent 2aa683c commit 646c40b
Showing 1 changed file with 17 additions and 1 deletion.
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

0 comments on commit 646c40b

Please sign in to comment.