Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
replace keepalive /bin/sh with httpd -f, add healthcheck on port 80…
Browse files Browse the repository at this point in the history
… tcp of the keepalive service
  • Loading branch information
svensp committed Nov 7, 2019
1 parent 3dc1ca4 commit 16bc3b5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions app/Blueprint/Keepalive/KeepaliveService.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Rancherize\Blueprint\Keepalive;

use Rancherize\Blueprint\Healthcheck\HealthcheckExtraInformation\HealthcheckExtraInformation;
use Rancherize\Blueprint\Infrastructure\Service\NetworkMode\ShareNetworkMode;
use Rancherize\Blueprint\Infrastructure\Service\Service;

Expand All @@ -10,6 +11,25 @@
class KeepaliveService extends Service
{

public function __construct() {
parent::__construct();

$this->image = 'busybox';
$this->command = 'httpd -f';
$this->tty = false;
$this->keepStdin = false;

$this->setHealthcheck();
}

private function setHealthcheck()
{
$healthcheckInformation = new HealthcheckExtraInformation();
$healthcheckInformation->setPort(80);
$healthcheckInformation->setInterval(10000);
$this->addExtraInformation($healthcheckInformation);
}

/**
* @var Service
*/
Expand All @@ -27,10 +47,6 @@ public function setTargetService(Service $targetService): KeepaliveService

public function takeOver()
{
$this->image = 'busybox';
$this->command = '/bin/sh';
$this->tty = true;
$this->keepStdin = true;

$targetService = $this->targetService;
$this->setName(function() use ($targetService) {
Expand Down

0 comments on commit 16bc3b5

Please sign in to comment.